C# 下拉列表和RadioButton列表选择已更改事件处理
我有一个单选按钮列表和一个下拉列表,我处理了两个事件RBtypeof user_SelectedIndexChanged和DDLContrich_SelectedIndexChanged。对于这两个控件,我已将autoPostBack设置为true 但在单击单选按钮列表时,我的两个事件,即rbTypeOfUser_SelectedIndexChanged和ddlCountry_SelectedIndexChanged都会得到处理,而ddlCountry_SelectedIndexChanged不会在下拉选择更改时得到处理 有什么问题吗C# 下拉列表和RadioButton列表选择已更改事件处理,c#,asp.net,C#,Asp.net,我有一个单选按钮列表和一个下拉列表,我处理了两个事件RBtypeof user_SelectedIndexChanged和DDLContrich_SelectedIndexChanged。对于这两个控件,我已将autoPostBack设置为true 但在单击单选按钮列表时,我的两个事件,即rbTypeOfUser_SelectedIndexChanged和ddlCountry_SelectedIndexChanged都会得到处理,而ddlCountry_SelectedIndexChanged不
protected void rbTypeOfUser_SelectedIndexChanged(object sender, EventArgs e)
{
//ViewState["TypeOfUser"] = rbTypeOfUser.SelectedItem.ToString();
if (rbTypeOfUser.SelectedValue == "Free")
{
trmembership.Visible = false;
//DDLMembershipPlan.Visible = false;
}
else
{
trmembership.Visible = true;
//DDLMembershipPlan.Visible = true;
//Label8.Visible = true;
MembershipPlan();
}
}
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
{
Parameterised_SQL_Dentry pm = new Parameterised_SQL_Dentry(0, CommonStrings.ConnectionString);
//Dentry de=new Dentry();
string strState = "select vcrState,intState_id from exp_mst_state where intCountry_id='" + ddlCountry.SelectedValue + "' order by vcrState ";
//de.FillCombo(ddlState,strState,"vcrState","intState_id");
pm.FillCombo(ddlState, strState, "vcrState", "intState_id");
ddlState.DataBind();
ddlState.Enabled = true;
ddlState.Items.Insert(0, new ListItem("Select State", "0"));
}
<asp:RadioButtonList align="Center" ID="rbTypeOfUser" runat="server" RepeatDirection="Horizontal" Width="350px" AutoPostBack="True" onselectedindexchanged="rbTypeOfUser_SelectedIndexChanged" CssClass="checkbox_padd" TabIndex="1" >
<asp:ListItem Value="Free" Selected="True"><span class="mmovehead"><span class="mmovehead">Free</span></span></asp:ListItem>
<asp:ListItem Value="Paid"><span class="mmovehead"><span
class=mmovehead>Paid
你试过在ddlCountry处理程序中设置断点吗?是的,只有我知道这一点。你能发布你的aspx吗?请看一下它不工作。在里面ispostback我的代码将只执行一次。但我想在每次为ddlcountry更改选择时更改另一个下拉列表,正如您在我的代码中看到的那样。
<asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="True" ValidationGroup="Registration" Width="300px" TabIndex="3" onselectedindexchanged="ddlCountry_SelectedIndexChanged" >
</asp:DropDownList>