GridHyperlinkColumn does not open webbrowser

Hi there,

in my .NET 7.0 wfp application I am using  the GridHyperlinkColumn with Mapping to  a property with an url, for example https://www.google.com.

When I click the link an exception is thrown:

"An error occurred trying to start process 'https://www.google.com' with working directory '...\bin\Debug\net7.0-windows'. The system can not find the stated file.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)"

Am I doing something wrong here?

Greetings


5 Replies

SG Santhosh Govindasamy Syncfusion Team November 28, 2023 02:22 PM UTC

Hi Boon

Your requirement, "Hyperlink should open in the browser," can be achieved by using the CurrentCellRequestNavigate event. This event helps trigger the hyperlink. For your reference, attached is the UG link for handling the "GridHyperlinkColumn.

Ensure that the URL is valid.

UG Link-> https://help.syncfusion.com/wpf/datagrid/column-types#gridhyperlinkcolumn


Regards,
Santhosh.G



BO Boon November 30, 2023 08:38 PM UTC

Okay, thank you. If it's that simple :)



SG Santhosh Govindasamy Syncfusion Team December 1, 2023 05:41 PM UTC

Boon,

When you encounter an exception while running the .NET 7.0 application, we have one more suggestion, set the UseShellExecute property value to true.
Here we have attached the tested sample. Please have a look at this. If you are still facing the reported issue, modify the attached sample based on your scenario. It will be helpful for us to proceed further.

Please refer the code snippet

public MainWindow()

 {

     InitializeComponent();

     this.dataGrid.CurrentCellRequestNavigate += DataGrid_CurrentCellRequestNavigate;

 }

 

 

 

 

 

private void DataGrid_CurrentCellRequestNavigate(object? sender, CurrentCellRequestNavigateEventArgs e)

 {

     string address = https://en.wikipedia.org/wiki/ + e.NavigateText;

     Process.Start(new ProcessStartInfo(address) { UseShellExecute = true });

 }

 



Regards,
Santhosh.G


Attachment: SfDataGrid_Net__b61537b3.zip


BO Boon December 8, 2023 01:14 PM UTC

Yes, that was the trick. Thanks!



SG Santhosh Govindasamy Syncfusion Team December 11, 2023 06:27 AM UTC

Boon,

We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help.


Regards,
Santhosh.G


Loader.
Up arrow icon