我的页面中有5个单选按钮和一个链接。每次点击链接按钮时,我都希望将我的单选按钮更改为其他按钮。我的意思是,当点击链接时,radiobutton检查必须从rd1移动到rd2。这可能。
以下是我的链接按钮和无线电按钮的代码。
protected void lnkAddLoc_Click(object sender, EventArgs e)
{
}
<asp:RadioButton ID="rdoLoc1" runat="server" Text="None" TextAlign="left" GroupName="rdoLocation" Checked="true" Width="68px" OnCheckedChanged="rdoLoc1_CheckedChanged" Visible = "true"/>
<asp:RadioButton ID="rdoLoc2" runat="server" Text="1" TextAlign="Left" GroupName="rdoLocation" OnCheckedChanged="rdoLoc2_CheckedChanged" Width="68px" Visible = "true" />
<asp:RadioButton ID="rdoLoc3" runat="server" Text="2" TextAlign="Left" GroupName="rdoLocation" Width="68px" Visible = "true" />
<asp:RadioButton ID="rdoLoc4" runat="server" Text="3" TextAlign="Left" GroupName="rdoLocation" Width="66px" Visible = "true"/>
<asp:RadioButton ID="rdoLoc5" runat="server" Text="4" TextAlign="Left" GroupName="rdoLocation" Width="62px" Visible = "true"/>
答案 0 :(得分:0)
protected void lnkAddLoc_Click(object sender, EventArgs e)
{
if (rdoLoc1.Checked)
rdoLoc5.Checked = true;
else if (rdoLoc2.Checked)
rdoLoc1.Checked = true;
else if (rdoLoc3.Checked)
rdoLoc2.Checked = true;
else if (rdoLoc4.Checked)
rdoLoc3.Checked = true;
else if (rdoLoc5.Checked)
rdoLoc4.Checked = true;
}
答案 1 :(得分:0)
我认真考虑在javascript中执行此客户端...每次单击链接以点击单选按钮时回发?您的用户将非常恼火。