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.

External Hyperlink In Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

103638 May 21,2012 10:53 AM May 23,2012 01:16 AM ASP.NET MVC (Classic) 1
loading
Tags: Grid
Kenneth Lam
Asked On May 21, 2012 10:53 AM

Hello, 
Is it possible to create a hyperlink to a website inside of a grid cell in Essential Grid for Asp.net MVC?  The actual url of the link will be based off of the data bound from the table's data source.

Bala Murugan A.S [Syncfusion]
Replied On May 23, 2012 01:16 AM

Hi Kenneth Lam,

Thanks for using Syncfusion Products

Your requirement of having hyperlink in a column can be achieved by handling QueryCellInfo event. We must handle QueryCellInfo event during paging action also. Please refer to the code-snippet below.

[ASPX]

<%=Html.Syncfusion().Grid<hyperlink.Models.Order>("FlatGrid")
.Datasource(Model)
.EnablePaging()
.EnableSorting()


.QueryCellInfo(
cell => Html.RenderAction("onQueryCellAction", "Home", new { args = cell })
)

%>



[Controller-CS]

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(PagingParams args)
{

IEnumerable data = new NorthwindDataContext().Orders.Take(200);
var engine = data.GridActions<Order>() as GridHtmlActionResult<Order>;
engine.GridModel.QueryCellInfo = onQueryCellAction;
return engine;
}


public void onQueryCellAction(GridTableCell<Order> args)
{
if (args.TableCellType == GridTableCellType.RecordFieldCell || args.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (args.Column.MappingName == "ShipCountry")
{
args.Text = "" + args.Data.ShipCountry + "";

}
}
}


Please refer to the below link to download the sample application.

Sample: http://www.syncfusion.com/downloads/Support/DirectTrac/94716/HyperLink-38769460.zip

Please let me know if you have any concern.

Regards,
Bala Murugan A.S


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.

;