6 Answers, 1 is accepted
I guess you are using a WebUserControl EditForm inside Radgrid. Please go through this Demo which shows operations performed in a RadGrid using WebUserControl form. If this doesn't help, please provide your full code snippet.
Thanks,
Princy
<telerik:RadGrid ID="rgGroups" ...>...
<EditFormSettings EditFormType="Template">
<FormTemplate>
.....
<uc2:Campuses runat="server" ID="Campuses" />
<asp:TextBox......
</FormTemplate>...
</telerik:RadGrid>
and code behind
Private Sub rgGroups_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgGroups.ItemCreated
If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
If TypeOf e.Item Is GridEditFormInsertItem OrElse TypeOf e.Item Is GridDataInsertItem Then
' insert item
Dim editform As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
Dim Campuses As Campuses = CType(e.Item.FindControl("Campuses"), Campuses)
Campuses.MakeInit(Nothing)
Else
' edit item
Dim editform As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
Dim Campuses As Campuses = CType(e.Item.FindControl("Campuses"), Campuses)
Campuses.MakeInit(editform.GetDataKeyValue("GroupID"))
End If
End If
<uc2:Campuses> is a webUser control with RadGrid which should allow to edit/add/delete: allow to perform action while rgGroups is in edit mode .
When I am trying to add a new item in webUser control it goes to userControl load page
but don't fire an event (Insert/update).why?
Below is a sample code snippet that i tried which works fine at my end. With your given code its hard to identify the cause of the problem. Please try the sample code snippet, add the UserControl as follows and see if it helps, else provide your full code.
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" . . .> <MasterTableView. . .> <EditFormSettings UserControlName="EditPopup.ascx" EditFormType="WebUserControl" EditColumn-UniqueName="EditCommandColumn1"> </EditFormSettings> </MasterTableView></telerik:RadGrid>ASCX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateEditColumn="true" AutoGenerateDeleteColumn="true" OnInsertCommand="RadGrid1_InsertCommand"> <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top"> <Columns> . . . . </Columns> </MasterTableView></telerik:RadGrid>ASCX:CS:
Protected Sub RadGrid1_InsertCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand 'Code to insert End SubThanks,
Princy
<FormTemplate> <telerik:RadTabStrip runat="server" ID="RadTabStrip1" Orientation="HorizontalTop" SelectedIndex="0" MultiPageID="RadMultiPage1" CssClass="tabstrip" Skin="Default"> <Tabs> <telerik:RadTab Text="Tab1"> </telerik:RadTab> <telerik:RadTab Text="Tab2"> </telerik:RadTab> </Tabs> </telerik:RadTabStrip> <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0" CssClass="multiPage"> <telerik:RadPageView runat="server" ID="RadPageView2"> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> some controls <asp:Button ID="btnUpdate" runat="server" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update") %>' CausesValidation="False"></asp:Button> </ContentTemplate> </asp:UpdatePanel> </telerik:RadPageView> <telerik:RadPageView runat="server" ID="RadPageView2"> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <uc2:Campuses runat="server" ID="Campuses" /> </ContentTemplate> </asp:UpdatePanel> </telerik:RadPageView> </telerik:RadMultiPage> </FormTemplate> </EditFormSettings>Please modify your btnUpdate as follows ,it should fire the Update/Insert Command events. In UserControl also add this button code for Update/Insert.
ASPX:
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button>Thanks,
Princy
For your convenience I have prepared a sample page with RadGrid that uses WebUserControl within the FormTemplate that works as expected on my end.
As a side note, if you are ajaxifying your outer grid, please remove all UpdatePanels placed in the FormTemplate or at least the one place around the Button.
Hope that helps.
Regards,
Konstantin Dikov
Telerik
