Hello,
I have a custom button in my grid. After clicking on the button I want the LayoutID and LayoutTypeID read from the grid TemplateColumn. I've tried the following:
Unfortunately that did not work. How can i solve this?
Best regards
Reiner
I have a custom button in my grid. After clicking on the button I want the LayoutID and LayoutTypeID read from the grid TemplateColumn. I've tried the following:
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"PlayerLayoutID"
DataType
=
"System.Int64"
FilterControlAltText
=
"Filter PlayerLayoutID column"
HeaderText
=
"PlayerLayoutID"
ReadOnly
=
"True"
SortExpression
=
"PlayerLayoutID"
UniqueName
=
"PlayerLayoutID"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"LayoutTypeID"
FilterControlAltText
=
"Filter LayoutTypeID column"
HeaderText
=
"Layout Type"
UniqueName
=
"LayoutTypeID"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"LayoutTypeIDRadComboBox"
runat
=
"server"
DataSourceID
=
"ODSLayoutTypes"
DataTextField
=
"TypeName"
DataValueField
=
"TypeID"
onselectedindexchanged
=
"LayoutTypeIDRadComboBox_SelectedIndexChanged"
AutoPostBack
=
"True"
SelectedValue='<%# Bind("LayoutTypeID") %>' Culture="de-DE">
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"RadComboBoxItem1"
Value
=
"RadComboBoxItem1"
/>
</
Items
>
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidatorLayoutType"
runat
=
"server"
ErrorMessage
=
"*"
ControlToValidate
=
"LayoutTypeIDRadComboBox"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
<
asp:CustomValidator
ID
=
"CustomValidatorLayoutType"
runat
=
"server"
ErrorMessage
=
"*"
ControlToValidate
=
"LayoutTypeIDRadComboBox"
Display
=
"Dynamic"
onservervalidate
=
"CustomValidatorLayoutType_ServerValidate"
></
asp:CustomValidator
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"LayoutTypeIDLabel"
runat
=
"server"
Text='<%# Eval("TypeName") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"LayoutID"
FilterControlAltText
=
"Filter column1 column"
HeaderText
=
"Layout"
UniqueName
=
"LayoutID"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"LayoutIDRadComboBox"
runat
=
"server"
Culture
=
"de-DE"
Width
=
"300px"
Height
=
"300px"
OnClientDropDownOpened
=
"OnClientDropDownOpenedHandler"
ExpandAnimation-Type
=
"None"
CollapseAnimation-Type
=
"None"
>
<
ItemTemplate
>
<
div
id
=
"div1"
onclick
=
"StopPropagation(event);"
>
<
telerik:RadTreeView
ID
=
"RTVLayouts"
runat
=
"server"
onnodedatabound
=
"RTVLayouts_NodeDataBound"
OnClientNodeClicking
=
"nodeClicking"
>
</
telerik:RadTreeView
>
</
div
>
</
ItemTemplate
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
""
/>
</
Items
>
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"LayoutIDLabel"
runat
=
"server"
Text='<%# Eval("LayoutName") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
FilterControlAltText
=
"Filter EditCommandColumn column"
HeaderText="<%$ Resources:BasicSettings, Edit %>">
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
ConfirmText="<%$ Resources:BasicSettings, ConfirmDelete %>"
HeaderText="<%$ Resources:BasicSettings, Delete %>" Text="Delete"
UniqueName="DeleteColumn">
</
telerik:GridButtonColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
CommandName
=
"makeObjects"
FilterControlAltText
=
"Filter MakeObjects column"
HeaderText
=
"Objects"
ImageUrl
=
"../images/symbols/settings_16.png"
Text
=
"Objects"
UniqueName
=
"MakeObjects"
>
</
telerik:GridButtonColumn
>
</
Columns
>
protected
void
RadGridPlayerLayout_ItemCommand(
object
sender, GridCommandEventArgs e)
{
...
if
(e.CommandName ==
"makeObjects"
)
{
GridDataItem item = (GridDataItem)e.Item;
string
test = item[
"LayoutTypeID"
].Text;
}
}
Unfortunately that did not work. How can i solve this?
Best regards
Reiner