【发布时间】:2020-09-04 01:12:20
【问题描述】:
我的问题如下,当我第一次使用第一个更新面板的下拉列表正常运行时,它显示了隐藏的标签和文本框,一切正常。
但是,当我第一次使用dropProvince,canton或region时,他们实现了该方法
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:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label runat="server" Text="Tipo de Identificación"></asp:Label>
<asp:DropDownList ID="droplistTipoIdentificacionDatosPropietario"
runat="server"
Width="100%"
Height="30px"
AutoPostBack="true"
OnSelectedIndexChanged="droplistTipoIdentificacionDatosPropietario_SelectedIndexChanged">
<asp:ListItem Text="Cédula Identidad" Value="C"></asp:ListItem>
<asp:ListItem Text="Cédula de Residencia" Value="R"></asp:ListItem>
<asp:ListItem Text="Cédula Jurídica" Value="J"></asp:ListItem>
<asp:ListItem Text="Pasaporte" Value="P"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
调用背后的代码
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>
【问题讨论】:
标签: c# webforms updatepanel