Skip to content

Commit 070424f

Browse files
svdimitrntacheva
andauthored
Update the code snippet in the Navigate from Button KB (#2271)
* Update the code snippet in the Navigate from Button KB * Update knowledge-base/common-navigate-from-button.md Co-authored-by: Nadezhda Tacheva <73842592+ntacheva@users.noreply.github.com> --------- Co-authored-by: Nadezhda Tacheva <73842592+ntacheva@users.noreply.github.com>
1 parent 4024356 commit 070424f

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

knowledge-base/common-navigate-from-button.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,34 @@ You can style anchors to look like Telerik buttons through the `k-button` CSS cl
3535

3636
>caption Open a new browser window from a button
3737
38-
![make links look like buttons](images/links-like-buttons.png)
39-
4038
````CSHTML
41-
<a class="k-button" href="/fetchdata">Fetch Data</a>
42-
<br /><br />
43-
<NavLink class="k-button" href="/counter">Counter</NavLink>
44-
<br /><br />
45-
<a class="k-button" target="_blank" href="https://www.telerik.com">telerik.com in new window</a>
46-
<br /><br />
47-
<NavLink class="k-button" target="_blank" href="https://www.google.com">Google in new window</NavLink>
39+
@inject NavigationManager NavManager
40+
@inject IJSRuntime JS
41+
42+
<TelerikButton OnClick="@OnButtonClick">Navigate to telerik.com in the same window</TelerikButton>
43+
44+
<br />
45+
46+
<TelerikButton OnClick="@OnButtonClickAsync">Navigate to telerik.com in a new window using JSInterop</TelerikButton>
47+
48+
<br />
49+
50+
<NavLink class="k-button k-button-solid k-rounded-md k-button-md k-button-solid-base"
51+
target="_blank"
52+
href="https://www.google.com">
53+
Google in new window
54+
</NavLink>
55+
56+
@code{
57+
private void OnButtonClick()
58+
{
59+
NavManager.NavigateTo("https://www.telerik.com");
60+
}
61+
62+
private async Task OnButtonClickAsync()
63+
{
64+
await JS.InvokeVoidAsync("open", "https://www.telerik.com", "_blank");
65+
}
66+
}
4867
````
4968

0 commit comments

Comments
 (0)