Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display a RepositoryItemHyperLinkEdit control inside a DevExpress GridControl

I have a DevExpress GridControl in my current WinForms application. I need to display a hyperlink control (RepositoryItemHyperLinkEdit) in a column. I have added the RepositoryItemHyperLinkEdit via designer, but when I am running the application, hyperlink is not displaying.
Like to display buttons we are using:

repositoryItemButtonEdit1.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;
repositoryItemButtonEdit1.Buttons[0].Caption = "Get Sql Query";

So please tell me what I will write to display hyperlink in a column.

like image 809
Ranjan Panigrahi Avatar asked Nov 19 '25 16:11

Ranjan Panigrahi


1 Answers

You can use the following code to display hyperlink in grid column:

GridColumn hyperLinkColumn = gridView1.Columns["Hyperlink"];
//...
RepositoryItemHyperLinkEdit hyperLinkEdit = new RepositoryItemHyperLinkEdit();
hyperLinkColumn.ColumnEdit = hyperLinkEdit; // this line associated hyperlink with column
hyperLinkEdit.OpenLink += hyperLinkEdit_OpenLink;
//...
void hyperLinkEdit_OpenLink(object sender, OpenLinkEventArgs e) {
    MessageBox.Show("HyperLinkEdit clicked!");
}

If you want to display aditional button in the same column you can use the following approach:

hyperLinkEdit.Buttons[0].Kind = ButtonPredefines.Glyph;
hyperLinkEdit.Buttons[0].Caption = "Get SQL Query";
hyperLinkEdit.ButtonClick += hyperLinkEdit_ButtonClick;
hyperLinkColumn.ShowButtonMode = ShowButtonModeEnum.ShowAlways; // always display button in this column
//...
void hyperLinkEdit_ButtonClick(object sender, ButtonPressedEventArgs e) {
    MessageBox.Show("HyperLinkEdit's button clicked!");
}
like image 118
DmitryG Avatar answered Nov 22 '25 07:11

DmitryG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!