Asp.Net中的单选按钮问题

时间:2010-08-18 12:10:23

标签: asp.net

我有一些相同groupName的单选按钮对。如果我将一个单选按钮设置为checked = True,则结果不显示视图。我在aspx.cs中编写代码,但视图未更新。对于其他控件,它会更新。

chatSettingsNode = xDoc.SelectSingleNode("//ToolBarChatSettings/ChatSettings/AdminSettings/Emoticons");
valueChk = chatSettingsNode.InnerXml; 
value = Convert.ToBoolean(valueChk);
if (value == true)
{
    rbtnAdminEmoticonsYes.Checked = true;
}
else
{
    rbtnAdminEmoticonsNo.Checked = false;
}
chatAdminSettingsNode = xDoc.SelectSingleNode("//ToolBarChatSettings/ChatSettings/AdminSettings/AllowGroupChats");
//If the value Equals true or false Assigned to radiobox
valueChk = chatAdminSettingsNode.InnerXml;
value = Convert.ToBoolean(valueChk);                                            
if (value == true)
{
    rbtnAllowGroupChatsYes.Checked = true;
}
else
{
    rbtnAllowGroupChatsNo.Checked = false;
}

ASPX

                                                                                                                                                                      “/>                                                                                                                                                                “GroupName =”rbtngrpEmoticons“/>                                             “GroupName =”rbtngrpEmoticons“/>                                                                                                                           

2 个答案:

答案 0 :(得分:0)

尝试

AutoPostBack="true"

用于radiobutton。

答案 1 :(得分:0)

在radiobutton或init代码的标记中,您需要设置

AutoPostBack = "true"

但是你还需要刷新单选按钮所在的任何容器。

upPanel.Update();