PDA

View Full Version : to display a message on an aspx page


akshatha306
06-02-2006, 02:59 PM
hi All,
i have a query..
In an aspx page when i click on a button (suppose a delete button) i want to display a message asking do u want to delete. if yes i want to call the delete procedure or else get back to that page..
i can do it using confirm java script.. but how do i pass the ok or cancel value back to dot net so that i can call the delete function which is in the aspx.cs file..
i tried calling the method in the cs file (which will delete a particular row) from java script .. it does not work.. how can i do this..

vinyl-junkie
06-02-2006, 03:18 PM
I found a great article a while back (here (http://aspnet.4guysfromrolla.com/articles/021104-1.aspx)) which shows you how to this strictly in .NET. It's pretty slick. :thumbsup:

handshakeit
06-03-2006, 08:17 AM
just use this code
Button1.onClientClick=window.confirm("Are You Sure?");
or in aspx file add this attribute in buttons tag
onClientClick="window.confirm('Are You Sure?');"

senthilavs
06-05-2006, 01:41 PM
Hi,

View this link u get idea about server side message box in ASP.NET
http://www.dnzone.com/showDetail.asp?TypeId=2&NewsId=813

Regards,
Senthil V.

akshatha306
06-12-2006, 01:49 PM
Hi There is small change in the requirement...
The problem is: When i click on the deleteRow button it should check if the row is selected. or else alert the user saying "please select a row" and get back to the page without any operations...
If however a row is selected then ask for the confirmation. if OK then go ahead and delete the button.
I cant do this in the pageload cos it takes the previous value for row selected.
Right Now what i am doing is: in the button click event i have written the following code snippet:

int select=dgClaimInfo.DisplayLayout.SelectedRows.Count;

if(select==0)

{

Response.Write("<script>alert('hi');</script>");

}

else

{

Response.Write("<script>if(confirm('Are You SURE')){} else { return false; }</script>");



dgClaimInfo.DisplayLayout.ActiveRow.Delete();

}
The alert part is ok. but on confirm whether it is ok or cancel it is deleting the row in the grid. i dont want it to delete when cancel is clicked.

how can i do it.is there any other way of doing it without using Response.write
Please let me know