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

Detail Table Rebinding Issue

1 Answer 8 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jaspinder
Top achievements
Rank 1
Jaspinder asked on 29 Aug 2013, 03:17 PM
 I have critical issue. There are two rad grids on my page. In the left grid templates are shown with add button.
When we hid add that template will shown in the right grid detail Table. But I am unable to rebind main grid ass well as detail table.
When I try
  var tableView = $find("<%= grdRecordingFee2.ClientID %>").get_masterTableView();
    tableView.fireCommand("RebindGrid");

then detail table does not shown even I have written expand detail table code.

 Please send me any solution.

Code Is below:-

<telerik:AjaxSetting AjaxControlID="grdVwOrderItem">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="grdVwOrderItem" LoadingPanelID="RadAjaxLoadingPanel1">

</telerik:AjaxUpdatedControl>

</UpdatedControls>

</telerik:AjaxSetting>

<telerik:AjaxSetting AjaxControlID="ddlStates">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="grdTemplates" LoadingPanelID="RadAjaxLoadingPanel1">

</telerik:AjaxUpdatedControl>

</UpdatedControls>

</telerik:AjaxSetting>


<telerik:RadGrid ID="grdVwOrderItem" runat="server" AllowPaging="False" AllowSorting="False"

AllowMultiRowSelection="false" AutoGenerateColumns="False" GridLines="None" GroupingEnabled="False"

ShowGroupPanel="false" ShowHeader="true" Width="650px">

<MasterTableView DataKeyNames="OrderPropertyID" ExpandCollapseColumn-Visible="false"

CommandItemDisplay="None" Font-Bold="false" Font-Italic="False" Font-Overline="False"

Font-Strikeout="False" BorderColor="White" Font-Underline="False" ExpandCollapseColumn-Display="false"

ExpandCollapseColumn-Created="false" Height="0px" ShowHeader="true">

<ExpandCollapseColumn Display="false">

</ExpandCollapseColumn>

<CommandItemSettings ShowAddNewRecordButton="false" />

<Columns>

<telerik:GridBoundColumn DataField="OrderPropertyID" Display="False" HeaderText=""

ReadOnly="True" UniqueName="OrderPropertyID" />

<telerik:GridBoundColumn DataField="ReferenceID" HeaderStyle-CssClass="rgHeader_8"

HeaderText="Reference #" ReadOnly="True" UniqueName="ReferenceID" />

<telerik:GridBoundColumn DataField="Address" HeaderStyle-CssClass="rgHeader_8" HeaderText="Site Address"

ReadOnly="True" UniqueName="Address" />

<%-- <telerik:GridBoundColumn DataField="UserNotes" HeaderStyle-CssClass="rgHeader_8" HeaderText="Notes" ReadOnly="True" UniqueName="UserNotes" />--%>

<telerik:GridTemplateColumn HeaderText="Notes" HeaderStyle-CssClass="rgHeader_8"

ReadOnly="True" UniqueName="UserNotes">

<ItemTemplate>

<asp:Label ID="lblUserNotes" runat="server" Text='<%#Eval("SubUserNotes") %>' ToolTip='<%#Eval("UserNotes")%>' />

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

<DetailTables>

<telerik:GridTableView DataKeyNames="OrderTemplateID" Name="orderTemplete" HorizontalAlign="Center"

CssClass="innertable1" ShowHeader="false" ExpandCollapseColumn-Visible="false">

<ExpandCollapseColumn Visible="False">

</ExpandCollapseColumn>

<Columns>

<telerik:GridTemplateColumn>

<ItemTemplate>

<div class="main_table_7">

<table style="width: 100%">

<tr>

<td width="470">

<asp:Label ID="lbl" Text='<%#Eval("OrderTemplateName") %>' runat="server" />

</td>

<td>

<asp:LinkButton CommandName="Update" CommandArgument='<%#Eval("OrderTemplateID") %>'

CausesValidation="false" Text="Edit" ID="LinkButton1" runat="server"></asp:LinkButton>

</td>

<td>

<asp:LinkButton CausesValidation="false" CommandName="PrintOrderTemplate" CommandArgument='<%#Eval("OrderTemplateID") %>'

CssClass='<%# GetCssClass(DataBinder.GetPropertyValue(Container.DataItem, "IsPrinted")) %>'

Text="Print" ID="LinkButton2" runat="server"></asp:LinkButton>

</td>

<td>

<asp:LinkButton CausesValidation="false" Text="Remove" ID="LinkButton3" runat="server"></asp:LinkButton>

</td>

</tr>

<tr>

<td colspan="5">

