I am adding an additional command via CommandItemTemplate and I would like to keep the defaults of Add and refresh.
<CommandItemTemplate> |
<asp:LinkButton ID="radWindowAdd" runat="server" CommandName="MultiAdd" Text="Multi-Add" /> |
</CommandItemTemplate> |
Phil
10 Answers, 1 is accepted
Hello Phil,
Indeed when you define a custom command item template the default buttons from the command item will be removed. However, you can include the default 'Add new record' and 'Refresh' buttons inside the command item template of the grid (with their CommandName values InitInsert and Rebind respectively) as explained in this documentation topic.
Kind regards,
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Phil
You can copy the same icons and add them as image buttons inside the command item template if you would like to have exactly the same command item appearance.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
<
CommandItemTemplate
>
<
div
style
=
"display:inline-block; width:100%;"
>
<
div
style
=
"float:left;"
>
<!--my custom button-->
<
telerik:RadToolBar
ID
=
"RadToolBar1"
OnButtonClick
=
"RadToolBar1_ButtonClick"
runat
=
"server"
Height
=
"30px"
OnClientButtonClicking
=
"clientbuttonclick"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Delete selected items"
CommandName
=
"DeleteSelected"
ImageUrl
=
"~/images/Delete.gif"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
<!--end custom button-->
</
div
>
<
div
style
=
"float:right;"
>
<!--add default buttons back-->
Export:
<
asp:Button
ID
=
"ExportToExcelButton"
runat
=
"server"
CommandName
=
"ExportToExcel"
CssClass
=
"rgExpXLS"
/>
<
asp:Button
ID
=
"ExportToWordButton"
runat
=
"server"
CommandName
=
"ExportToWord"
CssClass
=
"rgExpDOC"
/>
<
asp:Button
ID
=
"ExportToPdfButton"
runat
=
"server"
CommandName
=
"ExportToPdf"
CssClass
=
"rgExpPDF"
/>
<
asp:Button
ID
=
"ExportToCsvButton"
runat
=
"server"
CommandName
=
"ExportToCsv"
CssClass
=
"rgExpCSV"
/>
<!--end of add-->
</
div
>
</
div
>
</
CommandItemTemplate
>
Hello,
I am running into an issue where I have added a button to the commandItemTemplate but it will not fire the OnClick event when RenderMode="Mobile". However if RenderMode is anything else (in this case lightweight) the button will fire the event.
Is there a property of the Mobile render mode that prevents commandItemTemplate buttons from being fired?
here is the code:
<
telerik:RadGrid
ID
=
"rdFileClosingsReport"
runat
=
"server"
OnNeedDataSource
=
"rdFileClosingsReport_NeedDataSource"
OnItemCommand
=
"rdFileClosingsReport_ItemCommand"
OnItemDataBound
=
"rdFileClosingsReport_ItemDataBound"
AllowFilteringByColumn
=
"True"
GroupingSettings-CaseSensitive
=
"false"
ValidationSettings-ValidationGroup
=
"gridSeller"
PageSize
=
"10"
AllowPaging
=
"true"
ClientSettings-Selecting-AllowRowSelect
=
"true"
AllowSorting
=
"true"
Skin
=
"Bootstrap"
GridLines
=
"None"
ExportSettings-IgnorePaging
=
"true"
ClientSettings-EnablePostBackOnRowClick
=
"true"
RenderMode
=
"Lightweight"
>
<
PagerStyle
Mode
=
"NumericPages"
/>
<
MasterTableView
AutoGenerateColumns
=
"false"
DataKeyNames
=
"CCMasterID"
ShowHeader
=
"true"
CommandItemDisplay
=
"Top"
>
<
CommandItemTemplate
>
<
asp:Button
runat
=
"server"
ID
=
"btnSetAllClosingsAsBilled"
OnClick
=
"btnSetAllClosingsAsBilled_Click"
Text
=
"Bill All"
CssClass
=
"gridBtn pull-right"
/>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
" "
CssClass
=
"rgExpCSV"
CommandName
=
"ExportToCSV"
/>
</
CommandItemTemplate
>
<
CommandItemSettings
ShowExportToExcelButton
=
"true"
ShowAddNewRecordButton
=
"false"
ShowRefreshButton
=
"false"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"CCMasterID"
UniqueName
=
"CCMASTERID"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FILENO"
UniqueName
=
"FILENO"
HeaderText
=
"File Number"
></
telerik:GridBoundColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"ORDMADEDAT"
HeaderText
=
"Order Made Date"
UniqueName
=
"ORDMADEDAT"
SortExpression
=
"ORDMADEDAT"
PickerType
=
"DatePicker"
DataFormatString
=
"{0:MM/dd/yyyy}"
></
telerik:GridDateTimeColumn
>
<
telerik:GridBoundColumn
DataField
=
"SETLAGENT"
UniqueName
=
"SETLAGENT"
HeaderText
=
"Settlement Agent"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SORDTAKENB"
UniqueName
=
"SORDTAKENB"
HeaderText
=
"Order Taken By"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"LOANAMOUNT"
UniqueName
=
"LOANAMOUNT"
HeaderText
=
"Loan Amount"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SALESPRICE"
UniqueName
=
"Userid"
HeaderText
=
"Sales Price"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"isBilledToClientAtPerFileRate"
UniqueName
=
"isBilledToClientAtPerFileRate"
Visible
=
"false"
></
telerik:GridBoundColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"CLOSEDATE"
UniqueName
=
"CLOSEDATE"
HeaderText
=
"Closing Date"
SortExpression
=
"CLOSEDATE"
PickerType
=
"DatePicker"
DataFormatString
=
"{0:MM/dd/yyyy}"
></
telerik:GridDateTimeColumn
>
<
telerik:GridBoundColumn
DataField
=
"FileStatus"
UniqueName
=
"FileStatus"
HeaderText
=
"Status"
></
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"BilledButton"
ButtonType
=
"ImageButton"
ImageUrl
=
"Content/images/dollar-black-circle-icon-28.png"
ButtonCssClass
=
"downloadimage"
CommandName
=
"ToggleFileBilled"
HeaderText
=
"File Billed"
DataTextFormatString
=
""
>
</
telerik:GridButtonColumn
>
</
Columns
>
<
NoRecordsTemplate
>
<
div
>
There are no records to display
</
div
>
</
NoRecordsTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
As you can see for now i have the RenderMode as Lighweight.
Thank You,
-SC
We have logged issue for this. Nevertheless, I have tested with our latest version and using a RadButton instead fires the event correctly:
<
CommandItemTemplate
>
<
telerik:RadButton
runat
=
"server"
ID
=
"RadButton1"
Text
=
"test"
OnClick
=
"RadButton1_Click"
></
telerik:RadButton
>
Can you please try with a RadButton and see if this will resolve the problem on your end.
Regards,
Konstantin Dikov
Telerik by Progress
Thank You,
Looks like this is what i needed to do.
-Stephen
I have the exact problem as Stephen (button events and OnItemCommand in the CommandItemTemplate do not fire when redermode = mobile) and tried the fix recommended by Konstantin. It does not work. Are there any other suggestions and is there a fix in the making?
Regards,
Mark
I have created a public item where you could follow its progress. Additionally, I have increased the priority of the issue:
Please give a vote for the public item, so you could further increase its priority.
Best Regards,
Konstantin Dikov
Telerik by Progress