VBAHole22 Posted January 27, 2006 Posted January 27, 2006 Is there a way to add a confirmation pop-up (maybe js) on an editable datagrid? I have a datagrid that allows users to edit a field. When they click the save button in the editbuttoncolumn I would like a confirmation message to pop up so that they can reverse course if they wish. But I can't get a handle on that save button because it isn't generated in the beginning to add script to it. Is this possible? Quote Wanna-Be C# Superstar
bri189a Posted January 28, 2006 Posted January 28, 2006 You should be able to hook onto it from the OnItemDataBound...get the controls from that cell and check the text for 'Save' then add from there: If e.Item.ItemType = ListItemType.EditItem Then For Each c As Control in e.Item.Cells(0).Controls If c.GetType() = GetType(LinkButton) AndAlso _ DirectCast(c, LinkButton).Text = "Save" Then DirectCast(c, LinkButton).Attributes.Add("onclick", "myJavaScriptFunctionName") End If Next End If If that's what you've done and .NET still hasn't rendered those link buttons yet try doing it in pre-render and going through the datagrid items collection. If remember right though what I gave you above should be close to working. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.