简体   繁体   中英

How to add a hyperlink column in the devexpress ASPxGridView control?

I want to add to my GridView from Devexpress ( c# asp.net ) a hyperlink column where i want to set the name of each row to the value of the data.

Is this possible? How?

From the ASPxGridView documentation regarding How to create and configure a HyperLink column at runtime :

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM