如何在使用scriptlet标签的aspx上编写if单选按钮选中属性 [英] how to write if condition for radio button checked attribute, on aspx using scriptlet tags
本文介绍了如何在使用scriptlet标签的aspx上编写if单选按钮选中属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:RadioButton ID="rdbOption2" runat="server" Text="<%= aQuestionsAndOptions.strOption2 %>"
<% if(aQuestionsAndOptions.strOption2 == aQuestionsAndOptions.strelectedOption) {%> Checked="true" <%} %>GroupName="Options" />
推荐答案
嗨Jagadeesh,>
首先请告诉您,您无法在任何控件的标签中添加此类条件。
您可以在这做的就是你可以根据满足条件生成控件,如下例所示: -
Ex: -
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 :-
<% 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 .
这篇关于如何在使用scriptlet标签的aspx上编写if单选按钮选中属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文