Skip to content

Commit 5f8dd7b

Browse files
committed
Spreadsheet-Document the new HyperlinkClicked event
1 parent 83c23ea commit 5f8dd7b

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

controls/spreadsheet/events.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,59 @@ End Sub
154154

155155
* **ActivePresenterChanged**: Occurs when the active presenter is changed.
156156

157+
* **HyperlinkClicked**: Occurs when a hyperlink in the document gets clicked. The event allows you to either cancel or replace the navigation logic. HyperlinkClicked event can be used as a confirmation from the end-user whether to proceed or not with opening a hyperlink due to security reasons.
158+
159+
#### Example 3: Using the HyperlinkClicked event to implement confirmation for the clicked links in the document
160+
161+
{{source=..\SamplesCS\Spreadsheet\Events.cs region=HyperlinkClickedEvent}}
162+
{{source=..\SamplesVB\Spreadsheet\Events.vb region=HyperlinkClickedEvent}}
163+
````C#
164+
private void ActiveWorksheetEditor_HyperlinkClicked(object sender, Telerik.WinControls.Hyperlinks.HyperlinkClickedEventArgs e)
165+
{
166+
if (e.URL.EndsWith("exe"))
167+
{
168+
e.Handled = true;
169+
MessageBoxResult Result = System.Windows.MessageBox.Show("You are about to open an executable file. Do you want to proceed?", "Possible unsafe link", MessageBoxButton.YesNo, MessageBoxImage.Question);
170+
171+
if (Result == MessageBoxResult.Yes)
172+
{
173+
Process.Start(new ProcessStartInfo()
174+
{
175+
FileName = e.URL,
176+
UseShellExecute = true
177+
});
178+
}
179+
}
180+
}
181+
182+
````
183+
````VB.NET
184+
Private Sub ActiveWorksheetEditor_HyperlinkClicked(ByVal sender As Object, ByVal e As Telerik.WinControls.Hyperlinks.HyperlinkClickedEventArgs)
185+
If e.URL.EndsWith("exe") Then
186+
e.Handled = True
187+
Dim Result As MessageBoxResult = System.Windows.MessageBox.Show("You are about to open an executable file. Do you want to proceed?", "Possible unsafe link", MessageBoxButton.YesNo, MessageBoxImage.Question)
188+
189+
If Result = MessageBoxResult.Yes Then
190+
Process.Start(New ProcessStartInfo() With {
191+
.FileName = e.URL,
192+
.UseShellExecute = True
193+
})
194+
End If
195+
End If
196+
End Sub
197+
198+
````
199+
200+
{{endregion}}
201+
202+
157203
>The events related to selection in RadSpreadsheet are described in the [Working with UI Selection]({%slug radspreadsheet-ui-working-with-selection%}) topic.
158204
159205
## Cells Events
160206

161207
* **CellPropertyChanged**: Occurs when a property of a cell is changed. The event arguments are of type **CellPropertyChangedEventArgs** and expose information about the exact property that was changed as well as the affected cell range. **Example 3** demonstrates how you can use the event to get a notification when the users change the fill of a cell.
162208

163-
#### Example 3: Using the CellPropertyChangedEvent
209+
#### Example 4: Using the CellPropertyChangedEvent
164210

165211
{{source=..\SamplesCS\Spreadsheet\Events.cs region=radspreadsheet-events_3}}
166212
{{source=..\SamplesVB\Spreadsheet\Events.vb region=radspreadsheet-events_3}}

0 commit comments

Comments
 (0)