开发者

RadioButton value to be changed everytime a linkbutton is clicked

I have 5 radio buttons and a link in my page. Everytime when the linkbutton is clicked, i want my radiobutton to be changed to other. I mean, when a link is clicked, radiobutton check has to move onto rd2 from rd1. Is that possible.

Below is my piece of code for link button and radiobutons.

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"/>


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;
}


I'd seriously consider doing this client-side in javascript... a postback everytime you click a link to bump the radio button down? Your users will be extremely annoyed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