I want to iterate through values of a column "Name" in my radgrid. Based on a certain condition, I have to prepend it with a refresh icon and append it with a error message. [refreshIcon]Value[ErrorMessage].Please help me achieve this code-behind..
5 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 21 May 2014, 03:51 AM
Hi,
You can use the ItemDataBound event of the RadGrid for your requirement.
C#:
Thanks,
Shinu
You can use the ItemDataBound event of the RadGrid for your requirement.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
if
(dataItem[
"Name"
].Text ==
"Some Value"
)
{
dataItem[
"Name"
].Text =
"refreshicon"
+ dataItem[
"Name"
].Text +
"ErrorMessage"
;
}
}
}
Thanks,
Shinu
0

RB
Top achievements
Rank 1
answered on 21 May 2014, 10:37 PM
Thanks for the reply. But I am unable to get the current row values. The parameter in dataItem["param"].Text, should be the unique name of the RadGrid column , or should it be the column name of the stored procedure?
0
Accepted

Shinu
Top achievements
Rank 2
answered on 22 May 2014, 03:50 AM
Hi,
The parameter in dataItem["parameter"].Text, should be the UniqueName of the RadGrid column. To provide a reliable way of locating the cell in a particular column, each column in the grid has a UniqueName property of type string. You can check this article on Accessing Cells and Rows for more information. If it doesn't help, provide your full code.
Thanks,
Shinu
The parameter in dataItem["parameter"].Text, should be the UniqueName of the RadGrid column. To provide a reliable way of locating the cell in a particular column, each column in the grid has a UniqueName property of type string. You can check this article on Accessing Cells and Rows for more information. If it doesn't help, provide your full code.
Thanks,
Shinu
0

RB
Top achievements
Rank 1
answered on 22 May 2014, 07:15 PM
While appending the text I want the file name to be bold and the error message to be italic. Something like:
dataItem["DocumentName"].Font.Bold = true;
dataItem["DocumentName"].Text = this._EntityDocumentumReferenceTable[e.Item.ItemIndex].DocumentName;
dataItem["DocumentName"].Font.Italic= true;
dataItem["DocumentName"].Text +=" "
+this._EntityDocumentumReferenceTable[e.Item.ItemIndex].ErrorMessage
;
0

Shinu
Top achievements
Rank 2
answered on 23 May 2014, 03:55 AM
Hi,
You set the style directly or using a CSS class as shown below:
C#:
CSS:
Thanks,
Shinu
You set the style directly or using a CSS class as shown below:
C#:
dataItem[
"ColumnUniqueName"
].CssClass =
"styleText"
;
//OR
dataItem[
"ColumnUniqueName"
].Font.Italic =
true
;
dataItem[
"ColumnUniqueName"
].Font.Bold =
true
;
CSS:
<style type=
"text/css"
>
.styleText
{
font-style
:
italic
;
font-weight
:
bold
;
}
</style>
Thanks,
Shinu