We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

add LinkLabel to GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

43457 Apr 24,2006 10:18 AM UTC Mar 5,2018 12:00 PM UTC WinForms 4
loading
Tags: GridControl
Fady Sayegh
Asked On April 24, 2006 10:18 AM UTC

hi to all, how can i add a LinkLabel in GridDataBoundGrid column. best regards and thanks in advance fady

Administrator [Syncfusion]
Replied On April 24, 2006 10:53 AM UTC

Hi Fady, LinkLabel is a Custom CellType.A custom CellType can be created, it requires a model class and a renderer class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer class handles the UI requirements of the cell. This sample in \Syncfusion\Essential Studio\4.1.0.62\windows\Grid.Windows\Samples\In Depth\DerivedCellControlTutorial can be referred. After creating the custom celltype, it has to be registered through CellModels.Add gridDataBoundGrid1.Model.CellModels.Add("LinkLabelCell", new LinkLabelCellModel(gridDataBoundGrid1.Model)); You need to set the linklabel cell type using Model''s Querycell Info event handler.Here is a code snippet. if(e.ColIndex == 5 && e.RowIndex > 0) { e.Style.CellType = "LinkLabelCell"; e.Style.Tag = "http://www.google.com/"; } Here is a sample. http://www.syncfusion.com/Support/user/uploads/DataBoundGrid_8c85137b.zip For more details,See the browser sample. \Syncfusion\Essential Studio\4.1.0.62\windows\Grid.Windows\Samples\CellTypes\LinkLabelCells\cs Please let me know if this helps. Regards, Haneef

Fady Sayegh
Replied On April 24, 2006 11:58 AM UTC

Hi Haneef, thanks to your reply, it works fady

Paratoo
Replied On November 12, 2013 04:57 PM UTC

Hello,

I'm trying t use the LinkLabelCellModel in http://www.syncfusion.com/Support/user/uploads/DataBoundGrid_8c85137b.zip
how can I modify it in order to edit the hypelink by double clicking on cell values?
Thanks

Arulpriya Ramalingam [Syncfusion]
Replied On March 5, 2018 12:00 PM UTC

Hi Paratoo,  
  
We have analyzed the provided sample. In the provided sample, the LinkLabelCellModel was inherited from a StaticCellModel. So, the LinkLabelCell will not be entered to edit mode at run time. If you want the cell to edit on DoubleClick, the LinkLabelCellModel can be overridden from the GridTextBoxCellModel and the LinkLabelCellRenderer can be inherited from GridTextBoxCellRenderer to enable the editing mode. Moreover, the ActivateCurrentCellBehavior can be set to DblClickOnCell to enable editing on double click. Please make use of the below code and modified sample,  
  
Code example  
  
//To enable editing on cell double click  
gridDataBoundGrid1.ActivateCurrentCellBehavior =GridCellActivateAction.DblClickOnCell;  
  
//To inherit the cell from GridTextBoxCellModel  
public class LinkLabelCellModel : GridTextBoxCellModel  
{  
            protected LinkLabelCellModel(SerializationInfo info, StreamingContext context)  
                        : base(info, context)  
            {  
            }  
//Some code  
}  
  
//To inherit the cell from GridTextBoxCellRenderer  
public class LinkLabelCellRenderer: GridTextBoxCellRenderer  
{  
            private bool _isMouseDown;  
            private bool _drawHotLink;  
            private Color _hotColor;  
            private Color _visitedColor;  
            private string _EXEname;  
  
            public LinkLabelCellRenderer(GridControlBase grid, GridCellModelBase cellModel)  
//Some code  
}  
  
  
Note  
In the provided sample, the browser for the link is launched in MouseUp event of the cell which will be called for both single and double click events. So, the browser will be launched on double click also and then the cell will be moved to edit mode.  
  
Regards,  
Arulpriya 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;