PDA

View Full Version : سوال: می خواهم با انتخاب radiobutton1 ، radiutton2 از حالت انتخاب خارج شود و بالعکس؟



پیام حیاتی
یک شنبه 03 آبان 1394, 14:45 عصر
سلام
در رویدادها این کدها رو نوشتم جواب نداد ، کاربر می تواند هر دو radio را انتخاب کند.


protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
RadioButton2.Checked = false;
}
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
RadioButton1.Checked = false;
}

(نمی خواهم از radiobuttonlist استفاده کنم.)
تشکر.

پیام حیاتی
یک شنبه 03 آبان 1394, 16:02 عصر
پیدا کردم ، باید در یک گروه قرارشون بدم :


<asp:RadioButton runat="server" ID="MaleRadioButton"
Text=" Male" GroupName="gender"/>
<asp:RadioButton runat="server" ID="FemaleRadioButton"
Text=" Female" GroupName="gender"/>


http://stackoverflow.com/questions/24874394/how-to-uncheck-a-radio-button-when-another-is-checked-with-autopostback-false-in