当我们使用UpdatePanel时,页面刷新时回发.how可以使用没有updatepanel的复选框,并使用Ajax回发而不刷新页面吗?
<asp:CheckBox ID="chkSW" Text="" runat="server" OnCheckedChanged="lbnHPSettingMenu_Click" />
复选框的<#c#代码为:
protected void lbnHPSettingMenu_Click(object sender, EventArgs e)
{
ddlSettingLang.DataBind();
ddlSettingLang.SelectedValue = ListBHPS[0].LangID.ToString();
ddlSettingPageTheme.DataBind();
ddlSettingPageTheme.SelectedValue = ListBHPS[0].ThemeID.ToString();
txtSettingTitle.Text = ListBHPS[0].Title;
txtSettingDiscription.Text = ListBHPS[0].Discription;
}
如何执行代码lbnHPSettingMenu_Click而无需使用ajax回发?
答案 0 :(得分:-1)
将您的checkbox
插入Update Panel
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:CheckBox ID="chkSW" Text="" runat="server" AutoPostBack="true" OnCheckedChanged="lbnHPSettingMenu_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="chkSW" />
</Triggers>
</asp:UpdatePanel>