Hi! I'm using a custom edit form with a web user control. In this web user control
In this control I have an asp:button and I want to control the events for this control in the ItemCommand event of the radGrid. But when I try to access the button on this custom control I get nothing (this only occurs on RadGrid.InitInsertCommandName or RadGrid.EditCommandName)
Please, can you help me? And the most important thing, can I do what I'm trying to do?
This is the code that I have:
Dim MyUserControl As New UserControl |
Select Case e.CommandName |
Case RadGrid.InitInsertCommandName, RadGrid.EditCommandName 'here i want to add a postback controling into the RadAjaxManager of the RadGrid |
MyUserControl = CType(e.Item.FindControl(GridEditFormInsertItem.EditFormUserControlID), UserControl) |
If Not IsDBNull(CType(MyUserControl.FindControl("btnAddDoc"), Button)) Then |
RadAjaxManager1.AjaxSettings.AddAjaxSetting(CType(MyUserControl.FindControl("btnAddDoc"), Button), _ CType(MyUserControl.FindControl("lstActiveDocs"), ListBox)) |
RadAjaxManager1.AjaxSettings.AddAjaxSetting(CType(MyUserControl.FindControl("btnAddDoc"), Button), _ CType(MyUserControl.FindControl("lstRelateDocs"), ListBox)) |
End If |
Case "AddDocs" 'here I want to control the button click event |
MyUserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl) |
'code for button click event |
' ... |
' ... |
' ... |
Case RadGrid.CancelCommandName 'here i want to remove the postback controling into the RadAjaxManager of the RadGrid |
For intX As Integer = 1 To RadAjaxManager1.AjaxSettings.Count - 1 |
RadAjaxManager1.AjaxSettings.RemoveAt(intX) |
Next intX |
End Select |
Thanks,
Liza