Hi,
I'm trying to have a literal control change its text when a radgrid is bound. The text basically states whether a terminal is offline or online.
Here is the code of the aspx page.
The above works fine but its the code behind with the onitemdatabound event I'm having a problem with.
What I want to happen is that when the
I really hope someone can point me in the right direction on this! Thank you in advance,
Regards,
Sunny
I'm trying to have a literal control change its text when a radgrid is bound. The text basically states whether a terminal is offline or online.
Here is the code of the aspx page.
<
telerik:RadGrid
ID
=
"RadGrid_Terminals"
runat
=
"server"
AutoGenerateColumns
=
"false"
AllowMultiRowSelection
=
"false"
AllowPaging
=
"True"
PageSize
=
"1"
GridLines
=
"None"
CellPadding
=
"0"
AllowSorting
=
"true"
Skin
=
"Default"
OnItemDataBound
=
"Check_Terminal_Status"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
MasterTableView
Width
=
"100%"
CommandItemDisplay
=
"Top"
GridLines
=
"None"
DataKeyNames
=
"Terminal_Auto_ID"
>
<
CommandItemTemplate
>
<
telerik:RadToolBar
ID
=
"RadToolBar1"
runat
=
"server"
Skin
=
"Default"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Control Terminal"
CommandName
=
"EditSelected"
Visible
=
"true"
ImageUrl
=
"Images/Edit.gif"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Refresh Terminals"
CommandName
=
"EditSelected"
Visible
=
"true"
ImageUrl
=
"Images/Refresh.gif"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
</
CommandItemTemplate
>
<
Columns
>
<
telerik:GridClientSelectColumn
UniqueName
=
"Checkbox_Terminal"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"Terminal_Image_Column"
HeaderText
=
"Status"
>
<
ItemTemplate
>
<
asp:Literal
ID
=
"Literal_Status"
runat
=
"server"
Text
=
"Online"
>
</
asp:Literal
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Terminal_ID_Ref"
DataField
=
"Terminal_ID_Ref"
HeaderText
=
"Terminal ID"
Visible
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"Terminal_Name"
DataField
=
"Terminal_Name"
HeaderText
=
"Name"
SortExpression
=
"Terminal_Name"
/>
<
telerik:GridBoundColumn
UniqueName
=
"Terminal_Type_OnTime_Model"
DataField
=
"Terminal_Type_OnTime_Model"
HeaderText
=
"Model"
SortExpression
=
"Terminal_Type_OnTime_Model"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
The above works fine but its the code behind with the onitemdatabound event I'm having a problem with.
protected void Check_Terminal_Status(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
//What happens here?
}
What I want to happen is that when the
Terminal_Image_Column"
control is bound, I decide whether to change the text in the literal Literal_Status to offline. I need to be able to change the text obviously, but also access the respective values such as Terminal_Type_OnTime_Model, Terminal_ID_Ref and Terminal_Auto_ID for example. I need to access this informaiton to perform other methods which will decide whether of not the text Literal_Status needs to be changed.I really hope someone can point me in the right direction on this! Thank you in advance,
Regards,
Sunny