5 Answers, 1 is accepted
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 20 Jun 2013, 12:36 PM
Hello,
OR
Please check below link for more info.
Grid - Column Types
Thanks.
Jayesh Goyani
<
Columns
>
<
telerik:GridTemplateColumn
DataField
=
"Name"
UniqueName
=
"Name"
>
<
ItemTemplate
>
'<%# Eval("Name") %>'
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadDropDownList
ID
=
"RadDropDownList1"
runat
=
"server"
>
</
telerik:RadDropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
OR
<
Columns
>
<
telerik:GridDropDownColumn
></
telerik:GridDropDownColumn
>
</
Columns
>
Please check below link for more info.
Grid - Column Types
Thanks.
Jayesh Goyani
0
Marcus
Top achievements
Rank 1
answered on 20 Jun 2013, 01:06 PM
Jayesh,
Thanks for getting back to me so quick, I appreciate it. I've been trying to do this in the code behind and haven't been getting anywhere with it. Below is the code that I am using (with your modification) and it makes good sense. The only trouble I am having is that the IDE is complaining about the EVAL that looks for the column from the datatable. It says Code Blocks are not supported in this context. I've tried it with the single quotes and without the single quotes and get the same result. I added the table format to see if I could make it accept it, but no change there either.
Any suggestions?
Thanks for getting back to me so quick, I appreciate it. I've been trying to do this in the code behind and haven't been getting anywhere with it. Below is the code that I am using (with your modification) and it makes good sense. The only trouble I am having is that the IDE is complaining about the EVAL that looks for the column from the datatable. It says Code Blocks are not supported in this context. I've tried it with the single quotes and without the single quotes and get the same result. I added the table format to see if I could make it accept it, but no change there either.
Any suggestions?
<
telerik:RadGrid
ID
=
"rgForecasts"
runat
=
"server"
AllowPaging
=
"True"
AllowSorting
=
"True"
CellSpacing
=
"1"
GridLines
=
"None"
AutoGenerateEditColumn
=
"True"
BorderStyle
=
"Solid"
BorderWidth
=
"2px"
CellPadding
=
"1"
>
<
ExportSettings
ExportOnlyData
=
"True"
IgnorePaging
=
"True"
>
</
ExportSettings
>
<
MasterTableView
EditMode
=
"InPlace"
AllowFilteringByColumn
=
"True"
ShowFooter
=
"True"
CommandItemDisplay
=
"TopAndBottom"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
ShowExportToExcelButton
=
"True"
ShowExportToPdfButton
=
"True"
ShowExportToWordButton
=
"True"
/>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
Visible
=
"True"
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
Visible
=
"True"
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridTemplateColumnDataField
=
"ForecastStatus"
UniqueName
=
"ForecastStatus"
>
<
ItemTemplate
>
<
table
cellspacing
=
"0"
width
=
"100%"
class
=
"myTable"
>
<
tr
>
<
td
>
<%# Eval("ForecastStatus") %>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadDropDownListID
=
"rddlForecastStatus"
runat
=
"server"
>
</
telerik:RadDropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
/>
</
EditFormSettings
>
<
PagerStyle
PageSizeControlType
=
"RadComboBox"
/>
</
MasterTableView
>
<
PagerStyle
PageSizeControlType
=
"RadComboBox"
PageButtonCount
=
"20"
PageSizes
=
"10;20;30;50;100"
Position
=
"TopAndBottom"
></
PagerStyle
>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
</
telerik:RadGrid
>
0
Shinu
Top achievements
Rank 2
answered on 20 Jun 2013, 01:25 PM
Hi Marcus,
I have tried to replicate your code,it was the issue of not having proper spacing.
Here is the code snippet.
ASPX:
Thanks,
Shinu
I have tried to replicate your code,it was the issue of not having proper spacing.
Here is the code snippet.
ASPX:
<
telerik:GridTemplateColumn
DataField
=
"ForecastStatus"
UniqueName
=
"ForecastStatus"
>
<
ItemTemplate
>
<
table
cellspacing
=
"0"
width
=
"100%"
class
=
"myTable"
>
<
tr
>
<
td
>
<%# Eval("ForecastStatus") %>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadDropDownList
ID
=
"rddlForecastStatus"
runat
=
"server"
>
</
telerik:RadDropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
Thanks,
Shinu
0
Marcus
Top achievements
Rank 1
answered on 20 Jun 2013, 01:38 PM
Thanks Shinu, that got it. I removed the table as being superfluous and just complicated the code. But a question for you or Jayesh (or anyone else for that matter), to fill the RadDropDownList List, would this be done during the RadGrid ItemDataBound event or in another event and should I use the .FindControl method to get a reference to the RadDropDownList?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 21 Jun 2013, 06:19 AM
Hello,
You can also access the "RadDropDownList" in itemCreated,GridPrender, PagePrender.
But The ItemDataBound event is the best to bind RadDropDownList. Because in this event we are able to access whole row with data. (Advantages : 1. it is also help to give good performance compare to PagrPrender and GridPrerender event, 2. In ItemCreated event we are not able to access row data)
Thanks,
Jayesh Goyani