Hi.
I have a form template inside my radgrid.
On ItemDatabound, I would like to access a button in this form template in order to register it fot an asyncpostback with the scriptmanager. But I cannot find it.
Here is the code I use:
But the button always commes back as nothing.
Any help would be highly appreciated...
I have a form template inside my radgrid.
On ItemDatabound, I would like to access a button in this form template in order to register it fot an asyncpostback with the scriptmanager. But I cannot find it.
Here is the code I use:
Protected Sub grMessages_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grMessages.ItemDataBound
If TypeOf (e.Item) Is GridDataItem Then
Dim messageID As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("MessageID")
Dim senderID As Integer = DataBinder.Eval(e.Item.DataItem, "FromID")
Dim read As String = DataBinder.Eval(e.Item.DataItem, "Read")
Dim lblSender As Label = e.Item.FindControl("lblSender")
Dim query = (From tbl In db.tbl_UserProfiles Where tbl.UserID = senderID _
Select tbl.UserName).FirstOrDefault
lblSender.Text = query
If read = "False" Then
e.Item.Style.Add("font-weight", "bold")
End If
ElseIf TypeOf (e.Item) Is GridEditFormItem Then
Dim btnInsert As ImageButton = e.Item.FindControl("btnInsert")
If Not btnInsert Is Nothing Then
Dim script As ScriptManager = Master.FindControl("ScriptManager1")
script.RegisterAsyncPostBackControl(btnInsert)
End If
End If
End Sub
If TypeOf (e.Item) Is GridDataItem Then
Dim messageID As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("MessageID")
Dim senderID As Integer = DataBinder.Eval(e.Item.DataItem, "FromID")
Dim read As String = DataBinder.Eval(e.Item.DataItem, "Read")
Dim lblSender As Label = e.Item.FindControl("lblSender")
Dim query = (From tbl In db.tbl_UserProfiles Where tbl.UserID = senderID _
Select tbl.UserName).FirstOrDefault
lblSender.Text = query
If read = "False" Then
e.Item.Style.Add("font-weight", "bold")
End If
ElseIf TypeOf (e.Item) Is GridEditFormItem Then
Dim btnInsert As ImageButton = e.Item.FindControl("btnInsert")
If Not btnInsert Is Nothing Then
Dim script As ScriptManager = Master.FindControl("ScriptManager1")
script.RegisterAsyncPostBackControl(btnInsert)
End If
End If
End Sub
But the button always commes back as nothing.
Any help would be highly appreciated...