I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
Introduction
The Required FieldValidator control is the simplest control , and is used to ensure that the user has entered the data into the input control, such as TextBox to which it is bound. For example , if you are entering data, for buying a T-shirt , in an input control , it is necessary to enter the size of the T-Shirt that you want to buy. If you do not enter a value , the validation control displays an error message .
Public property of the RequiredFieldValidator Class
initialValue : Handles the initial value of the associated input control.
Example
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="requiredfield.aspx.cs" Inherits="requiredfield" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
UserName :
<asp:TextBox ID="usrtxt" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="usrtxt" ForeColor="Maroon">Field is required</asp:RequiredFieldValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="Submit" />
</div>
</form>
</body>
</html>
Output
The Required FieldValidator control is the simplest control , and is used to ensure that the user has entered the data into the input control, such as TextBox to which it is bound. For example , if you are entering data, for buying a T-shirt , in an input control , it is necessary to enter the size of the T-Shirt that you want to buy. If you do not enter a value , the validation control displays an error message .
Public property of the RequiredFieldValidator Class
initialValue : Handles the initial value of the associated input control.
Example
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="requiredfield.aspx.cs" Inherits="requiredfield" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
UserName :
<asp:TextBox ID="usrtxt" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="usrtxt" ForeColor="Maroon">Field is required</asp:RequiredFieldValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="Submit" />
</div>
</form>
</body>
</html>
Comments
Post a Comment