<
table
cellspacing
=
"0"
border
=
"0"
id
=
"RadGridSearchResults_ctl00"
style
=
"width:100%;table-layout:auto;empty-cells:show;"
>
<
colgroup
>
<
col
style
=
"width:75px"
/>
<
col
style
=
"width:75px"
/>
<
col
style
=
"width:150px"
/>
<
col
style
=
"width:75px"
/>
<
col
style
=
"width:100px"
/>
<
col
/>
</
colgroup
>
<
thead
>
<
tr
>
<
th
scope
=
"col"
>Title Nbr</
th
><
th
scope
=
"col"
>Reg Date</
th
><
th
scope
=
"col"
>Type</
th
><
th
scope
=
"col"
>Linc Nbr</
th
><
th
scope
=
"col"
>Short Legal</
th
><
th
scope
=
"col"
>Owner</
th
>
</
tr
>
</
thead
><
tbody
>
<
tr
>
<
td
>32T43 .</
td
><
td
>
1925-02-06
</
td
><
td
>
CONVERSION
</
td
><
td
>
0023045991
</
td
><
td
>
4;6;13;5;NE
</
td
><
td
>
THE TOWN OF SOMEWHERE.
</
td
>
</
tr
><
tr
>
<
td
>48E12 .</
td
><
td
>
1933-09-22
</
td
><
td
>
CONVERSION
</
td
><
td
>
0023045975<
br
>0023045983
</
td
><
td
>
4;6;13;5;NE<
br
>4;6;13;5;SW
</
td
><
td
>
THE TOWN OF SOMEWHERE.
</
td
>
</
tr
><
tr
>
<
td
>791042549</
td
><
td
>
1979-03-21
</
td
><
td
>
CONVERSION
</
td
><
td
>
0023046774
</
td
><
td
>
4;6;13;4;SW
</
td
><
td
>
THE TOWN OF SOMEWHERE.
</
td
>
</
tr
><
tr
>
<
td
>891015298B .</
td
><
td
>
1989-01-26
</
td
><
td
>
CONVERSION
</
td
><
td
>
0023044720
</
td
><
td
>
4;6;13;5;NW
</
td
><
td
>
THE TOWN OF SOMEWHERE.
</
td
>
</
tr
><
tr
>
<
td
>901047011</
td
><
td
>
1990-02-20
</
td
><
td
>
CONVERSION
</
td
><
td
>
0023045967
</
td
><
td
>
4;6;13;5;NE
</
td
><
td
>
THE TOWN OF SOMEWHERE.
</
td
>
</
tr
>
</
tbody
>
</
table
>
protected
void
RadGridSearchResults_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.ExportToExcelCommandName || e.CommandName == RadGrid.ExportToPdfCommandName
|| e.CommandName == RadGrid.ExportToCsvCommandName || e.CommandName == RadGrid.ExportToWordCommandName)
{
RadGridSearchResults.ExportSettings.FileName =
"Titles_Summary_Export_"
+ DateTime.Now.ToShortDateString();
RadGridSearchResults.PageSize = RadGridSearchResults.MasterTableView.VirtualItemCount;
RadGridSearchResults.ExportSettings.IgnorePaging =
true
;
if
(e.CommandName == RadGrid.ExportToPdfCommandName)
{
isPdfExport =
true
;
RadGridSearchResults.ClientSettings.Scrolling.UseStaticHeaders =
false
;
RadGridSearchResults.ClientSettings.Scrolling.AllowScroll =
false
;
RadGridSearchResults.ExportSettings.ExportOnlyData =
true
;
RadGridSearchResults.MasterTableView.ExportToPdf();
}
}
}
http://www.telerik.com/community/code-library/aspnet-ajax/grid/print-radgrid-contents.aspx
I have a radGrid with a Master-Child-Relation and Edit mode is set to Batch.
The data will be populated via OnNeedDataSource for the master and via OnDetailTableDataBind.
The master table columns are readonly; the child columns not.
I would like to process data changes in the OnBatchEditCommand but the detail changes were not submitted.
(The e.Commands-collection has no members).
Any ideas ?
Thanks in advance.
The example show a simple Role/UsersInRole relationship.
<telerik:RadGrid ID="RadGrid2" runat="server"
AutoGenerateColumns="False"
CellSpacing="0"
CellPadding="0"
GridLines="None"
MasterTableView-EditMode="Batch"
Width="350px"
AllowMultiRowEdit="true"
OnNeedDataSource="RadGrid2_NeedDataSource"
OnBatchEditCommand="RadGrid2_BatchEditCommand"
OnDetailTableDataBind="RadGrid2_DetailTableDataBind">
<MasterTableView
DataKeyNames="Rolename"
EditMode="Batch"
CommandItemDisplay="Top"
HierarchyDefaultExpanded="true"
ExpandCollapseColumn-Visible="true"
GroupsDefaultExpanded="true">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="true" >
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<CommandItemSettings ShowSaveChangesButton="true" ShowCancelChangesButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false"/>
<Columns>
<telerik:GridBoundColumn UniqueName="Rolename" DataField="Rolename" HeaderText="Role"></telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView runat="server"
Name="Detail"
AutoGenerateColumns="false"
DataKeyNames="Username"
Width="100%"
EditMode="Batch"
ShowHeader="false"
ShowFooter="false"
AllowPaging="false"
AllowFilteringByColumn="false"
GridLines="None"
BorderStyle="None"
BatchEditingSettings-EditType="Cell">
<ParentTableRelation>
<telerik:GridRelationFields
DetailKeyField="Rolename"
MasterKeyField="Rolename" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn UniqueName="Rolename" DataField="Rolename" HeaderText="Role" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Username" DataField="Username" HeaderText="User"></telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>
protected void RadGrid
2
_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
{
// e.Commands has no items for changes made in detail view
foreach (GridBatchEditingCommand command in e.Commands)
{
Hashtable newValues = command.NewValues;
Hashtable oldValues = command.OldValues;
string OldRolename = oldValues[
"Rolename"
].ToString();
string NewRolename = newValues[
"Rolename"
].ToString();
// processing values
}
}
protected void RadGrid
2
_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
if (!e.IsFromDetailTable)
{
RadGrid
2
.DataSource = GetRoles();
}
}
protected void RadGrid
2
_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
{
var parentItem = e.DetailTableView.ParentItem as GridDataItem;
if (e.DetailTableView.Name ==
"Detail"
)
{
string Rolename = parentItem.GetDataKeyValue(
"Rolename"
).ToString();
e.DetailTableView.DataSource = GetUsersInRole(Rolename);
}
}