or
<
telerik:GridTemplateColumn
HeaderText
=
"Report Period"
UniqueName
=
"ReportPeriodName"
Visible
=
"False"
Display
=
"False"
>
<
EditItemTemplate
>
<
asp:DropDownList
runat
=
"server"
ID
=
"ddlReportPeriod"
AppendDataBoundItems
=
"True"
>
<
asp:ListItem
Text
=
"-- Select Reporting Period --"
Value
=
""
/>
</
asp:DropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:RadGrid
ID
=
"RadGrid_MobileCheckList"
runat
=
"server"
AutoGenerateColumns
=
"False"
GridLines
=
"Vertical"
AllowMultiRowEdit
=
"true"
HeaderStyle-CssClass
=
"radGridHeaderStyle"
onitemdatabound
=
"RadGrid_MobileCheckList_ItemDataBound"
onprerender
=
"RadGrid_MobileCheckList_PreRender"
onitemcommand
=
"RadGrid_MobileCheckList_ItemCommand"
>
<
MasterTableView
DataKeyNames
=
"MobileChecklist_ID, MobileResponseType_ID, MobileResponse_ID"
EditMode
=
"Batch"
CommandItemDisplay
=
"Bottom"
>
<
Columns
>
<
telerik:GridBoundColumn
AllowSorting
=
"true"
HeaderStyle-Width
=
"20%"
ItemStyle-CssClass
=
"radGridItemStyle"
ReadOnly
=
"true"
DataField
=
"Task"
HeaderText
=
"Task"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderStyle-Width
=
"10%"
ItemStyle-CssClass
=
"radGridItemStyle"
HeaderText
=
"Response"
UniqueName
=
""
>
<
EditItemTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"MobileChecklistGrid_RadComboBox_Response"
ondatabound
=
"MobileChecklistGrid_RadComboBox_Response_DataBound"
Width
=
"100%"
DataTextField
=
"Response"
DataValueField
=
"MobileResponse_ID"
></
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderStyle-Width
=
"70%"
ItemStyle-CssClass
=
"radGridItemStyle"
HeaderText
=
"Comment"
>
<
EditItemTemplate
>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"MobileChecklistGrid_TextBox_Comment"
Width
=
"100%"
Text='<%# Eval("Comment") %>'></
telerik:RadTextBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridEditCommandColumn
UniqueName
=
"EditCommandColumn"
/>
</
Columns
>
<
CommandItemTemplate
>
<
asp:Button
runat
=
"server"
ID
=
"UpdateAll"
Text
=
"Update All"
CommandName
=
"UpdateAll"
/>
</
CommandItemTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
protected
void
RadGrid_CheckList_ItemCommand(
object
sender, Telerik.Web.UI.GridCommandEventArgs e)
{
if
(e.CommandName ==
"RowClick"
)
{
GridDataItem item = (GridDataItem)e.Item;
string
checklistId = item[
"Checklist_ID"
].Text;
DataTable table = _domain.GetMobileCheckListDetailsByCheckListId(checklistId);
RadGrid_MobileCheckList.DataSource = table;
RadGrid_MobileCheckList.DataBind();
}
}
protected
void
RadGrid_MobileCheckList_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
RadComboBox rcb = item.FindControl(
"MobileChecklistGrid_RadComboBox_Response"
)
as
RadComboBox;
if
(rcb !=
null
)
{
int
? responseTypeId = !
string
.IsNullOrEmpty(item.GetDataKeyValue(
"MobileResponseType_ID"
).ToString()) ?
int
.Parse(item.GetDataKeyValue(
"MobileResponseType_ID"
).ToString()) : (
int
?)
null
;
if
(responseTypeId !=
null
)
{
DataTable table = _domain.GetMobileResponsesByResponseTypeID(responseTypeId);
comboBox.DataSource = table;
comboBox.DataValueField = table.Columns[valueField].ToString();
comboBox.DataTextField = table.Columns[textField].ToString();
comboBox.DataBind();
comboBox.SelectedIndex = -1;
}
}
}
}
}
protected
void
RadGrid_MobileCheckList_PreRender(
object
sender, EventArgs e)
{
foreach
(GridDataItem dataItem
in
RadGrid_MobileCheckList.Items)
{
dataItem.Edit =
true
;
}
RadGrid_MobileCheckList.Rebind();
}
protected
void
RadGrid_MobileCheckList_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName ==
"UpdateAll"
)
{
foreach
(GridEditableItem editedItem
in
RadGrid_MobileCheckList.EditItems)
{
Hashtable newValues =
new
Hashtable();
Hashtable oldValues =
new
Hashtable();
oldValues = (Hashtable)editedItem.SavedOldValues;
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
editedItem.ExtractValues(newValues);
//I can get the items with something like this:
//But I dont want to update every row everytime, I need to know which items have been actually edited. Something like an isDirty property.
var test = ((RadComboBox)editedItem.Cells[3].Controls[1]).SelectedItem;
var test2 = ((RadTextBox)editedItem.Cells[4].Controls[1]).Text;
}
}
}
<
telerik:RadGrid
ID
=
"rgQueryResult"
runat
=
"server"
AutoGenerateColumns
=
"true"
AllowFilteringByColumn
=
"true"
OnNeedDataSource
=
"QueryResult_NeedDataSource"
AllowSorting
=
"true"
AllowPaging
=
"true"
EnableLinqExpressions
=
"true"
OnItemCommand
=
"QueryResult_ItemCommand"
OnItemCreated
=
"QueryResult_ItemCreated"
>
<
ExportSettings
ExportOnlyData
=
"true"
>
</
ExportSettings
>
<
MasterTableView
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"false"
ShowExportToCsvButton
=
"false"
ShowRefreshButton
=
"false"
ShowExportToExcelButton
=
"false"
/>
</
MasterTableView
>
<
ClientSettings
AllowColumnsReorder
=
"true"
>
<
Scrolling
AllowScroll
=
"true"
></
Scrolling
>
</
ClientSettings
>
</
telerik:RadGrid
>
<
telerik:RadGrid
ID
=
"dgRates"
runat
=
"server"
AllowSorting
=
"false"
AutoGenerateColumns
=
"False"
Skin
=
"Web20"
PageSize
=
"200"
GridLines
=
"None"
Width
=
"390px"
AllowPaging
=
"True"
TabIndex
=
"-1"
EnableEmbeddedSkins
=
"true"
OnBiffExporting
=
"RadGrid_BiffExporting"
>
<
PagerStyle
Position
=
"Bottom"
Mode
=
"NumericPages"
PageButtonCount
=
"10"
AlwaysVisible
=
"true"
/>
<
ClientSettings
>
<
Scrolling
UseStaticHeaders
=
"True"
AllowScroll
=
"True"
ScrollHeight
=
"300px"
></
Scrolling
>
<
Resizing
ResizeGridOnColumnResize
=
"True"
ClipCellContentOnResize
=
"False"
/>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
AllowMultiColumnSorting
=
"False"
EnableNoRecordsTemplate
=
"False"
GridLines
=
"None"
DataKeyNames
=
"ID"
TableLayout
=
"Fixed"
ShowHeader
=
"false"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
HeaderText
=
""
UniqueName
=
"ID"
Display
=
"false"
>
<
HeaderStyle
Width
=
"0px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CarType"
HeaderText
=
""
UniqueName
=
"CarType"
Display
=
"false"
>
<
HeaderStyle
Width
=
"0px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Rate"
HeaderText
=
""
UniqueName
=
"Rate"
Display
=
"false"
>
<
HeaderStyle
Width
=
"0px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CurrencyCode"
HeaderText
=
""
UniqueName
=
"CurrencyCode"
Display
=
"false"
>
<
HeaderStyle
Width
=
"0px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Period"
HeaderText
=
""
UniqueName
=
"Period"
Display
=
"false"
>
<
HeaderStyle
Width
=
"0px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Total"
HeaderText
=
""
UniqueName
=
"Total"
Display
=
"false"
>
<
HeaderStyle
Width
=
"0px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridCheckboxColumn
DataField
=
"HasInclusions"
HeaderText
=
""
UniqueName
=
"HasInclusions"
Display
=
"false"
>
<
HeaderStyle
Width
=
"0px"
/>
</
telerik:GridCheckboxColumn
>
</
Columns
>
<
DetailItemTemplate
>
<
asp:Table
ID
=
"RateTable"
runat
=
"server"
BorderWidth
=
"0"
Width
=
"100%"
>
<
asp:TableRow
>
<
asp:TableCell
HorizontalAlign
=
"Center"
Width
=
"70%"
BorderColor
=
"Transparent"
>
<
asp:Label
ID
=
"lblCarType"
runat
=
"server"
></
asp:Label
></
asp:TableCell
>
<
asp:TableCell
RowSpan
=
"4"
ID
=
"tcbtnBook"
HorizontalAlign
=
"Center"
VerticalAlign
=
"Top"
BorderColor
=
"Transparent"
>
<
asp:Button
ID
=
"btnBook"
runat
=
"server"
CssClass
=
"BtnStyle"
Width
=
"75px"
Text
=
""
CommandName
=
"Book"
></
asp:Button
>
</
asp:TableCell
>
</
asp:TableRow
>
<
asp:TableRow
>
<
asp:TableCell
CssClass
=
"LabelHeading"
HorizontalAlign
=
"Center"
Width
=
"70%"
BorderColor
=
"Transparent"
>
$ <
asp:Label
ID
=
"lblRate"
runat
=
"server"
></
asp:Label
> <
asp:Label
ID
=
"lblCurrencyCode"
runat
=
"server"
></
asp:Label
> / <
asp:Label
ID
=
"lblPeriod"
runat
=
"server"
></
asp:Label
></
asp:TableCell
>
</
asp:TableRow
>
<
asp:TableRow
>
<
asp:TableCell
HorizontalAlign
=
"Center"
Width
=
"70%"
BorderColor
=
"Transparent"
>
$ <
asp:Label
ID
=
"lblTotal"
runat
=
"server"
></
asp:Label
> <
asp:Label
ID
=
"lblCurrencyCode2"
runat
=
"server"
></
asp:Label
> <
asp:Label
ID
=
"lblTotalText"
runat
=
"server"
></
asp:Label
></
asp:TableCell
>
</
asp:TableRow
>
<
asp:TableRow
>
<
asp:TableCell
HorizontalAlign
=
"Center"
Width
=
"70%"
BorderColor
=
"Transparent"
>
<
asp:LinkButton
ID
=
"btnDetails"
runat
=
"server"
Text
=
""
Visible
=
"false"
CommandName
=
"Details"
/></
asp:TableCell
>
</
asp:TableRow
>
</
asp:Table
>
</
DetailItemTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
function btnBook_onclick(index, id) {
var masterTable = $find("dgRates").get_masterTableView();
masterTable.clearSelectedItems();
masterTable.selectItem(index);
return false;
}
<telerik:GridBoundColumn Aggregate="Count" DataField="CustomerID" DataType="System.String" HeaderText="CustomerID" SortExpression="CustomerID" UniqueName="CustomerID"> </telerik:GridBoundColumn>