|
Adding simple pieces of Javascript to an
Asp.net page can be acheived by adding to the attributes of the particular
imagebutton or linkbutton, for example:
if its normal ASP.Net Button then you can write the code as below
btnUpdate.Attributes.Add("onClick", "return confirm('confirm delete?');")
or if its a DataGrid button or checkbox then you can use the code as below
Private
Sub dgMegasolutions_ItemDataBound(ByVal
sender As
Object,
ByVal e As
DataGridItemEventArgs) Handles
dtgBeds.ItemDataBound
Try
If
(e.Item.ItemType = ListItemType.Item) Or
(e.Item.ItemType = ListItemType.AlternatingItem)
Then
Dim Active As
CheckBox = CType(e.Item.FindControl("active"),
CheckBox)
Active.Attributes.Add("onClick", "return setVal(this);")
End
If
Catch exc
As Exception
ProcessModuleLoadException(Me,
exc)
End
Try
End
Sub
|
|
|
|