| | |
alert/message box
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2007
Posts: 24
Reputation:
Solved Threads: 0
Im using VS 2005 for web application.Im using message boxes but they are not working.i dont know what's the problem with my code.
my data is saved successfully but im not getting the alert.same is the case with cancel/exit button.Please help me.
ASP.NET Syntax (Toggle Plain Text)
if (drff.Read()) { Button_Assign.Attributes.Add("onclick", "javscript:alert('Data saved successfully.')"); } /*else { //Button_Assign.Attributes.Add("onclick", "javscript:alert('Data not saved.')"); }
my data is saved successfully but im not getting the alert.same is the case with cancel/exit button.Please help me.
what you have will not work because you are adding the onclick event after the button was already clicked. so after the page postsback you should get that alert when you press the button using your code.
use this.
this adds the alert to the page load, which is the place you want to add it.
use this.
ASP.NET Syntax (Toggle Plain Text)
if (drff.Read()) { ClientScript.RegisterStartupScript(typeof(string), "success", "alert('Data saved successfully.');", true); } else { ClientScript.RegisterStartupScript(typeof(string), "fail", "alert('Data not saved.');", true); }
this adds the alert to the page load, which is the place you want to add it.
![]() |
Similar Threads
- Send a text message to your phone from your site! (ColdFusion)
- Custom Message Box (Visual Basic 4 / 5 / 6)
- message box (ASP.NET)
- What is the equivalent code of MessageBox in ASP.Net? (ASP.NET)
- alert message (ASP.NET)
- sample message box. (ASP.NET)
- Messagebox (ASP.NET)
- message box (ASP.NET)
- Time Release Message Box (C)
Other Threads in the ASP.NET Forum
| Thread Tools | Search this Thread |
.net 3.5 ajax alltypeofvideos appliances application asp asp.net bc30451 beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview gridview gudi iis javascript list listbox login microsoft mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols parent problem radio redirect registration relationaldatabases reportemail schoolproject search security select sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net videos vista visualstudio vs2008 web webapplications webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers






