2011-01-13 5 views
2

안녕하세요 저는td를 빈 td로 대체하는 방법

<td valign="top" style="width:150px;" > 
    <img alt="<recipetitle/>" src="http://<rootweburl/>/photos/recipes/Large/<recipephotoname/>" alt="logo" style="float:left;"/> 
</td> 

와 같은 구조를 가지고 있습니다. <recipetitle/><recipephotoname/>은 매개 변수이며 변경할 수 있습니다.이 td를 빈 td로 바꾸고 싶습니다. 어떻게해야합니까? C#

답변

3

테이블 셀을 서버 사이드 컨트롤로 만들어 코드 뒤에서 액세스 할 수 있도록해야한다.

<table> 
    <tr> 
     <td valign="top" style="width:150px;" runat="server" id="tdToBeCleared"> 
      <img alt="<recipetitle/>" src="http://<rootweburl/>/photos/recipes/Large/<recipephotoname/>" alt="logo" style="float:left;"/> 
     </td>   
    </tr> 
</table> 

코드 숨김에서 컨트롤의 innerhtml을 변경할 수 있습니다.

tdToBeCleared.InnerHtml = string.Empty; 

편집 :는 그냥 예와 일치하도록 TD를 변경, 당신은 단순히 복사 및 붙여 넣기 당신이 내용을 삭제하려면, 단순히 다음 줄을 사용합니다.

+0

+1 - 형식이 잘못된 답변이지만 올바릅니다. –

+0

최선을 다하겠습니다 :) – Pabuc

+0

대체 방법 - 이미지를 서버 컨트롤과 같은 방식으로 만들고 'Visible' 속성을 조작하십시오. –

관련 문제