radgrid on a formview insert template breaks out of inserting

5 posts, 0 answers
  1. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 02 Nov 2008 Link to this post

    Hi all,

    I’m experiencing an problem with the radgrid on a formview insert template.

    Situation:

    I have a formview. The insert template contains a radgrid with paging and filtering on. Above the grid is an autopostback checkbox. Now, when I click a row, the datakey value is properly saved in the record. I can use filtering, sorting and can click the checkbox and a serverside event is raised.

    The problem exists only when I click a paging item, then the formview switches back to “readonly” and inserting is gone..

    Fist I thought that is was the postback, but postback from the checkbox, filtering the grid or sorting the grid does not generate this problem.

    I have the application online so you can see for yourself: (testsite)
      http://emo.proovit.com/servicenet/
      Login with “telerik” and a password “tel1”
      In menu (left) choose “unloading”
      In the grid, choose a row (anyone will do)

    Now, when you click “add ship” you can reproduce the problem.

    Any ideas?

  2. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 05 Nov 2008 Link to this post

    Telerik support? I know it's a biggie, but i've encountered it at several auctions..
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 05 Nov 2008 Link to this post

    Hello Proovit,

    Thank you for providing live Url. I was able to observe the behavior you describe. However, I suggest that you send me your FormView and RadGrid declaration, so I could check it out and find a proper solution for you.
      
    Looking forward your reply,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 05 Nov 2008 Link to this post

    Hi Iana,

    Thanks for your response. I've tried to simplify the code, my code uses a lot of usercontrols.

    Fortunally (…) the problem also exists with a simple page. Just a formview with a radgrid in the insert template does the trick here. Minus the top radcombo's the problem still occurred.

    I'm using framework 2.0 sp2.


    <asp:FormView ID="FormView_EditShip" runat="server" DataKeyNames="Losbootaanvraagnummer" DataSourceID="SqlDataSource_Edit_Ship" EnableViewState="true">  
        <ItemTemplate> 
            <table style="border:0; margin:0; padding:0; white-space:nowrap; ">  
                <tr> 
                    <td>Ship</td><td>:</td><td><%#IIf(Trim(Eval("IMOnummer").ToString).Length < 2, "", "[" & Eval("IMOnummer").ToString & "] ")%>&nbsp;<%#Eval("Bootnaam_Desc").ToString%></td><td>&nbsp;</td><td></td><td></td><td style="text-align:right; color:Silver;"><%#Eval("Losbootaanvraagnummer").ToString%></td>  
                </tr> 
                <tr> 
                    <td>ETA</td><td>:</td><td><%#Format(IIf(Eval("ETA") Is DBNull.Value, CDate("1900/01/01"), Eval("ETA")), "yyyy-MM-dd   HH:mm")%></td><td>&nbsp;</td><td>Reference 1</td><td>:</td><td><%#Eval("Klantreferentie1")%></td>  
                </tr> 
                <tr> 
                    <td>Operator</td><td>:</td><td><%#Eval("Agent_Desc")%></td><td>&nbsp;</td><td>Reference 2</td><td>:</td><td><%#Eval("Klantreferentie2")%></td>  
                </tr> 
                <tr> 
                    <td colspan="7">  
                        <img src="APP_Images/HdrGradientUnderline.png" alt="Delete all ship info" style="border:0; height:1px;" /> 
                    </td>                                  
                </tr> 
                <tr> 
                    <td colspan="7">  
                        <asp:LinkButton ID="cmd_Ship_Edit" runat="server" onclick="cmd_Ship_Edit_Click"><img src="APP_Images/edit.gif" alt="Edit ship info" style="border:0" />&nbsp;Edit Ship</asp:LinkButton>&nbsp;&nbsp;  
                        <asp:LinkButton ID="cmd_ShipDelete" runat="server" onclick="cmd_ShipDelete_Click"><img src="APP_Images/delete.gif" alt="Delete all ship info" style="border:0" />&nbsp;Delete</asp:LinkButton> 
                    </td> 
                </tr> 
            </table> 
        </ItemTemplate> 
        <InsertItemTemplate> 
            <table style="border:0; margin:0; padding:0; white-space:nowrap; ">  
                <tr> 
                    <td>Ship</td><td>:</td> 
                    <td> 
                        <asp:CheckBox ID="chk_NewShipDetailsUnknow" runat="server" Text="Ship details not yet known." AutoPostBack="true" OnCheckedChanged="chk_NewShipDetailsUnknow_OnCheckedChanged" /> 
                    </td> 
                    <td>&nbsp;</td> 
                    <td></td><td></td><td style="text-align:right; color:Silver;">*</td> 
                </tr> 
                <tr> 
                    <td></td><td></td><td colspan="5">  
                        <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"   
                            AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" PageSize="10"   
                            DataSourceID="SqlDataSource_SeaShips" GridLines="None" Skin="Office2007">  
                            <MasterTableView DataKeyNames="BOOTNAAM" DataSourceID="SqlDataSource_SeaShips">  
                                <RowIndicatorColumn> 
                                    <HeaderStyle Width="20px"></HeaderStyle> 
                                </RowIndicatorColumn> 
     
                                <ExpandCollapseColumn> 
                                    <HeaderStyle Width="20px"></HeaderStyle> 
                                </ExpandCollapseColumn> 
                                  
                                <SortExpressions> 
                                    <telerik:GridSortExpression FieldName="LastETA" SortOrder="Descending" /> 
                                </SortExpressions> 
                              
                                <Columns> 
                                    <telerik:GridBoundColumn DataField="BOOTNAAM_Desc" EmptyDataText="&amp;nbsp;"   
                                        HeaderText="Ship" ReadOnly="True" SortExpression="BOOTNAAM_Desc" CurrentFilterFunction="Contains" 
                                        UniqueName="BOOTNAAM_Desc" ItemStyle-Wrap="false">                                  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn DataField="IMO_NUMMER" DataType="System.Int32"   
                                        EmptyDataText="&amp;nbsp;" HeaderText="IMO#" SortExpression="IMO_NUMMER" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Wrap="false" 
                                        UniqueName="IMO_NUMMER">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn DataField="LastETA" DataType="System.DateTime"   
                                        EmptyDataText="&amp;nbsp;" HeaderText="Recently used (on ETA)" ReadOnly="True"    
                                        SortExpression="LastETA" UniqueName="LastETA" DataFormatString="{0:yyyy-MM-dd  HH:mm}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Wrap="false">  
                                    </telerik:GridBoundColumn> 
                                </Columns> 
                            </MasterTableView> 
     
                            <FilterMenu EnableTheming="True" > 
                                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                            </FilterMenu> 
                              
                            <PagerStyle Mode="NextPrevAndNumeric" EnableSEOPaging="true" /> 
     
                            <ClientSettings AllowDragToGroup="False" EnablePostBackOnRowClick="False" AllowColumnsReorder="False" > 
                                <Selecting AllowRowSelect="True" /> 
                            </ClientSettings> 
                              
                        </telerik:RadGrid> 
                    </td> 
                </tr> 
                <tr> 
                    <td>ETA *</td><td>:</td> 
                    <td width="300px" style="white-space:nowrap">  
                        <telerik:RadDateTimePicker ID="RadDateTimePicker_NewShip" runat="server" SelectedDate='<%#Bind("ETA")%>' Skin="Office2007" ></telerik:RadDateTimePicker> 
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator_RadDateTimePicker_NewShip" runat="server" ErrorMessage="&nbsp;* Required" ControlToValidate="RadDateTimePicker_NewShip" Display="Dynamic"></asp:RequiredFieldValidator> 
                        <asp:RangeValidator ID="RangeValidator_RadDateTimePicker_NewShip" runat="server" ErrorMessage="Must be in the future" ControlToValidate="RadDateTimePicker_NewShip" MinimumValue="<%# MinimumNewETADate() %>" MaximumValue="2100-01-01" Display="Dynamic"></asp:RangeValidator> 
                          
                    </td> 
                    <td>&nbsp;</td> 
                    <td>Reference 1</td><td>:</td><td><telerik:RadTextBox ID="Klantreferentie1TextBox" runat="server" Text='<%# Bind("Klantreferentie1") %>' skin="Office2007" MaxLength="50" /></td>  
                </tr> 
                <tr> 
                    <td>Operator</td><td>:</td> 
                    <td> 
                        <telerik:RadComboBox ID="ddl_Agent1" Runat="server" AutoCompleteSeparator="|"   
                            DataSourceID="SqlDataSource_Agent" DataTextField="Naam"   
                            DataValueField="FIRMA_ID" DropDownWidth="200px"   
                            EmptyMessage="<No agents available>" EnableVirtualScrolling="True"   
                            Filter="Contains" NoWrap="True" Skin="Office2007"   
                            SortCaseSensitive="False" AppendDataBoundItems="true" selectedvalue='<%# Eval("Agent") %>' > 
                            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                            <Items> 
                                <telerik:RadComboBoxItem Text="(select)" Value="<%# DBNull.Value %>" /> 
                                <telerik:RadComboBoxItem Text="(Not Yet Known)" Value="NNB" /> 
                            </Items> 
                        </telerik:RadComboBox> 
                    </td> 
                    <td>&nbsp;</td> 
                    <td>Reference 2</td><td>:</td><td><telerik:RadTextBox ID="Klantreferentie2TextBox" runat="server" Text='<%# Bind("Klantreferentie2") %>' Skin="Office2007" MaxLength="50" /></td>  
                </tr> 
                <tr> 
                    <td>Surveyor</td><td>:</td> 
                    <td> 
                        <telerik:RadComboBox ID="ddl_Agent2" Runat="server" AutoCompleteSeparator="|"   
                            DataSourceID="SqlDataSource_Agent" DataTextField="Naam"   
                            DataValueField="FIRMA_ID" DropDownWidth="200px"   
                            EmptyMessage="<No agents available>" EnableVirtualScrolling="True"   
                            Filter="Contains" NoWrap="True" Skin="Office2007"   
                            SortCaseSensitive="False" AppendDataBoundItems="true" selectedvalue='<%# Eval("Surveyor") %>' > 
                            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                            <Items> 
                                <telerik:RadComboBoxItem Text="(select)" Value="<%# DBNull.Value %>" /> 
                                <telerik:RadComboBoxItem Text="(Not Yet Known)" Value="NNB" /> 
                            </Items> 
                        </telerik:RadComboBox> 
                    </td> 
                    <td>&nbsp;</td> 
                    <td>Reference 3</td><td>:</td><td><telerik:RadTextBox ID="Klantreferentie3TextBox" runat="server" Text='<%# Bind("Klantreferentie3") %>' Skin="Office2007" MaxLength="50" /></td>  
                </tr> 
                <tr> 
                    <td></td><td></td><td width="100px"></td><td width="50px"></td><td></td><td></td><td></td> 
                </tr> 
                <tr> 
                    <td valign="top">Remarks Agent</td><td>:</td><td colspan="5"><asp:TextBox ID="Opmerking_agentTextBox" runat="server" Text='<%# Bind("Opmerking_agent") %>' MaxLength="50" TextMode="MultiLine" Columns="60" Rows="3" cssclass="NormalTextBox" style="font-family:Tahoma, Arial, Helvetica" /></td>  
                </tr> 
                <tr> 
                    <td colspan="7">  
                        <img src="APP_Images/HdrGradientUnderline.png" alt="Delete all ship info" style="border:0; height:1px;" /> 
                    </td>                                  
                </tr> 
                <tr> 
                    <td colspan="7">  
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text='<img border="0" src="APP_Images/save.gif" alt="Add the new ship info" /> Add new ship info'></asp:LinkButton> 
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text='<img border="0" src="APP_Images/back.gif" alt="Back" /> Back '></asp:LinkButton> 
                    </td> 
                </tr> 
                <tr> 
                    <td colspan="7" style="background-color: Red; display:none; ">  
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("status") %>'></asp:Label><br /> 
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("Klant") %>'></asp:Label><br /> 
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("IMOnummer") %>'></asp:Label><br /> 
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("Bootnaam") %>'></asp:Label><br /> 
                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("Agent") %>'></asp:Label><br /> 
                                                              
                    </td> 
                </tr> 
            </tabel> 
        </InsertItemTemplate> 
        <EditItemTemplate> 
            <table style="border:0; margin:0; padding:0; white-space:nowrap; ">  
                .............  
            </tabel> 
        </EditItemTemplate> 
    </asp:FormView> 



    The code behind is not very interesting.. but here it is:



    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
            If Not IsPostBack Then 
                EMO.ServiceNET.Current.ClientID = "XXX" ' agent: working with client x  
                EMO.ServiceNET.Current.LoginID = "XXX" 
                EMO.ServiceNET.Current.LoginRoll = EMO.ServiceNET.LoginRolls.AsOperator ' Client / Agent   
                EMO.ServiceNET.Current.ClientRoll = "1"   ' act as roll x  
     
            End If 
        End Sub 
     
        Protected Sub ddl_ShipsETA1_SelectedIndexChanged(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles ddl_ShipsETA1.SelectedIndexChanged  
            Call SelectUnloadShipByID(ddl_ShipsETA1.SelectedValue)  
        End Sub 
        Protected Sub ddl_ShipsETA2_SelectedIndexChanged(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles ddl_ShipsETA2.SelectedIndexChanged  
            Call SelectUnloadShipByID(ddl_ShipsETA2.SelectedValue)  
        End Sub 
     
        Private Function SelectUnloadShipByID(ByVal aID As StringAs Boolean 
            Try 
                ddl_ShipsETA1.SelectedValue = aID  
                ddl_ShipsETA2.SelectedValue = aID  
                EMO.ServiceNET.Current.UnloadShip_ID = aID  
                SelectUnloadShipByID = (EMO.ServiceNET.Current.UnloadShip_ID = aID)  
            Catch Ex As Exception  
                FormView_EditShip.Visible = False 
                SelectUnloadShipByID = False 
            End Try 
        End Function 
     
        Protected Sub cmd_Ship_New_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles cmd_Ship_New.Click  
            Call FormView_EditShip.ChangeMode(FormViewMode.Insert)  
        End Sub 
     
        Protected Sub cmd_Ship_Edit_Click(ByVal sender As ObjectByVal e As System.EventArgs)  
            Call FormView_EditShip.ChangeMode(FormViewMode.Edit)  
        End Sub 
        Protected Sub cmd_ShipDelete_Click(ByVal sender As ObjectByVal e As System.EventArgs)  
            Call FormView_EditShip.DeleteItem()  
        End Sub 
     
        Public Function MinimumNewETADate() As String 
            Return Format(DateAdd(DateInterval.Day, 1, Now), "yyyy-MM-dd")  
        End Function 
     
        Protected Sub chk_NewShipDetailsUnknow_OnCheckedChanged(ByVal sender As ObjectByVal e As System.EventArgs)  
            FormView_EditShip.FindControl("SearchListShip1").Visible = Not CType(sender, CheckBox).Checked  
        End Sub 
  6. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 07 Nov 2008 Link to this post

    Hi Proovit,

    I looked through your code but could not find anything disturbing.
    However I prepared a sample project following your scenario and it works as expected on my end. Please check it out and let me know if I missed something from your logic.

    Kind regards,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017