asp.net radiobutton 获取值
题目如下:机构标志0有门户1无门户下面是两个radiobutton<asp:RadioButtonID="RadioButton1"runat="server"Text=...
题目如下:
机构标志
0 有门户
1 无门户
下面是两个 radiobutton
<asp:RadioButton ID="RadioButton1" runat="server" Text="用门户"
GroupName="OrganizationFlag" />
<asp:RadioButton ID="RadioButton2" runat="server" Text="无门户"
GroupName="OrganizationFlag" />
怎样定义一个变量用于获取选中的值,当选中“用门户”的radiobutton时为变量赋值0,当选中“无门户”的radiobutton时为变量赋值1?
请高手赐教!!! 展开
机构标志
0 有门户
1 无门户
下面是两个 radiobutton
<asp:RadioButton ID="RadioButton1" runat="server" Text="用门户"
GroupName="OrganizationFlag" />
<asp:RadioButton ID="RadioButton2" runat="server" Text="无门户"
GroupName="OrganizationFlag" />
怎样定义一个变量用于获取选中的值,当选中“用门户”的radiobutton时为变量赋值0,当选中“无门户”的radiobutton时为变量赋值1?
请高手赐教!!! 展开
展开全部
Protected void Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
{
RadioButton1.AutoPostBack = True; //让RadioButton响应服务端事件.
RadioButton2.AutoPostBack = True;
}
Protected void RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
{
变量 = 0;
}
Protected void RadioButton2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
{
变量 = 1;
}
{
RadioButton1.AutoPostBack = True; //让RadioButton响应服务端事件.
RadioButton2.AutoPostBack = True;
}
Protected void RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
{
变量 = 0;
}
Protected void RadioButton2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
{
变量 = 1;
}
展开全部
asp.net 单选请用
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="0">用门户</asp:ListItem>
<asp:ListItem Value="1">无门户</asp:ListItem>
</asp:RadioButtonList>
this.RadioButtonList1.SelectedItem.Text =="用门户";
int i =0;
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="0">用门户</asp:ListItem>
<asp:ListItem Value="1">无门户</asp:ListItem>
</asp:RadioButtonList>
this.RadioButtonList1.SelectedItem.Text =="用门户";
int i =0;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
建议用RadioButtonList控件,然后,在Item中添加项(包括键值对 Text,Value)
然后获取值,直接用RadioButtonList.SelectedValue
然后获取值,直接用RadioButtonList.SelectedValue
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询