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. Image for the cookie policy date
close icon

Grid loses link on sorting

On my grid, I have basic link to an edit page as suggested in your "CRUD" example. However, as soon as I sort a column, all the links disappear and the text appears unformatted. How can the link state be maintained on sorting?

2 Replies

BK Balaji K Syncfusion Team July 29, 2009 02:32 PM UTC

Hi Eric,

Thanks for evaluating Syncfusion products.

The Grid HTML content is replaced internally after the Sorting.
So only edit link not available after the sorting.

You can handle QueryCellInfoEvent in pagingsortingMapper Action method and the link has to be appended to the cell value

Please refer the following code snippet:

[C#]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SortingAction()
{
IEnumerable data = new StudentDataContext().Student;
ActionResult result = data.GridActions();
GridHtmlActionResult engineSource = result as GridHtmlActionResult;
engineSource.GridModel.QueryCellInfo += (sender, args) =>
{
if (args.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || args.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
/// Edit link is applied in Title column
if (args.TableCellIdentity.Column.MappingName.Equals("ID"))
{
/// Hyperlink is appended inside the cell value
args.Style.CellValue =+ args.Style.CellValue;

}
}
};

return result;
}

Please let us know if this helps.

Regards,
Balaji


ES Eric Swann July 29, 2009 04:38 PM UTC

Yes, this did work!

Thanks,

Eric

Loader.
Live Chat Icon For mobile
Up arrow icon