Monday, 15 February 2010

c# - Setting the value of a button with a literal -



c# - Setting the value of a button with a literal -

on page, there's html button , want set value in c# using literal; this:

<input type="button" value="<asp:literal runat="server" id="dico" />" />

this doesn't work because quotes clash in aspx markup.

how can set value of button literal?

note: now, have literal writes entire html markup of button, this:

dico.text = "<input type=\"button\" value=\"" + somevalue + "\" />";

this works because literal creates button , sets value @ same time. want utilize literal value of button.

you need utilize single quotes value

<input type="button" value='<asp:literal runat="server" id="dico" />' />

if still want utilize value in double quotes must utilize runat , id of literal in single quotes

<input type="button" value="<asp:literal runat='server' id='dico' />" />

c# asp.net

No comments:

Post a Comment