我想从Devexpress(c#asp.net)添加我的GridView一个超链接列,我希望将每行的名称设置为数据的值。
这可能吗?怎么样?
答案 0 :(得分:6)
从ASPxGridView documentation关于如何在运行时创建和配置HyperLink列:
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);
}