0
我有單選按鈕在如下頁面中聲明:如何從代碼更改單選按鈕狀態背後
<asp:RadioButton ID="RadioSalesManager" runat="server" GroupName="RadioSales" />
<asp:RadioButton ID="RadioSalesUser" runat="server" GroupName="RadioSales"/>
在後面的代碼基礎上下拉的價值我想改變單選按鈕
的狀態protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
strRole = ((RadioButtonList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RadioButtonList1")).SelectedValue;
if (strRole.Contains("Administrator"))
{
((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("DrpGrpList")).SelectedValue = strRole.Trim();
((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("DrpGrpList")).Enabled = false;
((System.Web.UI.HtmlControls.HtmlTableRow)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("trAccess")).Visible = false;
}
else
{
((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("DrpGrpList")).Enabled = true;
((System.Web.UI.HtmlControls.HtmlTableRow)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("trAccess")).Visible = true;
strGroupName = ((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("DrpGrpList")).SelectedValue;
if (strGroupName.Contains("Sales") && (strRole.Contains("Manager")))
((System.Web.UI.WebControls.RadioButton)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RadioSalesManager")).Checked = true;
else
if (strGroupName.Contains("Sales") && (strRole.Contains("User")))
((System.Web.UI.WebControls.RadioButton)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RadioSalesUser")).Checked = true;
}
}
單選按鈕狀態不會隨代碼背後的上述代碼而改變。請幫我解決這個問題。
感謝 APPU
你打的方法中的斷點數據? – jiiri 2013-03-18 14:00:45