This is a migrated thread and some comments may be shown as answers.

[Solved] Grouping-expand collapse removes custom text highligts

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saritha B
Top achievements
Rank 1
Saritha B asked on 11 Sep 2009, 12:13 AM
I have some code to highlight text, bold text and convert text to hyperlink based on some condition in the RadGrid1_ItemDataBound event. However, when I click on expand/collapse of the grid, all the changes made disappears. How do I retain the changes I've made in the ItemDataBound?
Many Thanks in advance.


Code:

 

<GroupByExpressions>

 

 

<telerik:GridGroupByExpression>

 

 

<SelectFields>

 

 

<telerik:GridGroupByField FieldAlias="searchfield" FieldName="searchfield" HeaderText="Search Field"></telerik:GridGroupByField>

 

 

</SelectFields>

 

 

<GroupByFields>

 

 

<telerik:GridGroupByField FieldName="searchfield"></telerik:GridGroupByField>

 

 

</GroupByFields>

 

 

</telerik:GridGroupByExpression>

 

 

</GroupByExpressions>

 

 

<RowIndicatorColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</ExpandCollapseColumn>

 

 

<Columns>

 

.
.
.

</

 

Columns>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

Code behind:

protected

 

void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

 

{

 

if (e.Item is GridDataItem)

 

{

 

GridDataItem item = (GridDataItem)e.Item;

 

 

if (item["uemail"].Text.ToLower().Contains(TextBox1.Text.ToLower()))

 

{

 

string text = item["uemail"].Text;

 

 

string substring = "<b>" + text.Substring(text.IndexOf(TextBox1.Text, System.StringComparison.CurrentCultureIgnoreCase), TextBox1.Text.Length) + "</b>";

 

item[

"uemail"].Text = Regex.Replace(text, TextBox1.Text, substring, RegexOptions.IgnoreCase);

 

}


}

}

1 Answer, 1 is accepted

Sort by
0
Saritha B
Top achievements
Rank 1
answered on 11 Sep 2009, 12:25 AM
Tags
Grid
Asked by
Saritha B
Top achievements
Rank 1
Answers by
Saritha B
Top achievements
Rank 1
Share this question
or