jleone
09-19-2007, 04:16 PM
OK, here's my situation. A user adds a name to a request by either searching for an existing name, selecting a name previously used (from a Gridview), or by creating all new info for a new name to be added.
If a user creates all new info for a new name (thus linking the new name to the request) and then decides to switch to an existing name by selecting from the Gridview, I want to display a Javascript confirm box. I do this right now for the "New" button in case they want to add another new name in place of the new name they already created for the request by doing the following code:
If Rqst.TempName IsNot Nothing Then
btnNew.Attributes.Add("onclick", "return confirm('This will permanently delete the new name information you have already entered for this request. Are you sure?');")
End If
How do I accomplish the same thing when something is selected from the Gridview on a selected index changed? The first parameter in the attributes.add is the key string and I have tried using "OnSelectedIndexChanged" and "OnSelectedIndexChanging" like the following:
GridView1.Attributes.Add("OnSelectedIndexChanged", "return confirm('This will permanently delete the new name information you have already entered for this request. Are you sure?');")
but even when I click cancel on the dialog box, the rest of my server code still executes, unlike the behavior when I click the "New" button which prevents the server code from executing.
Thanks for any help that can be offered.
If a user creates all new info for a new name (thus linking the new name to the request) and then decides to switch to an existing name by selecting from the Gridview, I want to display a Javascript confirm box. I do this right now for the "New" button in case they want to add another new name in place of the new name they already created for the request by doing the following code:
If Rqst.TempName IsNot Nothing Then
btnNew.Attributes.Add("onclick", "return confirm('This will permanently delete the new name information you have already entered for this request. Are you sure?');")
End If
How do I accomplish the same thing when something is selected from the Gridview on a selected index changed? The first parameter in the attributes.add is the key string and I have tried using "OnSelectedIndexChanged" and "OnSelectedIndexChanging" like the following:
GridView1.Attributes.Add("OnSelectedIndexChanged", "return confirm('This will permanently delete the new name information you have already entered for this request. Are you sure?');")
but even when I click cancel on the dialog box, the rest of my server code still executes, unlike the behavior when I click the "New" button which prevents the server code from executing.
Thanks for any help that can be offered.