Zain ul Haq Zain ul Haq - 1 month ago 6x
ASP.NET (C#) Question

ASP .NET display html tags in RadioButton.Text

I am developing a quiz application in ASP.NET. I am using radio buttons to display options like this:

rbOption1.Text = reader["Option1"].ToString();

Now, for a question related to HTML, all the options have only HTML tags in database e.g:

tr td /td td rowspan=”2” /td /tr

I have removed the
signs otherwise the above example won't render here as text.

When the text for such radio buttons is rendered on webpage, then no text is displayed using

How can I force the radio buttons to display the tags as stored in database?


You could do something like this:

string TestString = "This is a <Test String>.";
string EncodedString = System.Web.HttpUtility.HtmlEncode(TestString);

More information here:

But the bigger question is why you want to use tables in the first place. It might be a lot simpler to look at a CSS implementation.