Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Html.DevExpress().GridView(settings =>
- {
- //General settings
- settings.Name = "name";
- settings.KeyFieldName = "ID";
- //Other settings etc.....
- settings.Columns.Add(column =>
- {
- column.Name = "Name";
- column.FieldName = "CurrentFieldBoundToColumn";
- column.Caption = "Some caption";
- //Set hyperlink
- column.ColumnType = MVCxGridViewColumnType.HyperLink;
- var hyperLinkProperties = column.PropertiesEdit as HyperLinkProperties;
- String urlFormatString = Url.Action("Action", "Controller", new RouteValueDictionary(new { ID= "{0}" }));
- hyperLinkProperties.NavigateUrlFormatString = HttpUtility.UrlDecode(urlFormatString);
- });
- //Other Columns etc etc
- });
- settings.Columns.Add(column =>
- {
- column.Name = "Name";
- column.FieldName = "CurrentFieldBoundToColumn"";
- column.Caption = "SomeCaption";
- //Set hyperlink
- column.SetDataItemTemplateContent(content =>
- ViewContext.Writer.Write
- (
- Html.ActionLink
- (
- linkText: content.Text,
- actionName: "Action",
- controllerName: "Controller",
- routeValues: new { ID = content.KeyValue },
- htmlAttributes: null
- )
- ));
- });
- @Html.DevExpress().GridView(settings =>
- {
- //General settings
- settings.Name = "name";
- settings.KeyFieldName = "ID";
- //Other settings etc.....
- settings.Columns.Add(column =>
- {
- column.Name = "Name";
- column.FieldName = "CurrentFieldBoundToColumn";
- column.Caption = "Some caption";
- column.SetDataItemTemplateContent(content =>
- ViewContext.Writer.Write(
- Html.ActionLink(content.Text, "Action", "Controller",
- new { ID = content.KeyValue }, null)));
- });
- //Other Columns etc etc
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement