All,
Below is the code for my rad grid, and I want to get the selected item value of the rad combo box "not text" in gridbatchedit command.
command.NewValues["Description"] --want to text the selected item value, instead of text
protected void rgReleaseSchedule_Prerender(object sender, EventArgs e)
{
{
SavedChangesList.ForeColor = System.Drawing.Color.Red;
RadComboBox ddlDesc = rgReleaseSchedule.FindControl(rgReleaseSchedule.MasterTableView.ClientID + "_Description").FindControl("rdDescription") as RadComboBox;
var description = IoC.Current.Resolve<IReleaseService>().ReleaseListScheduleTitle();
ddlDesc.DataSource = description;
ddlDesc.DataTextField = "Description";
ddlDesc.DataValueField = "TitleID";
ddlDesc.DataBind();
}
}
protected void rgReleaseSchedule_BatchEditCommand(object sender, Telerik.Web.UI.GridBatchEditingEventArgs e)
{
try
{
SavedChangesList.Items.Clear();
SavedChangesList.ForeColor = System.Drawing.Color.Red;
foreach (GridBatchEditingCommand command in e.Commands)
{
Hashtable newvalues= command.NewValues;
if (command.Type == GridBatchEditingCommandType.Update)
{
if (command.NewValues["Date"].ToString() != "" && command.NewValues["Time"].ToString() != "" && command.NewValues["Description"].ToString() != "")
{
Int32 result = IoC.Current.Resolve<IReleaseService>().ReleaseListUpdate((Int32)command.Item.OwnerTableView.DataKeyValues[command.Item.ItemIndex]["ID"],
(DateTime)command.NewValues["Date"], command.NewValues["Time"].ToString(), command.NewValues["Description"]);
}
<
telerik:RadGrid
ID
=
"TrainingPlanRadGrid"
runat
=
"server"
Width
=
"100%"
AutoGenerateColumns
=
"false"
AllowPaging
=
"true"
PageSize
=
"13"
ShowHeader
=
"true"
ShowFooter
=
"false"
ShowGroupPanel
=
"false"
ShowStatusBar
=
"false"
OnNeedDataSource
=
"TrainingPlanRadGrid_NeedDataSource"
OnItemDataBound
=
"TrainingPlanRadGrid_ItemDataBound"
AllowMultiRowSelection
=
"true"
AllowAutomaticInserts
=
"false"
AllowAutomaticDeletes
=
"false"
AllowAutomaticUpdates
=
"false"
AllowSorting
=
"true"
AllowFilteringByColumn
=
"false"
BorderStyle
=
"None"
Style
=
"overflow: auto;"
HeaderStyle-Font-Bold
=
"true"
>
<
MasterTableView
TableLayout
=
"Fixed"
Width
=
"100%"
ClientDataKeyNames
=
"ID"
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"CheckBoxTemplateColumn"
Display
=
"true"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"CheckBox1"
runat
=
"server"
OnCheckedChanged
=
"ToggleRowSelection"
AutoPostBack
=
"True"
/>
</
ItemTemplate
>
<
HeaderTemplate
>
<
asp:CheckBox
ID
=
"headerChkbox"
runat
=
"server"
OnCheckedChanged
=
"ToggleSelectedStatePage"
AutoPostBack
=
"True"
/>
</
HeaderTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"RequestId"
HeaderText
=
""
DataField
=
"ID"
Visible
=
"false"
/>
<
telerik:GridDateTimeColumn
UniqueName
=
"RequestDate"
HeaderText
=
"RequestDate"
DataField
=
"REQUEST_DATE"
HeaderStyle-Wrap
=
"false"
HeaderStyle-Width
=
"12%"
HeaderStyle-HorizontalAlign
=
"Right"
ItemStyle-Width
=
"12%"
ItemStyle-HorizontalAlign
=
"Right"
/>
<
telerik:GridBoundColumn
UniqueName
=
"RequestUser"
DataField
=
"USER_NAME"
HeaderText
=
"RequestUser"
HeaderStyle-Wrap
=
"false"
HeaderStyle-Width
=
"15%"
ItemStyle-Width
=
"15%"
/>
<
telerik:GridBoundColumn
UniqueName
=
"RequestUserOrg"
DataField
=
"ORG_LABEL"
HeaderText
=
"RequestUserOrg"
HeaderStyle-Wrap
=
"false"
HeaderStyle-Width
=
"15%"
ItemStyle-Width
=
"15%"
/>
<
telerik:GridBoundColumn
UniqueName
=
"RequestAdmin"
DataField
=
"ADMIN_NAME"
HeaderText
=
"RequestAdmin"
HeaderStyle-Wrap
=
"false"
HeaderStyle-Width
=
"15%"
ItemStyle-Width
=
"15%"
/>
<
telerik:GridBoundColumn
UniqueName
=
"RequestCourse"
DataField
=
"COURSE_NAME"
HeaderText
=
"RequestCourse"
HeaderStyle-Wrap
=
"false"
HeaderStyle-Width
=
"25%"
ItemStyle-Width
=
"25%"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"RequestStatus"
HeaderText
=
"RequestStatus"
HeaderStyle-Wrap
=
"false"
HeaderStyle-Width
=
"12%"
ItemStyle-Width
=
"12%"
ItemStyle-Wrap
=
"false"
>
<
ItemTemplate
>
<%# GetRequestStatus(Eval("REQUEST_STATUS").ToString())%>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
PagerStyle
AlwaysVisible
=
"false"
Mode
=
"NumericPages"
/>
</
MasterTableView
>
<
HeaderStyle
Font-Bold
=
"true"
/>
<
ClientSettings
Selecting-AllowRowSelect
=
"true"
>
<
ClientEvents
OnRowDblClick
=
"editTrainingPlan"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
protected
void
ToggleRowSelection(
object
sender, EventArgs e)
{
GridItem item = ((sender
as
CheckBox).NamingContainer
as
GridItem);
item.Selected = (sender
as
CheckBox).Checked;
...
}
var
grid = $find(
"TrainingPlanRadGrid"
);
var
gridSelectedItems = grid.get_selectedItems();
<
telerik:RadToolBar
runat
=
"server"
ID
=
"RadToolBar1"
OnClientButtonClicked
=
"onButtonClicked"
EnableViewState
=
"False"
ResolvedRenderMode
=
"Classic"
SingleClick
=
"none"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Open"
ImageUrl
=
"~/Images/reply.gif"
CommandName
=
"openMail"
/>
<
telerik:RadToolBarButton
IsSeparator
=
"true"
/>
<
telerik:RadToolBarButton
CommandName
=
"showFilter"
Text
=
"Filter"
CheckOnClick
=
"True"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
function
onButtonClicked(sender, args) {
var
commandName = args.get_item().get_commandName();
if
(commandName ==
"showFilter"
) {
if
(tbButton.get_checked()) {
alert(
"checked"
)
$find(
'<%=RadGrid1.ClientID %>'
).get_masterTableView().hideFilterItem();
}
else
{
alert(
"unchecked"
)
$find(
'<%=RadGrid1.ClientID %>'
).get_masterTableView().showFilterItem();
}
}
}
Private
Sub
RadToolBar1_ButtonClick(sender
As
Object
, e
As
Telerik.Web.UI.RadToolBarEventArgs)
Handles
RadToolBar1.ButtonClick
Dim
tbBtn
As
RadToolBarButton = TryCast(e.Item, RadToolBarButton)
Select
Case
tbBtn.CommandName.ToLower
Case
"openmail"
OnMessageListSelectionChanged(displayedID,
True
,
False
)
End
Select
End
Sub