When clicking on row to edit than grid show empty.

5 posts, 1 answers
  1. MK
    MK avatar
    29 posts
    Member since:
    Jul 2010

    Posted 10 Sep 2012 Link to this post

    My code :

    <telerik:RadGrid ID="RadGridOrder" ShowStatusBar="true" runat="server" OnNeedDataSource="RadGridOrder_NeedDataSource"
                            OnItemDataBound="RadGridOrder_ItemDataBound" Width="100%" AutoGenerateColumns="False"
                            AllowMultiRowSelection="False" GridLines="None" AllowAutomaticUpdates="True"
                            OnItemUpdated="RadGridOrder_ItemUpdated" EnableViewState="true" OnEditCommand="RadGridOrder_ItemEdit"
                            OnDataBound="RadGridOrder_DataBound" OnItemCommand="RadGridOrder_ItemCommand">
                            <ClientSettings EnableRowHoverStyle="true" AllowColumnsReorder="false" ReorderColumnsOnClient="true">
                                <Selecting AllowRowSelect="True" />
                                <Resizing EnableRealTimeResize="false" ResizeGridOnColumnResize="false" AllowColumnResize="false">
                                </Resizing>
                            </ClientSettings>
                            <MasterTableView Width="100%" DataKeyNames="OrderSubOrderID" ExpandCollapseColumn-ButtonType="ImageButton"
                                EditMode="InPlace" ExpandCollapseColumn-CollapseImageUrl="Img/minus.png" ExpandCollapseColumn-ExpandImageUrl="Img/Plus.png">
                                <DetailTables>
                                    <telerik:GridTableView ShowHeadersWhenNoRecords="false" HorizontalAlign="Right" BorderWidth="1px"
                                        EnableNoRecordsTemplate="" Width="80%" runat="server">
                                        <ParentTableRelation>
                                            <telerik:GridRelationFields DetailKeyField="OrderSubOrderID" MasterKeyField="OrderSubOrderID" />
                                        </ParentTableRelation>
                                        <Columns>
                                            <telerik:GridBoundColumn HeaderText="ShippingStatus" DataField="Status" UniqueName="ShippingStatus">
                                            </telerik:GridBoundColumn>
                                            
                                            <telerik:GridBoundColumn HeaderText="textShipDate" DataField="ShippedOn" DataFormatString="{0:MM/dd/yyyy}"
                                                UniqueName="Timestamp">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn HeaderText="Quantitystr" DataField="Quantity" UniqueName="quantity">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </telerik:GridTableView>
                                </DetailTables>
                                <Columns>
                                    <telerik:GridEditCommandColumn ButtonType="ImageButton" ItemStyle-Width="25" HeaderStyle-Width="25" />
                                    <telerik:GridTemplateColumn HeaderText="ExternalItemstr" UniqueName="SKU">
                                        <ItemTemplate>
                                            <%#Eval("SKU")%>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtCouponCode" runat="server" Text='<%#Eval("SKU")%>'
                                                Width="95" />
                                        </EditItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridBoundColumn HeaderText="txtQuantityOrdered" DataField="Quantity" UniqueName="OrderedQuantity">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn HeaderText="txtQuantityShipped" DataField="Shipped 
    Quantity" UniqueName="ShippedQuantity">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                            <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                            </ClientSettings>
                        </telerik:RadGrid>

    Screen Short: please check attachment.

    Please let me know if any one know solution.


     

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Sep 2012 Link to this post

    Hi,

    This issue occurs when the RadGrid is not properly bound to data. If you are calling any methods for binding the data, please make sure that you call those methods inside the NeedDataSource event/not inside 'Not IsPostBack' condition in page load.

    Please provide the code behind if it doesn't help.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. MK
    MK avatar
    29 posts
    Member since:
    Jul 2010

    Posted 10 Sep 2012 Link to this post

    Hi Shinu,

    Thanks for reply.

    I wrote a linq in "NeedDataSource" event as below:
    protected void RadGridOrder_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
            {
                if (!e.IsFromDetailTable)
                {
                    RadGridOrder.DataSource = (from o in ctx.Orders
                                               join os in ctx.OrderSubOrders on o.OrderID equals os.OrderID
                                               join ref_s in ctx.ref_OrderStatus on o.OrderStatusID equals ref_s.OrderStatusID
                                               where o.SequentialOrderNumber == SeqOrderNo
                                               select new
                                               {
                                                   OrderSubOrderID = os.OrderSubOrderID,
                                                   SequentialOrderNumber = o.SequentialOrderNumber,
                                                   Status = ref_s.Name,
                                                   //ShipmentStatus = ,
                                                   SubOrderNumber = os.SubOrderNumber,
                                                   Quantity = 10,
                                                   ShippedOn = (Nullable<DateTime>)null
                                               }).ToList();
                }
            }

    But you know we can't call Rebind method inside this event.

    Still i have same issue.
  5. MK
    MK avatar
    29 posts
    Member since:
    Jul 2010

    Posted 10 Sep 2012 Link to this post

    Hi shinu,

    I got root curse of my problem.

    "SeqOrderNo" set 0 when i click for Edit.

    Please can you tell me how can i manage this passing parameter?
     
  6. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Sep 2012 Link to this post

    Hi,

    I guess 'SeqOrderNo' is an Integer variable. I need to know where you are assigning the value for 'SeqOrderNo' to replicate the issue. PostBack occur whenever you press an Edit button. Please prevent assigning the value inside 'Not IsPostBack' condition if its in page load event. Can you provide the  event in which you are assigning the value for 'SeqOrderNo'.

    Thanks,
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017