By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,408 Members | 1,796 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,408 IT Pros & Developers. It's quick & easy.

creating pop-up box when deleting from datagrid

P: n/a
Can anybody tell me what is wrong with this code? The main error I seem
to be getting is where I am creating the LinkButton called deleteButton.

public void dgLog_ItemDataBound(object sender, DataGridItemEventArgs e)
{
//First, make sure we're NOT dealing with a Header or Footer row
if (!(e.Item.ItemType == ListItemType.Header) && (!(e.Item.ItemType
== ListItemType.Footer)))
{
//Now, reference the LinkButton control that the Delete ButtonColumn
has been rendered to
LinkButton deleteButton = (LinkButton)e.Item.Cells[0].Controls[0];

//We can now add the onclick event handler
deleteButton.Attributes.Add("onClick", "javascript:return
confirm('Are you sure you want to delete DialledNum #" +
DataBinder.Eval(e.Item.DataItem,"DialledNum") + "?');");
}
}

Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.