<table style="width: 100%">

<asp:Repeater ID="RepDocs" runat="server" DataSource='<%# GetValue(DataBinder.GetPropertyValue(Container.DataItem, "OrderTemplateID")) %>'>

<ItemTemplate>

<tr>

<td width="490">

<asp:Label ID="Label5" runat="server" Text='<%# Eval("DocumentName") %>' />

</td>

<td>

</td>

<td>

<asp:LinkButton CausesValidation="false" Text="Print" CommandName="PrintOrderDocument" CommandArgument='<%#Eval("OrderDocumentID").ToString()+";"+Eval("OrderTemplateID").ToString() %>' CssClass='<%# GetCssClass(DataBinder.GetPropertyValue(Container.DataItem, "IsPrinted")) %>'

ID="LinkButton2" runat="server"></asp:LinkButton>

</td>

<td>

<asp:LinkButton CausesValidation="false" Text="Remove" ID="LinkButton3" runat="server"></asp:LinkButton>

</td>

</tr>

</ItemTemplate>

</asp:Repeater>

</table>

</td>

</tr>

</table>

</div>

<div style="height: 5px;">

</div>

<div id="Container" runat="server">

</div>

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

<AlternatingItemStyle BackColor="White" Font-Bold="false" Font-Italic="False" Font-Overline="False"

BorderColor="White" Font-Strikeout="False" Font-Underline="False" Wrap="True" />

</telerik:GridTableView>

</DetailTables>

<HeaderStyle CssClass="color1" />

<%-- <ItemStyle Font-Bold="false" Font-Italic="False" Font-Overline="False" HorizontalAlign="Center" Font-Strikeout="False" BorderColor="White"

Font-Underline="false" Wrap="True" />--%>

<AlternatingItemStyle BackColor="White" Font-Bold="false" Font-Italic="False" Font-Overline="False"

BorderColor="White" Font-Strikeout="False" Font-Underline="False" Wrap="True" />

</MasterTableView>

<%-- <ClientSettings Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="true">--%>

<ClientSettings>

</ClientSettings>

</telerik:RadGrid>

VB.Net Code to bind Grid

Protected Sub grdVwOrderItem_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdVwOrderItem.ItemCommand

If TypeOf e.Item Is GridDataItem Then

Dim dataItem As GridDataItem = e.Item

If e.CommandName = "PrintOrderTemplate" Then

Dim OrderTemplateID = e.CommandArgument.ToString()

Dim s As String = GetPdfDocuments(OrderTemplateID, 0)

DetailTable = DirectCast(e.Item.OwnerTableView, GridTableView)

'DetailTable.DataSource = GetTemplateDocumentDataByOrderTemplateID(OrderTemplateID)

'DetailTable.DataBind()

ScriptManager.RegisterStartupScript(Page, Me.GetType(), "JsStatus", "PrintAll(" + OrderTemplateID + ",false);", True)

DetailTable.DataBind()

End If

If e.CommandName = "PrintOrderDocument" Then

Dim OrderTemplateID = e.CommandArgument.ToString()

Dim s As String = GetPdfDocuments(OrderTemplateID, 0)

DetailTable = DirectCast(e.Item.OwnerTableView, GridTableView)

'DetailTable.DataSource = GetTemplateDocumentDataByOrderTemplateID(OrderTemplateID)

'DetailTable.DataBind()

ScriptManager.RegisterStartupScript(Page, Me.GetType(), "JsStatus", "PrintAll(" + OrderTemplateID + ",false);", True)

DetailTable.DataBind()

End If

End If

If e.CommandName = "Update" Then

'Here We have OrderTemplateID

Dim OrderTemplateID = e.CommandArgument

Dim div = New System.Web.UI.HtmlControls.HtmlGenericControl("div")

div = e.Item.FindControl("Container")

Dim uc As UserControl = DirectCast(Page.LoadControl("../Controls/ucDocEngine.ascx"), UserControl)

div.Controls.Add(uc)

End If

If e.CommandName = "Edit" Then

End If

End Sub

Public Function GetValue(ByVal OrderTemplateID As String) As Object

Return GetTemplateDocumentDataByOrderTemplateID(OrderTemplateID)

End Function

Thanks & Regards
Jaspinder

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 03 Sep 2013, 10:42 AM
Hello Jaspinder,

From the code provided I did not notice how is the detail table data-bound. That said I would like to ask you is the DetailTableDataBind event being used? If this is not the case I would recommend setting declarative relation between the MasterTableView and the child detail table. A demonstration of this is shown in this online demo.

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
General Discussions
Asked by
Jaspinder
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or