Completed
Last Updated: 03 Jun 2015 11:04 by ADMIN
ADMIN
Ivan Petrov
Created on: 22 Mar 2012 07:04
Category: GridView
Type: Bug Report
1
FIX. RadGridView - HyperlinkColumn - HyperlinkOpnening/ed is not thrown when clicking on a cell with null value.
Steps to reproduce:

1. Drag a RadGridView to a form
2. Add a text column and a hyperlink column
3. Add a row with null value for the hyperlink cell
4. Set some text for the hyperlink cell
5. Subscribe to the HyperlinkOpening/ed events 
6. Run the project and click on the hyperlink, you will see that none of the events will be fired.

Workaround:
To work around it, you can create your own cell element which derives from the GridHyperlinkCellElement and override the ProcessHyperlink method to handle the user clicking on a hyperlink:
public class MyHyperlinkCellElement : GridHyperlinkCellElement
{
    public MyHyperlinkCellElement(GridViewColumn col, GridRowElement row)
        : base(col, row)
    { }
 
    protected override void ProcessHyperlink()
    {
        //handle hyperlink click           
    }
}

After you have created your cell element, you can replace the original using the CreateCell event of the RadGridView:
private void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.Column is GridViewHyperlinkColumn)
    {
        e.CellType = typeof(MyHyperlinkCellElement);
    }
}
0 comments