Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
This should be simple, but I don't see it
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01307914
Message ID:
01307950
Views:
10
Naomi,

I think the line of code should be:
btnDelete.Attributes.Add("onClick","return confirm('Do you want to delete "+e.Row.DataItem.ToString() + "?' );");
Not tested however.

Kurt

>Hi everybody,
>
>Here is a code:
>
>protected void grdDeleteUsers_RowDataBound(object sender, GridViewRowEventArgs e)
>    {
>        if (e.Row.DataItem != null)
>        {
>            ImageButton btnDelete = (ImageButton) e.Row.Cells[0].Controls[0];
>
>            //((ImageButton)item.Cells[0].Controls[0]).Attributes.Add("onClick", "return confirm('Are you sure you want to delete this ?')");
>
>            //LinkButton link = e.Row.FindControl("lnkbtnRemoveRole") as LinkButton;
>
>            if (btnDelete != null)
>            {
>
>               e.Row.ToolTip = "Delete " +  e.Row.DataItem.ToString()  ;
>
>                //btnDelete.Attributes["onclick"] =
>                //    "return confirm('Do you want to delete " +
>                //    e.Row.DataItem.ToString() + "?' );";
>               // btnDelete.CommandArgument = "RemUser";
>            }
>         }
>     }
>
>If I uncomment btnDelete part I get JavaScript confirm dialog, but regardless on the answer in doesn't delete.
>
>Without the dialog it deletes great.
>
>Do you see what's wrong here?
>
>Thanks in advance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform