Link to home
Start Free TrialLog in
Avatar of asudhaa
asudhaa

asked on

Popup window in same page and not in am empty page

Hi,
        I am new to ASP.NET and C #.I am creating a web page with dynamically created textboxes.I submit these textbox values into the database.Before I click the Submit button I would like to check whether all the all the textbox values are entered and if any of the textbox is empty I would like to show a popup window stating that "Kindly enter all the values"
        This function works for me.But this popup window does not appear in the same page and it pops up in an empty background page and once I click OK i come back to my original page.
        I would like to have the pop up  window in my original page where I click the Submit Button and not an empty page.
        Can anyone help me to achieve this.

I used the code below
  if (tb.Text == String.Empty)
                    {                  
                      Response.Write("<script language='javascript'>alert('Kindly enter all the values')</script>");
                       return ;
                    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jkofte
jkofte
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of asudhaa
asudhaa

ASKER

Thank for your answer.As you said the problem was due to response.write and with below code it works well

   string strScript = "<script language='JavaScript'>alert('Kindly enter all the values')</script>";
                        Page.RegisterStartupScript("PopUp", strScript);