or
GridDataItem item = (GridDataItem)e.Item;
if (item["myfield"].Text == "1")
{
item["myfield"].Text = "Yes"
}
else
{
item["myfield"].Text = "No"
}
<
div
id
=
"divList"
runat
=
"server"
style
=
"width: 100%; height: 505px;"
>
<
telerik:RadGrid
ID
=
"dgList"
runat
=
"server"
AllowMultiRowSelection
=
"True"
Skin
=
"XXX"
CellSpacing
=
"0"
CellPadding
=
"0"
BorderStyle
=
"Solid"
BorderWidth
=
"0px"
Width
=
"100%"
Height
=
"510px"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
AllowSorting
=
"True"
ImagesPath
=
"~/Skins/XXX/Grid"
OnItemDataBound
=
"dgList_ItemDataBound"
OnSortCommand
=
"dgList_SortCommand"
HeaderStyle-Height
=
"30px"
EnableEmbeddedSkins
=
"False"
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
<
Selecting
AllowRowSelect
=
"true"
/>
<
ClientEvents
OnRowSelected
=
"RowSelected"
OnRowDeselected
=
"RowDeSelected"
/>
</
ClientSettings
>
<
HeaderStyle
Font-Underline
=
"False"
Height
=
"30px"
/>
<
ItemStyle
Wrap
=
"true"
/>
<
MasterTableView
TableLayout
=
"Fixed"
AllowNaturalSort
=
"true"
AllowCustomSorting
=
"true"
ShowHeadersWhenNoRecords
=
"true"
NoMasterRecordsText
=
"No details found."
>
<
Columns
>
<
telerik:GridClientSelectColumn
UniqueName
=
"ClientSelectColumn"
>
<
HeaderStyle
Width
=
"3%"
/>
<
ItemStyle
HorizontalAlign
=
"Center"
/>
</
telerik:GridClientSelectColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"ID"
DataField
=
"ID"
HeaderText
=
"ID"
Display
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Details"
DataField
=
"Details"
HeaderText
=
"Description"
HeaderStyle-Width
=
"13%"
SortExpression
=
"Details"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"false"
Height
=
"100%"
HorizontalAlign
=
"Left"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"VersionID"
DataField
=
"VersionID"
HeaderText
=
"Version"
HeaderStyle-Width
=
"7%"
SortExpression
=
"VersionID"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"false"
Height
=
"100%"
HorizontalAlign
=
"Left"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"ContentID"
DataField
=
"ContentID"
HeaderText
=
"ContentType"
HeaderStyle-Width
=
"12%"
SortExpression
=
"ContentID"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"false"
Height
=
"100%"
HorizontalAlign
=
"Left"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"PublishedDate"
DataField
=
"PublishedDate"
HeaderText
=
"Published"
SortExpression
=
"PublishedDate"
HeaderStyle-Width
=
"7%"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"false"
Height
=
"100%"
HorizontalAlign
=
"Left"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"PlatformID"
DataField
=
"PlatformID"
HeaderText
=
"Platform"
SortExpression
=
"PlatformID"
HeaderStyle-Width
=
"10%"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"false"
Height
=
"100%"
HorizontalAlign
=
"Left"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"btnDetails"
ButtonType
=
"ImageButton"
ImageUrl
=
"~/Images/info.png"
HeaderText
=
"Details"
Text
=
"Details"
HeaderStyle-Width
=
"5%"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Center"
Height
=
"100%"
CssClass
=
"RadGridRow"
/>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Ob"
DataField
=
"Ob"
HeaderText
=
"Obsolete"
SortExpression
=
"Ob"
HeaderStyle-Width
=
"7%"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"false"
Height
=
"100%"
HorizontalAlign
=
"Center"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Size"
DataField
=
"size"
HeaderText
=
"Size[KB]"
SortExpression
=
"size"
HeaderStyle-Width
=
"6%"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"false"
Height
=
"100%"
HorizontalAlign
=
"Left"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Name"
DataField
=
"Name"
HeaderText
=
"FileName"
SortExpression
=
"Name"
ItemStyle-Wrap
=
"true"
HeaderStyle-Width
=
"16%"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"false"
Height
=
"100%"
HorizontalAlign
=
"Left"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Collection"
DataField
=
"Collection"
HeaderText
=
"CollectionName"
SortExpression
=
"Collection"
ItemStyle-Wrap
=
"true"
HeaderStyle-Width
=
"0%"
Display
=
"false"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
Wrap
=
"true"
Height
=
"100%"
HorizontalAlign
=
"Left"
CssClass
=
"RadGridRow"
/>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
div
>
Hi,
I have needs to make RadGrid scroll Horizontally, here is my code:
RadGrid1.Width = Unit.Percentage(100);
RadGrid1.MasterTableView.Width = Unit.Pixel(2100);
RadGrid1.ClientSettings.Scrolling.AllowScroll =
true
;
SELECT
CAST
(
(
CAST
(10549
AS
FLOAT
) /
CAST
(93020
AS
FLOAT
) * 100
)
AS
DECIMAL
(10,2)
)
AS
BobsPerAlice
BobsPerAlice
11.34
<
telerik:GridCalculatedColumn
DataType
=
"System.Double"
HeaderText
=
"Bobs"
UniqueName
=
"Bobs"
DataFields
=
"Bobs, Alice"
Expression
=
"{0} / {1} * 100"
FooterText
=
"Bobs / Alice: "
Aggregate
=
"Sum"
>
</
telerik:GridCalculatedColumn
>
Bobs
0
0
0
...
Bobs / Alice: 0