Assign confirm when doing GetPostBackClientHyperLink on a gridview

T

tiptechno

hello,

i was wondering how to attach a js confirm to the following command

e.Row.Cells[3].Attributes["onclick"] =
Page.ClientScript.GetPostBackClientHyperlink(this.gvGrid, "MyCommand$" +
"value123");

.... I have this in the RowDataBound of the GridView, it works fine, just
want to attach a js confirmation to it so it can be cancelled before posting
back.

thanks...
 
B

bruce barker

try:

e.Row.Cells[3].Attributes["onclick"] = "if (!confirm('do it?')) return
false;" +
Page.ClientScript.GetPostBackClientHyperlink(this.gvGrid, "MyCommand$"
+
"value123");



-- bruce (sqlwork.com)
 
T

tiptechno

Yes, that works. Thank you very much bruce :)



bruce barker said:
try:

e.Row.Cells[3].Attributes["onclick"] = "if (!confirm('do it?')) return
false;" +
Page.ClientScript.GetPostBackClientHyperlink(this.gvGrid, "MyCommand$"
+
"value123");



-- bruce (sqlwork.com)


tiptechno said:
hello,

i was wondering how to attach a js confirm to the following command

e.Row.Cells[3].Attributes["onclick"] =
Page.ClientScript.GetPostBackClientHyperlink(this.gvGrid, "MyCommand$" +
"value123");

... I have this in the RowDataBound of the GridView, it works fine, just
want to attach a js confirmation to it so it can be cancelled before posting
back.

thanks...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,179
Messages
2,570,956
Members
47,509
Latest member
Jack116

Latest Threads

Top