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. Image for the cookie policy date

How to disable hyperlink within Syncfusion Grid control

Hi,

I have a hyperlink control inside Syncfusion control and based on certain conditions I want to make it disable. Please do help me to resolve this problem.

Thanks,

SG

 


3 Replies

RA Rajasekar Syncfusion Team June 12, 2012 10:30 AM UTC

Hi Mahendra

 

Thank you for your update.

 

You can achieve your requirement by using the below code snippet,

 

        this.dataGrid.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);
        
        void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
        {
            if (e.Style.ColumnIndex==2)
            {
                e.Style.CellType = "Hyperlink";
                
                //you can enable and disable hyperlink cell link by using the Enabled property
                e.Style.Enabled = false;
            }

        }

 

Please let us know if you have any queries.

 

Thanks,

Rajasekar



MA Mahendra June 12, 2012 11:18 AM UTC

Hi,
 
Code snippet which I am using right now:
 
<syncfusion:GridDataVisibleColumn MappingName="State" HeaderText="State" IsReadOnly="True">
                    <syncfusion:GridDataVisibleColumn.CellItemTemplate>
                        <DataTemplate>
                            <TextBlock IsEnabled="{Binding Path=Record.Data.IsEnabled}">     
                                <Hyperlink Command="{Binding Path=DataContext.NavigateToAttachmentCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type syncfusion:GridDataControl}}}"
                                            CommandParameter="{Binding Path=Record.Data.Id}">
                                    <TextBlock Text="{Binding Path=Record.Data.State}"/>
                                </Hyperlink>                               
                            </TextBlock>
                        </DataTemplate>
                    </syncfusion:GridDataVisibleColumn.CellItemTemplate>
                </syncfusion:GridDataVisibleColumn>
 
I have used Enabled property on XAML to enable/disable the hyperlink, but it is not working as expected.
 
Please provide me the solution for the same ASAP.
 
Thanks,
Sunil


RA Rajasekar Syncfusion Team June 14, 2012 11:05 AM UTC

Hi Sunil,

Thank you for your update.

We have tested the reported issue but it is working fine from our side. Could you please check the below sample,

Sample: http://www.syncfusion.com/downloads/Support/DirectTrac/94735/SyncfusionGDC1411922025.zip

Please let us know if you have any queries.

Thanks,
Rajasekar


Loader.
Live Chat Icon For mobile
Up arrow icon