selva kumar

selva kumar

  • NA
  • 557
  • 183.8k

button does n't fired after model popup closed?

Oct 3 2013 4:42 AM
i have contact form when user fill and submit the contact details,it will save on database and model popup shows "your query has been submitted" with close button..after close the model popup and trying to submit another contact details,,button does n't fired only model popup showed...can any one solve my problem..here is my code..

<asp:ScriptManager id="ScriptManager1" runat="server">
                          </asp:ScriptManager>
                          <ajaxToolkit:ModalPopupExtender ID="popupextender1" PopupControlID="panel1" TargetControlID="btnSubmit" CancelControlID="btnclose" BackgroundCssClass="modalBackground" Enabled="false" Drag="true" runat="server" >
                          </ajaxToolkit:ModalPopupExtender>
                          <asp:Panel ID="panel1" runat="server" CssClass="modalPopup" align="center" style = "display:none">
                          Your query has been submitted sucessfully.<br />
                          <asp:Button ID="btnclose" CssClass="general_button blue" runat="server" Text="Close"/>
                          </asp:Panel>

c# code:

public partial class _Default : System.Web.UI.Page
{
    SqlConnection Con;
    SqlCommand Cmd;
    protected void Page_Load(object sender, EventArgs e)
    {
        Con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=SS;Integrated Security=True");
        Label1.Text = DateTime.Now.ToString();
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
      
        try
         {
             Con.Open();
            Cmd = new SqlCommand("Insert Into contactform Values('" + txtname.Text + "','" + txtmail.Text + "','" + txtsubject.Text + "','" + txtmessage.Text + "','"+Label1.Text+"')", Con);
            Cmd.ExecuteNonQuery();
        }
        catch (Exception EX)
        {
            Response.Write("" + EX.ToString());
        }
        finally
        {
            Con.Close();
            Clear();
            popupextender1.Enabled = true;
            popupextender1.Show();
        }
    }
    public void Clear()
    {
        txtname.Text = "";
        txtmail.Text = "";
        txtsubject.Text = "";
        txtmessage.Text = "";
    }
}

Answers (1)