【问题标题】:How to add a hyperlink column in the devexpress ASPxGridView control?如何在 devexpress ASPxGridView 控件中添加超链接列?
【发布时间】:2016-09-05 14:46:07
【问题描述】:

我想从 Devexpress (c# asp.net) 向我的 GridView 添加一个超链接列,我想在其中将每一行的名称设置为数据的值。

这可能吗?怎么样?

【问题讨论】:

  • 据我所知,你有什么尝试,我确信 devexpress 网站上有一个例子,这让我觉得你只是在找人为你做所有事情。
  • “设置每一行的名称”是什么意思?你的意思是超链接上显示的文字?

标签: c# devexpress aspxgridview


【解决方案1】:

来自ASPxGridView documentation 关于如何在运行时创建和配置超链接列

public void PopulateColumns() {
    GridViewDataTextColumn colID = new GridViewDataTextColumn();
    colID.FieldName = "ID";
    ASPxGridView1.Columns.Add(colID);

    GridViewDataHyperLinkColumn colItemName = new GridViewDataHyperLinkColumn();
    colItemName.FieldName = "ItemName";
    colItemName.PropertiesHyperLinkEdit.NavigateUrlFormatString ="~/details.aspx?Device={0}";
    colItemName.PropertiesHyperLinkEdit.TextFormatString = "Device {0}";
    colItemName.PropertiesHyperLinkEdit.TextField = "ItemName";
    ASPxGridView1.Columns.Add(colItemName);
}

【讨论】:

    猜你喜欢
    • 2012-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-10
    • 1970-01-01
    相关资源
    最近更新 更多