[英]radiobuttons c# strange behaviour after submitting
我有2個單選按鈕的異常行為。
<asp:RadioButton GroupName="grp_anexo" id="rdioAnexoSi" runat="server" AutoPostBack="true" Checked="true" OnCheckedChanged="rdioAnexoSi_CheckedChanged" />SI
<asp:RadioButton GroupName="grp_anexo" id="rdioAnexoNo" runat="server" AutoPostBack="true" OnCheckedChanged="rdioAnexoNo_CheckedChanged" />NO
我檢查了“ rdioAnexoSi”,
單擊按鈕(提交)時,將自動選擇“ rdioAnexoNo”。
提交后選擇“ rdioAnexoSi”時,為什么單選按鈕更改為“ rdioAnexoNo”?
$('#formIngreso').attr('action', "proceso.aspx").submit();
protected void rdioAnexoNo_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = sender as CheckBox;
if (chk != null)
{
if (chk.Checked)
{
ddlAnexo.Items.Clear();
ddlAnexoN.Items.Clear();
div_anexo.Visible = false;
}
else
{
div_anexo.Visible = true;
}
}
}
protected void rdioCelularSi_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = sender as CheckBox;
if (chk != null)
{
if (chk.Checked)
{
ddlCelular.Items.Clear();
sap sapserver = new sap();
sapserver.arr_parametros = sapserver.LecturaArchivo(300);
sapserver.rfc_config_conex = sapserver.SapParametros(sapserver.arr_parametros);
if (sapserver.probarConexionSap(sapserver.rfc_config_conex) == true)
{
RfcDestination RfcDestino = RfcDestinationManager.GetDestination(sapserver.rfc_config_conex);
sapserver.mostrarpep_cecos(RfcDestino, ddlCelular, ddlArea.SelectedValue.ToString().Trim());
}
else
{
}
div_celular.Visible = true;
}
}
}
如果您將AutoPostBack設置為true,那么為什么需要此行
$('#formIngreso').attr('action', "proceso.aspx").submit();
你什么時候叫它?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.