|
-
Nov 22nd, 2002, 02:06 PM
#1
Thread Starter
Frenzied Member
javascript confirm message
BtnAddRec.Attributes.Add("onclick", "javascript:return confirm('Message Here')")
I'm using this code in the btnAddRec click event, but it's not giving me the message. Is this correct?
-
Nov 22nd, 2002, 02:16 PM
#2
Hyperactive Member
if you put that in the click event of btnAddRec, you'll have to hit the button twice for it to work. Put it in the page_load and it'll work first time out.
-
Jan 6th, 2003, 03:05 PM
#3
Thread Starter
Frenzied Member
I can't put it in the page load event because the button is from inside a datagrid. Is there something else I can do to get the message box to show?
Code:
Public Sub DeleteBid(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.DeleteCommand
'check which row has been selected
Dim selectedRow As String = DataGrid1.DataKeys(e.Item.ItemIndex)
Dim btnDelete As Button
btnDelete = e.Item.Cells(4).Controls(0) '<---5th column, first control
btnDelete.Attributes("onclick") = "javascript:return confirm('Are you sure you want to delete \n Bid Record " & selectedRow & "?')"
Last edited by EyeTalion; Jan 6th, 2003 at 03:09 PM.
-
Jan 7th, 2003, 12:12 AM
#4
PowerPoster
Add it to the 'ItemDataBound' event handler for the datagrid. This event fires evertime an item is bound to a datasource.
-
Jan 7th, 2003, 08:58 AM
#5
Thread Starter
Frenzied Member
I placed it in the itemDataBound event. I'm getting an "Index out of range error" because no row has been selected yet....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|