如何防止一个更新面板影响另一个c#asp
我的问题是,当我第一次使用第一个updatepanel的droplist正常工作时,它会显示隐藏的标签和文本框,一切正常 但是,当我首先使用省、州或区时,他们会实施该方法如何防止一个更新面板影响另一个c#asp,c#,webforms,updatepanel,C#,Webforms,Updatepanel,我的问题是,当我第一次使用第一个updatepanel的droplist正常工作时,它会显示隐藏的标签和文本框,一切正常 但是,当我首先使用省、州或区时,他们会实施该方法 protected void droplistTipoIdentificacionDatosPropietario_SelectedIndexChanged (object sender, EventArgs and ) { MessageBox.Show ("hello"); this.
protected void
droplistTipoIdentificacionDatosPropietario_SelectedIndexChanged (object sender, EventArgs and )
{
MessageBox.Show ("hello");
this.datosPropietarioLblNumIdentificacion.Visible = true;
this.datosPropietariotxtNumIdentificacion.Visible = true;
}
每一滴都有自己的方法
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.datosPropietarioLblNumIdentificacion.Visible = false;
this.datosPropietariotxtNumIdentificacion.Visible = false;
}
}
您可能存在复制/粘贴问题;有时复制/粘贴不会执行代码。尝试从每个下拉列表中删除代码隐藏方法并重新添加它们
<asp:DropDownList ID="droplistProvincia"
AutoPostBack="true" onchange="testProvincia"
OnSelectedIndexChanged="droplistProvincia_SelectedIndexChanged" <- delete this
Width="100%" runat="server" Height="30px">
<asp:ListItem Text="Seleccione"></asp:ListItem>
</asp:DropDownList>
protected void droplistTipoIdentificacionDatosPropietario_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show("hola");
this.datosPropietarioLblNumIdentificacion.Visible = true;
this.datosPropietariotxtNumIdentificacion.Visible = true;
}
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="grid3">
<asp:Label runat="server" Text="Provincia"></asp:Label>
<asp:DropDownList ID="droplistProvincia"
AutoPostBack="true" onchange="testProvincia"
OnSelectedIndexChanged="droplistProvincia_SelectedIndexChanged"
Width="100%" runat="server" Height="30px">
<asp:ListItem Text="Seleccione"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" Text="Cantón"></asp:Label>
<asp:DropDownList ID="droplistCanton" CssClass="item15"
AutoPostBack="true"
OnSelectedIndexChanged="droplistCanton_SelectedIndexChanged"
Width="100%" runat="server" Height="30px">
<asp:ListItem Text="Seleccione"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" CssClass="item16" Text="Distrito"></asp:Label>
<asp:DropDownList ID="droplistDistrito"
AutoPostBack="true"
OnSelectedIndexChanged="droplistDistrito_SelectedIndexChanged"
CssClass="item17" runat="server" Height="30px">
<asp:ListItem Text="Seleccione"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:DropDownList ID="droplistProvincia"
AutoPostBack="true" onchange="testProvincia"
OnSelectedIndexChanged="droplistProvincia_SelectedIndexChanged" <- delete this
Width="100%" runat="server" Height="30px">
<asp:ListItem Text="Seleccione"></asp:ListItem>
</asp:DropDownList>