We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Change cell value on load

Thread ID:

Created:

Updated:

Platform:

Replies:

99457 May 22,2011 06:30 AM May 23,2011 04:35 AM ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Navin
Asked On May 22, 2011 06:30 AM

Hi,

I am loading my data in GrdiGroupingControl which is working fine. However, in one of the columns I would like to trim the values when the page loads. somthing like below:

if the actual value from database is: ABCD:EFGH, then i would like to display only EFGH.

Could you please advice how to do this?

Thanks,
Navin


Sridhar N [Syncfusion]
Replied On May 23, 2011 04:35 AM

Hi Navin,

Thanks for your interest in Syncfusion products.

Query #1"Change cell value on load"

Your requirement can be achieved by changing the value of cell using CellValue in QueryCellStyleInfo event. Please refer the below code snippet.

[Codebehind - C#]

void ggc_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column.MappingName == "Group")
{
string cellval = e.Style.CellValue.ToString();
if(cellval.StartsWith("ABCD:"))
{
// Trim the value.
cellval = cellval.TrimStart('A');
cellval = cellval.TrimStart('B');
cellval = cellval.TrimStart('C');
cellval = cellval.TrimStart('D');
cellval = cellval.TrimStart(':');
//Change the value using CellValue
e.Style.CellValue = cellval;
}
}
}
}


For your convenience, we have created sample and the same can be downloaded from the following link.

Forum1049508762.zip

Please let me know if you have any other questions or concerns.

Regards,
Sridhar.N



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;