Click here to Skip to main content
15,901,373 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
XML
<asp:RadioButton  ID="rdbOption2" runat="server" Text="<%= aQuestionsAndOptions.strOption2 %>"
                                <% if(aQuestionsAndOptions.strOption2  == aQuestionsAndOptions.strelectedOption) {%> Checked="true" <%} %>GroupName="Options" />
Posted
Comments
What is the issue here? Why don't you do the same thing from cod behind?

1 solution

Hi Jagadeesh,

First of all let you know that you can not add this kind of conditions within a tag of any control.
What you can do here is you can generate controls as per the satisfaction of the condition as mentioned in below example :-

Ex :-

XML
<% if (!IsToView)
           { %>
            <asp:RadioButton  ID="RadioButton1" runat="server" GroupName="Options" Text='test' />
        <% } %>
        <% else { %>
            <asp:RadioButton  ID="RadioButton2" runat="server" GroupName="Options" Text='test' Checked="true" />
        <% } %>


This just an example to help you out.
Hope this will be surely helpful to you .
 
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