Last post Jan 23, 2010 01:37 PM by marcelocbacchi
Jan 23, 2010 11:19 AM|marcelocbacchi|LINK
I have a form in my aspx application.
When the user clicks on the button if the data that was inserted is correct, a popup windows will appear saying that the data was succeful sent, if the data was not sent, I want a pop up window appears saying that the data could not be sent. How do I create
this behaviour in code behind page and C#.
Thank you all
Jan 23, 2010 11:38 AM|suresh.o|LINK
alert('Data send successfully.')
If you want model popup, try below links,
Jan 23, 2010 11:42 AM|Careed|LINK
How are you determining a successful send of data?
Jan 23, 2010 11:45 AM|dude_123|LINK
Jan 23, 2010 11:47 AM|niksv|LINK
Why do need pop up window. I think u want alert box here. (Showing popup window is also possible in same way but that wont make sense)
In the function (code behind) where u check whether data is valid or not etc. do this,
(ur function continued......)
string result = "";
if (data is valid and inserted) result = "Data was successfully inserted"
else result = "Data was not inserted"
Jan 23, 2010 11:54 AM|marcelocbacchi|LINK
Sorry. What I meant is was alert box.
Jan 23, 2010 12:21 PM|ramiramilu|LINK
then you got to use confirm box....
protected void btnSubmit_Click(object sender, EventArgs e)
if (check for some condition)
ClientScript.RegisterStartupScript(this.GetType(), "Confirm","confirm('Are you sure');"", true);
//Method call to insert comment into database and finally popup alert box
ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('data saved to database successfully....');", true);
ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('condition failed plz retry....');", true);
catch (Exception ex)
ClientScript.RegisterStartupScript(this.GetType(),"Alert","alert('Look at the stack trace');",true);
So to procedd further we asked for the confirm...and once user presses the ok button then we take him forward.....and in case the condition failed initially then we display a message to him that condition failed plz retry....
for button -
<asp:Button ID="Button9" runat="server" Text="Button" OnClientClick="ask()" onclick="Button9_Click" />
confirm('are you sure?');
In codebehind -
protected void Button9_Click(object sender, EventArgs e)
// insert data to database here...
Hope this helps you...
Jan 23, 2010 01:37 PM|marcelocbacchi|LINK
You solved my issue.It was exacly what I needed. Than you very much indeed. Thank for your time and attention.