Click here to Skip to main content
16,017,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to set text data member of ASP.NET control (say RadioButton) as HTML Tag?

For example,
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="f1" text="<input type="text"/>"/>
renders a HTML Text Box in browser.
How can this be avoided?
Any alternative??
Posted
Updated 2-Sep-11 6:04am
v2

Try it from server side using htmlencode. It will work.
ASP.NET
<pre lang="c#"><asp:radiobutton id="RadioButton1" runat="server" groupname="f1" xmlns:asp="#unknown" />
C#
protected void Page_Load(object sender, EventArgs e)
   {
       string button = "<input type=button value=Search name=btnSearch />";
       RadioButton1.Text = Server.HtmlEncode(button);
   }
 
Share this answer
 
Comments
RaisKazi 3-Sep-11 3:47am    
My 5.
Thanks Rupesh,
Its working fine now.... :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900