I would like to know how to force my Detail Grids to expand & show immediately after the MasterTable gets databound.
i.e. not having to click on the expand icon on the mastergrid after it binds and renders.
I am using the Need DataSource event for the Master and DetailTableDataBind Events and the MasterTables "DataBound" event
eg
protected
void grvSchedule_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)
{
switch (e.DetailTableView.Name)
{
case "ClientSchedDetl":
{
DoClientSchedDetailsGrid(e);
break;
}
case "grvAnimalDetl":
{
e.DetailTableView.DataSource =
L_Animals.
SchedAnimals.GetSheduleAnimals(SchedID);
break;
}
}
}
protected
void grvSchedule_DataBound(object sender, EventArgs e)
{
grvSchedules.MasterTableView.DetailTables[0].DataBind();
//ClientSchedDetl
grvSchedules.MasterTableView.DetailTables[1].DataBind();
//grvAnimalDetl
}
I am exporting the lot to PDF, but am trying to give the user a "Preview" screen, showing all detailgrids etc, prior to actually exporting to PDF, without the need for them clicking the "Grid s Expand button
i am using vers. 2009.1
I have noticed (no paging implemented), that any further pages basically the 2nd of my detail grids does not show on the form either,
Can i show it all in one page? i.e. not need to put paging in?
Thanks
Neal
5 Answers, 1 is accepted
| RadGrid1.MasterTableView.HierarchyDefaultExpanded = true; |
The First Detail Grid in the Hierarchy does expand, but the rest seemingly not (In the PDF they show correctly), but in the form from which I create the PDF,..no.
This form is a radwindow, containing the Grid and its Hierarchy / Detail Tables (5 of them, all at same level, not within each other).
The Radwindow does scroll, but only the MainMaster Grid and the First Detail Table are expanded. (unless the radwindow is hiding it somehow)
<
telerik:RadWindowManager
ID="RadWindowManager1"
runat="server"
>
<Windows>
<telerik:RadWindow
ID="RadPDF"
runat="server"
Width="1000px"
Height="600px"
Modal="true"
left = "25px"
top = "40px"
>
</telerik:RadWindow>
the grid itself
<
telerik:RadGrid ID="grvSchedules"
runat="server" Width="100%" Height="100%"
AutoGenerateColumns="False" GridLines="None" HorizontalAlign="Left"
ShowHeader="false"
OnItemCommand="grvSchedule_ItemCommand"
OnItemDataBound="grvSchedule_ItemDataBound"
OnDetailTableDataBind="grvSchedule_DetailTableDataBind"
OnNeedDataSource="grvSchedule_NeedDataSource"
OnDataBound="grvSchedule_DataBound"
OnItemCreated = "grvSchedule_ItemCreated"
>
<ExportSettings IgnorePaging="true" >
<Pdf PageHeight="270mm" PageWidth="540mm"
PageTitle="Client Schedule" />
</ExportSettings>
<MasterTableView
Width="100%" ShowHeader="false"
CellSpacing="1" pagesize="200"
HierarchyDefaultExpanded="true">
<DetailTables >
<telerik:GridTableView
runat="server" Name="ClientSchedDetl"
Width="100%" CellSpacing="-1"
BorderColor="Gray"
BorderStyle="Solid"
BorderWidth="1px"
HierarchyDefaultExpanded="true"
>
All other detail grids are copies of the above one (i.e. HierarchyDefaultExpanded="true" in all cases incl MasterTableView.
and in code behind
protected void grvSchedule_DataBound(object sender, EventArgs e)
{
grvSchedules.MasterTableView.HierarchyDefaultExpanded =
true;
grvSchedules.MasterTableView.DetailTables[0].DataBind();
//ClientSchedDetl
grvSchedules.MasterTableView.DetailTables[1].DataBind();
//grvAnimalDetl
grvSchedules.MasterTableView.DetailTables[2].DataBind();
grvSchedules.MasterTableView.DetailTables[3].DataBind();
grvSchedules.MasterTableView.DetailTables[0].HierarchyDefaultExpanded =
true;
grvSchedules.MasterTableView.DetailTables[1].HierarchyDefaultExpanded =
true;
grvSchedules.MasterTableView.DetailTables[2].HierarchyDefaultExpanded =
true;
grvSchedules.MasterTableView.DetailTables[3].HierarchyDefaultExpanded =
true;
grvSchedules.MasterTableView.DetailTables[0].HierarchyLoadMode =
GridChildLoadMode.ServerBind;
grvSchedules.MasterTableView.DetailTables[1].HierarchyLoadMode =
GridChildLoadMode.ServerBind;
grvSchedules.MasterTableView.DetailTables[2].HierarchyLoadMode =
GridChildLoadMode.ServerBind;
grvSchedules.MasterTableView.DetailTables[3].HierarchyLoadMode =
GridChildLoadMode.ServerBind;
grvSchedules.ClientSettings.AllowExpandCollapse =
true;
}
thx
Neal
If you have already set the HierarchyDefaultExpanded property in the aspx then you do not have to set it again in the code behind. But in the above given code I can see that you calling DataBind() for the detail tables in the DataBound event of the RadGrid. Hierarchical grid structure is not supported with simple data-binding(calling DataBind()). You may refer the following online demo for getting more details.
I have RadGrid with One MasterTable and a DetailTables, Both are Working Fine, I have Problem with Validation for DetailTables cloumns. I have StrMth, And EndMth in my Master Table. and StartMonth in my DetailTables, Both MasterTable and DetailTables Columns from Different DataBase Tables. Now My Requirement is I have to validate my DetailTables Column("StartMonth") with the MasterTable Cloumns(StrMth and EndMth). that means, DetailTables Cloumn(StartMonth) Date Range Should be between the MasterTable Column StrMth and EndMth.
For that i've written condition in OnDateChanged Event, But my problem is Iam getting the value of DetailTables Control "StartMonth" by using FindControl, but not Getting the values of MasterTable Controls "StrMth" and "EndMth" , Please Help me How to find Controls from Both MasterTable and DetailTables Controls in OnDateChanged Event.
Thanx in Advance
I have MasterTable and DetailTables in My RadGrid, When i expand the MasterTable, there will be DetailTable which is showing StartMonth and TotalAmount Columns, If i fill those and Click SaveAsDraft Button in the Page, that page will go to the NextPage (Saved Copy as Draft) until here is working Fine, But when come back to that page, the Records I entered in MasterTable is Displaying fine, But The Values i entered in DetailTables for that particular Row is not Showing,
That Means the Values i filled in masterTable are showing when i come back to that page from another Page, but in the Same time i can not see the values i filled in DetailTables are Disappearing. Any Suggesions Please.
Thanks in advance,