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

issue in getting parameter value from grid

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sudhakar
Top achievements
Rank 1
Sudhakar asked on 03 Sep 2014, 09:43 AM
Hi,
I have a rad grid displaying on the screen with some rows.When Expand each row i am presenting with three tabs(Detals,compartments,products).See attachment
When I click on Compartmrents tab need to display the grid based on the LoadId.
Presently i am displaying this grid based on shipment id but i need this grid based on the LoadId.

I am facing issue in pasing loadId value to storedprocedure for displaying this grid.

aspx File
GetDischargeDetailWSListByDischargeId(dischargeID);
<telerik:RadPane ID="LoadingPane" runat="server" CssClass="noOverflow" >
                        <div id="LoadingPanelHeader" class="paneHeader">
                            <span class="headerPaneText">
                                <asp:Label ID="lbl_LoadingHeader" runat="server"></asp:Label></span>
                        </div>
                        <!------------------------------------
                           ---------LOADING SECTION -----------
                           ------------------------------------->
                        <telerik:RadAjaxPanel ID="LoadingPanel" runat="server" CssClass="radPaneContent TransferHeader">
                                                    </telerik:RadAjaxPanel>
                        <telerik:RadGrid ID="LoadingRadGrid" OnItemDataBound="LoadingRadGridFormat_OnItemDataBound"
                            runat="server" AutoGenerateColumns="false" CssClass="TransferGridPanel" Height="275px"
                            Width="375px" OnNeedDataSource="LoadingRadGrid_NeedDataSource">
                            <MasterTableView ShowHeadersWhenNoRecords="true">
                           
                                <NestedViewTemplate>
                                
                                    <telerik:RadTabStrip runat="server" ID="LoadTabStip" MultiPageID="LoadMultipage"
                                        SelectedIndex="0" OnTabClick="LoadTabStip_TabClick" Orientation="HorizontalTop">
                                        <Tabs runat="server">
                                            <telerik:RadTab runat="server" Text="Details" PageViewID="RadPageViewDetails">
                                            </telerik:RadTab>
                                            <telerik:RadTab runat="server" Text="Compartments" PageViewID="RadPageViewCompartments">
                                            </telerik:RadTab>
                                            <telerik:RadTab runat="server" Text="Products" PageViewID="RadPageViewProducts">
                                            </telerik:RadTab>
                                        </Tabs>
                                    </telerik:RadTabStrip>
                                    <telerik:RadMultiPage runat="server" ID="LoadMultipage" SelectedIndex="0" RenderSelectedPageOnly="false">
                                   
                                        <telerik:RadPageView runat="server" ID="RadPageViewDetails">
                                       
                                            <div class="contactWrap">
                                                <table cellpadding="0" cellspacing="0">
                                                    <tr>
                                                       <td><asp:Label ID="lbl_TerminalId" runat="server" Text='Terminal Id:' Font-Bold="true"></asp:Label></td>
                                                       <td><asp:Label ID="lbl_TerminalIdValue" runat="server"></asp:Label> </td> 
                                                    </tr>
                                                    <tr>
                                                        <td><asp:Label ID="lbl_TerminalName" runat="server" Text='TerminalName:' Font-Bold="true"></asp:Label></td>
                                                        <td><asp:Label ID="lbl_TerminalNameValue" runat="server"></asp:Label> </td>
                                                       
                                                    </tr>
                                                </table>
                                            </div>
                                        </telerik:RadPageView>
                                        <telerik:RadPageView runat="server" ID="RadPageViewCompartments">
                                       
                                            <telerik:RadGrid ID="LoadTabRadGrid" runat="server" AutoGenerateColumns="false" CssClass="TransferGridPanel"
                                                Height="233px" Width="475px" >
                                                <MasterTableView ShowHeadersWhenNoRecords="true">                                               
                                                    <Columns>
                                                        <telerik:GridBoundColumn UniqueName="CompNo" DataField="CompartmentIndex" HeaderText="Comp No.">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="PlannedLoadProd" DataField="PlannedProductName" HeaderText="Planned Product">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="ActualLoadProd" DataField="ActualProductName" HeaderText="Actual Product">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="PlannedLoadQty" DataField="PlannedQuantity" HeaderText="Planned Quantity">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn UniqueName="ActualLoadQty" DataField="ActualQuantity" HeaderText="Actual Quantity">
                                                        </telerik:GridBoundColumn>
                                                    </Columns>
                                                </MasterTableView>
                                            </telerik:RadGrid>
                                           
                                        </telerik:RadPageView>
                                    </telerik:RadMultiPage>
                                 
                                </NestedViewTemplate>
                               
                                <Columns>
                                    <telerik:GridBoundColumn UniqueName="LoadId" DataField="Loading_ID">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="TerminalId" DataField="Plant_ID">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="TerminalName" DataField="TerminalName">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="LoadingStartTime" DataField="LoadingStartTime">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="LoadingEndTime" DataField="LoadingEndTime">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                            <ClientSettings>
                                <Scrolling AllowScroll="true" />
                            </ClientSettings>
                        </telerik:RadGrid>
                      
                    </telerik:RadPane>

aspx.cs file:

protected void LoadTabStip_TabClick(object sender, RadTabStripEventArgs e)
    {
        //AddPageView(e.Tab.Text);
        e.Tab.PageView.Selected = true;
        string selectedtabindex = e.Tab.Text;
        Int64 shipmentID = Convert.ToInt64(ShiftTreeView.SelectedNode.Value);
        switch (selectedtabindex)
        {
            case "Details":
                {
                        break;
                }
            case "Compartments":
                {
                    RadPageView page = (RadPageView)e.Tab.PageView;
                    RadGrid grdLoad = (RadGrid)page.FindControl("LoadTabRadGrid");
                    List<LoadingDetailExtraEntity> loadingTabListinstance = new List<LoadingDetailExtraEntity>();
                    loadingTabListinstance = loadingDetailManager.GetLoadingDetailExtraListByShipmentId(shipmentID);
                    grdLoad.DataSource = loadingTabListinstance;
                    grdLoad.DataBind();
                    //e.Tab.Controls.Add(grdLoad);
                    break;
                }
            case "Products":
                {
                    break;
                }
        }
    }

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 04 Sep 2014, 05:27 PM
Hi,

1. Please check the below link.
Programmatic creation of RadGrid / Hierarchy with Templates UI for ASP.NET AJAX Resources Buy Try Thread is closed for posting Feed for this thread Email Subscription

2. Please check the below code snippet.

RadPageView page = (RadPageView)e.Tab.PageView;
//((GridNestedViewItem)page.Parent.Parent.....N times ).ParentItem.GetDataKeyValue("LoadId").ToString(); // You can get the parent grid by using parent and ParentItem -- Please above link for sample
 

<MasterTableView DataKeyNames="LoadID">

Please set above key in parent grid.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Sudhakar
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or