This is a migrated thread and some comments may be shown as answers.

Rad Grid Edit Popup Form not closing

4 Answers 317 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 17 Aug 2011, 07:47 AM
Hi,
I have gone through so many threads of the same issue but didn't get any solution. I am facing the mentioned issue. Refer to below sample code, when i hit on insert button in popup form, the form does not closes and the insert button's text changes to "update". Why form is not closing??
Protected Sub RadGrid2_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
        Dim GridExperience As RadGrid = RadPanelBar1.FindItemByValue("Step1").FindControl("RadGrid2")
        Dim dSet As Global.PICT.Web.CVDataSet = Session("CV")
        GridExperience.DataSource = dSet.Jobs
End Sub
  
Protected Sub RadGrid2_PreRender(ByVal sender As Object, ByVal e As EventArgs)
        If Not IsPostBack Then
            Dim GridExperience As RadGrid = RadPanelBar1.FindItemByValue("Step1").FindControl("RadGrid2")
            GridExperience.EditIndexes.Add(0)
            GridExperience.MasterTableView.Rebind()
        End If
End Sub
  
Protected Sub RadGrid2_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
  
        Dim dSet As Global.PICT.Web.CVDataSet = Session("CV")
        Dim newRow As DataRow = dSet.Jobs.NewRow
        Dim ExpKey As Long = 0
  
        If dSet.Jobs.Compute("MAX(PKEY)", String.Empty) Is DBNull.Value Then
            ExpKey = 1
        Else
            ExpKey = dSet.Jobs.Compute("MAX(PKEY)", String.Empty) + 1
        End If
  
        newRow("PKEY") = ExpKey
        newRow("JOB_CODE") = 1
        newRow("IS_ACTIVE") = 1
  
        Dim newValues As Hashtable = New Hashtable
        e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)
  
        Try
            For Each entry As DictionaryEntry In newValues
                newRow(CType(entry.Key, String)) = entry.Value
            Next
  
            dSet.Jobs.Rows.Add(newRow)
        Catch ex As Exception
            e.Canceled = True
        End Try
  
        e.Item.OwnerTableView.IsItemInserted = False
        Session("CV") = dSet
End Sub

And here is my aspx code..
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
    </telerik:RadScriptManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" 
        Skin="Default">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadPanelBar1" >                
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadPanelBar1" 
                    LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
    </telerik:RadAjaxLoadingPanel>    
    <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Web20"
            Width="720px" ExpandMode="SingleExpandedItem">
            <Items>
             <telerik:RadPanelItem runat="server" Expanded="True" Selected="True" 
                    Text="Step 1: Personal Information >>>" >
                    <Items>
                    <telerik:RadPanelItem Value="Step1">
                    <ItemTemplate>
                    <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" 
            CellSpacing="0" GridLines="None" oninsertcommand="RadGrid2_InsertCommand" 
            onitemcommand="RadGrid2_ItemCommand" onitemdatabound="RadGrid2_ItemDataBound" 
            onneeddatasource="RadGrid2_NeedDataSource" onprerender="RadGrid2_PreRender" 
            onupdatecommand="RadGrid2_UpdateCommand" Skin="Web20">
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
            <MasterTableView EditMode="PopUp" CommandItemDisplay="Top">
                <CommandItemSettings ExportToPdfText="Export to PDF" />
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                <Columns>
                <telerik:GridBoundColumn FilterControlAltText="Filter Skill column"  
                                                UniqueName="PKey" DataField="POSITION" HeaderText="Position" HeaderStyle-Width="250" Visible="false">
                                                <HeaderStyle HorizontalAlign="Center" />                                                                                                
                                            </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings EditFormType="Template">                   
                    <FormTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("POSITION") %>' ></asp:TextBox>
                        <telerik:RadButton ID="BtnAddExperience" runat="server" Text='<%# IIf (TypeOf Container is GridEditFormInsertItem, "Insert", "Update") %>'
                                                                Skin="Web20" Width="50px" CssClass="btnInsertItem"  
                                                                CommandName='<%# IIf (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'>
                                                            </telerik:RadButton>
                          
                    </FormTemplate>
                    <PopUpSettings Modal="True" Width="480px" />
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>
                    </ItemTemplate>
                    </telerik:RadPanelItem>
                    </Items>
                    </telerik:RadPanelItem>
            </Items>
            </telerik:RadPanelBar>
      
</asp:Content>

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 17 Aug 2011, 02:36 PM
Hi Muhammad,

To be able to close the popup edit form you should remove e.Canceled = true; from your InsertCommand. Give this suggestion a try and let me know how it goes.  

Greetings,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Muhammad
Top achievements
Rank 1
answered on 18 Aug 2011, 05:57 AM
Thanks for the quick response Pavlina. I tried removing e.canceled=True but fruitless.. I have debug the code but there was no any exception, compiler successfully exited the subroutine of insert command. Need more assistance.

Ovais.
0
Muhammad
Top achievements
Rank 1
answered on 20 Aug 2011, 06:47 AM
Isn't there any guy to sort out my problem?? Its very urgent..
Thanks.
0
Pavlina
Telerik team
answered on 22 Aug 2011, 12:38 PM
Hi Muhammad,

Can you please send me a sample website/page which I could debug locally in order to investigate the problematic behavior and find a resolution?

Best wishes,
Pavlina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
Muhammad
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Muhammad
Top achievements
Rank 1
Share this question
or