c# - How to show a HTML ASP Code on a label sending from Code-Behind -


i'm having problem, want send asp html code label method on code-behind, make label shows dynamically html code on screen. when send works when code isn't <asp:> html.

public void fillpage(int size) {     stringbuilder sb = new stringbuilder();      sb.append(string.format(@"<asp:linkbutton id='linkbutton1' runat='server' onclick='linkbutton1_click'><asp:table id='tableprod' class='tableproduto' runat='server'>    <asp:tablerow>        <asp:tablecell rowspan='2' width='155px'><img src='images/categorias/bebida.png' /></asp:tablecell>                     <asp:tablecell width='550px'>nome</asp:tablecell>        <asp:tablecell rowspan='2'>preço</asp:tablecell>    </asp:tablerow>      <asp:tablerow>               <asp:tablecell width='550px'><div class='divtexto'><p>descrição</p></div></asp:tablecell>                  </asp:tablerow>           </asp:table> </asp:linkbutton> "));      lbltexto.text = sb.tostring();                       } } 

it doesn't works. when following code works:

public void fillpage(int size) {     stringbuilder sb = new stringbuilder();      sb.append(string.format(@"<asp:linkbutton id='linkbutton1' runat='server' onclick='linkbutton1_click'><table id='tableprod' class='tableproduto' runat='server'>    <tr>        <td rowspan='2' width='155px'><img src='images/categorias/bebida.png' /></td>                     <td width='550px'>nome</td>        <td rowspan='2'>preço</td>    </tr>      <tr>               <asp:tablecell width='550px'><div class='divtexto'><p>descrição</p></div></td>                  </tr>           </table> </asp:linkbutton> "));      lbltexto.text = sb.tostring();                       } } 

but need controls of linkbutton, isn't working.

you can't that.

"asp codes" can interpreted on server. putting them in label, you're requiring browser understand them - won't.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -