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
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
Okay, thank you. If it's that simple :)
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
Yes, that was the trick. Thanks!
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