Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi frnds,

am working on asp.net Gridview using c# sqlserver 2005 database.

here am updating records, deleting records and adding records into database using gridview footer textboxes.

am using popup message after updating , deleting , adding records.

My requirement is I want to display the message.

In Gridview First Column i have field as Username.

so, i want to display a message as
"Suresh record updated successfully"

This is my code message popup.

ScriptManager.RegisterStartupScript(this, this.GetType(), "RunCode", "javascript:alert('Updated successfully');", true);

So just i want to add username in popup box.
Please help. Thanks.
Posted
Comments
AndrewCharlz 18-Mar-14 7:36am    
its working fine in mine

C#
string s=username+"Record Updated successfully";
ScriptManager.RegisterStartupScript(this, this.GetType(), "RunCode", "javascript:alert('s');", true);
 
Share this answer
 
v2
Comments
Member239258 18-Mar-14 7:44am    
sorry, not working....
error in username...what is username here...please explain.
ErBhati 18-Mar-14 7:51am    
in your Question above you told u have column username in gridview. pls find this username from gridview for perticular row and then give username (string) in this code
Member239258 18-Mar-14 7:56am    
yes sir, it has column name in my gridview. but it shows error.
The name 'username' does not exist in the current context
ErBhati 18-Mar-14 8:01am    
could you know how to find value from gridview column ?
Member239258 18-Mar-14 8:21am    
Cells[0].Text;
 
Share this answer
 
C#
And one more thing you people are missing double quote and + sign to write inside alert

string username=(gridview.row[0].Cells[0].Text).tostring();
string s=username+"Record Updated successfully";
ScriptManager.RegisterStartupScript(this, this.GetType(), "RunCode", "javascript:alert('"+s+"');", true);
 
Share this answer
 
Comments
Member239258 18-Mar-14 9:21am    
sorry sir, still it doesnot show the column name....
only it shows Record updated successfully message.
[no name] 18-Mar-14 12:34pm    
See if string username=(gridview.row[0].Cells[0].Text).tostring();
check with debug if username is in first cell or not just change there it's not one big issue. where you can do it very easily if you will try. Our solution is by guess not the exact code that's you know very well

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900