0

这是HTML代码

<div id="form3">


    <asp:Label ID="Label1" runat="server" Text="Enter your E-mail Id:"></asp:Label>
    <asp:TextBox ID="usremailtxt" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button1" onclick="Button1_Click1" style="height: 26px"/>
     <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
              <asp:Panel ID="pnlpopup" runat="server" BackColor="Red" Height="80px" Width="300px" Style="display: none" >  
                <table width="100%" style="border:Solid 3px #D55500; width:100%; height:100%" cellpadding="0" cellspacing="0">
                   <tr>
                    <td align="center" 
                      style=" height:0%; color:White; font-weight:bold; font-size:larger">
                       Your Password Is:<asp:Label ID="pouplbl" runat="server" Text=""></asp:Label>
                   </td>
                  </tr>
                </table>
              </asp:Panel>
            </ContentTemplate>
           </asp:UpdatePanel>
           <cc2:ModalPopupExtender ID="ModalPopupExtender2" runat="server" 
               targetcontrolid="Button1" 
               popupcontrolid="pnlpopup" 
               dropshadow="true" 
               OkControlID="btnclose" >
            </cc2:ModalPopupExtender>


</div>
</form>

这是 C# 代码

protected void Button1_Click1(object sender, EventArgs e)
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ConnectionString);
    con.Open();
    SqlCommand cmd = new SqlCommand("select password from User_detail where email_id = @email_id", con);
    cmd.Parameters.AddWithValue("@email_id", usremailtxt.Text);
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    da.Fill(ds);
    pouplbl.Text = ds.Tables[0].Rows[0]["password"].ToString();
    this.ModalPopupExtender2.Show();
    con.Close();
}

问题是没有出现。

4

1 回答 1

0

您应该复制更新面板下的 modalpopupextender 代码。并且 scriptmanager 应该是第一个元素,把它放在 body 标签下。

<

div id="form3">


    <asp:Label ID="Label1" runat="server" Text="Enter your E-mail Id:"></asp:Label>
    <asp:TextBox ID="usremailtxt" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button1" onclick="Button1_Click1" style="height: 26px"/>
     <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
              <asp:Panel ID="pnlpopup" runat="server" BackColor="Red" Height="80px" Width="300px" Style="display: none" >  
                <table width="100%" style="border:Solid 3px #D55500; width:100%; height:100%" cellpadding="0" cellspacing="0">
                   <tr>
                    <td align="center" 
                      style=" height:0%; color:White; font-weight:bold; font-size:larger">
                       Your Password Is:<asp:Label ID="pouplbl" runat="server" Text=""></asp:Label>
                   </td>
                  </tr>
                </table>
              </asp:Panel>

           <cc2:ModalPopupExtender ID="ModalPopupExtender2" runat="server" 
               targetcontrolid="Button1" 
               popupcontrolid="pnlpopup" 
               dropshadow="true" 
               OkControlID="btnclose" >
            </cc2:ModalPopupExtender>

            </ContentTemplate>
           </asp:UpdatePanel>

</div>
</form>
于 2013-10-19T18:15:31.577 回答