Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:10:19+00:00 2026-05-31T06:10:19+00:00

Issue is resolved now… I have a simple web form where i need to

  • 0

Issue is resolved now…

I have a simple web form where i need to save the email address and give user success or failure message accordingly in the Modal window and i want to do the validation and process from code behind and then show the Modal window.

Right now when i click on the subscribe button it quickly shows the modal window without executing the codebehind / server side code. Please find sample code below

    <asp:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="modalBackground" runat="server" PopupControlID="pnlMSG" CancelControlID="btnSubscribe"
     TargetControlID="HiddenField1">
    </asp:ModalPopupExtender>

Continue to Browse

                <asp:Label ID="lblSubscriptionText" CssClass="lblfooterSubscribe" 
                    runat="server" Text="Enter your email to subscribe to our Newsletter" 
                    meta:resourcekey="lblSubscriptionTextResource1"></asp:Label>
                <asp:TextBox ID="txtSubscribeEmail" runat="server" CssClass="txtSubEmail" 
                    meta:resourcekey="txtSubscribeEmailResource1"></asp:TextBox>
                <asp:Button ID="btnSubscribe" runat="server" Text="Subscribe" 
                    CssClass="SubEmailBtn" ValidationGroup="SubEmail" 
                    onclick="btnSubscribe_Click" meta:resourcekey="btnSubscribeResource1" />

        <asp:HiddenField ID="HiddenField1" runat="server" />  

protected void btnSubscribe_Click(object sender, EventArgs e)
{
    //Regex reg = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
    string email = txtSubscribeEmail.Text;
    email = Helper.SafeSqlLiteral(email, 2);
    string strSql = "INSERT INTO Subscribe (email, subscribeDate,Language)";
    strSql += "VALUES ('" + email + "','" + DateTime.Now.ToString("yyyy/MM/dd") + "','" + Session["lang"].ToString() + "')";
    int result = 0;
    result = DataProvider.intConnect_Select(strSql);
    lblSubEmailMSG.Visible = true;
    btnSubscribe.Enabled = false;
    //Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
    // System.Threading.Thread.Sleep(2000);
    this.ModalPopupExtender1.Show();
}

I tried to remove the TargetControlID=”btnSubscribe” property from the modalPopupExtender but it generates error saying TargetControlID cant be null or empty even removing the TargetControlID generates error.

If i use hidden field as TargetControl id then it executes the codebehin but it does the full post back and doesn’t show the modalwindow

Please suggest how can i hand this functionality..

What did i do? I resolved the issue by specifying TargeControl as Hidden Field and i was also using response.redirect which by mistake i had left uncommented. It works fine now

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:10:21+00:00Added an answer on May 31, 2026 at 6:10 am

    ISSUE RESOLVED

    What did i do? I resolved the issue by specifying TargeControl as Hidden Field and i was also using response.redirect which by mistake i had left uncommented. It works fine now

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just recently run into an issue running an asp.net web app under
Like every other web developer on the planet, I have an issue with users
now that I've resolved my previous issue with clickatell: Impementing Clickatell CallBack in ASP.NET
I have a simple subscribe form at : http://thepanamainsider.com/sanblas/index9.php The form doesn't work, it
I have a simple app, which pulls certain images off the web and displays
I resolved this issue myself. It turns out that the activation framework requires some
I recently resolved an issue my VB6 application had when saving large binary objects
Ok so I've spent a couple hours trying to resolve this issue and have
I have an issue that means I cannot check in changes even if I
I have this critical issue with showing top statusbar on the custom camera overlay

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.