The following quick start guide is intended to get you up and running with the TextBox control. In this quick start, you'll start with creating a new application, add two TextBox controls and a Window control to it, bind the TextBox controls with the Window control and set the text for OK and Cancel buttons of the popup dialog.
HTML |
Copy Code
|
---|---|
<link rel="stylesheet" href="~/_content/C1.Blazor.Core/styles.css" /> <link rel="stylesheet" href="~/_content/C1.Blazor.Input/styles.css" /> |
HTML |
Copy Code
|
---|---|
<script src="~/_content/C1.Blazor.Core/scripts.js"></script> <script src="~/_content/C1.Blazor.Input/scripts.js"></script> |
Razor |
Copy Code
|
---|---|
@using C1.Blazor.Input |
Display the text you enter in the text boxes as the text for OK and Cancel buttons of the popup dialog using the following code. In this example, we added two TextBox, a Button and a Window control. Here, we have already provided text in both the text boxes using Text property of the C1TextBox class. The string value provided to the Text property of the first text box is bound to the corresponding OkText property and the value provided to the Text property of the second text box is bound to the corresponding CancelText property of the C1Window class that represents the popup window. This allows the text in the text boxes to be displayed as the text for OK and Cancel buttons of the popup dialog on a button click.
Index.razor |
Copy Code
|
---|---|
<!--Text boxes to set text for Window dialog buttons--> <C1TextBox @bind-Text="Oktxt"></C1TextBox> <br/> <br /> <C1TextBox @bind-Text="Canceltxt"></C1TextBox> <br /> <br /> <button @onclick="@OpenPopup">Show Dialog</button> <C1Window @ref="myPopup" Style="@("width: 500px; top: 15")" IsModeless="true" IsDialog="true" OkText="@Oktxt" CancelText="@Canceltxt" DialogType="DialogType.Confirm"> <PopupHeader> Window PopUp Header </PopupHeader> <PopupContent> Hello. This is the Window control. </PopupContent> </C1Window> @code{ C1Window myPopup; string Oktxt = "Okay", Canceltxt = "Close"; void OpenPopup() { myPopup.Open(); } void ClosePopup() { myPopup.Close(); } } |