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
If you want to compare two string object then we can use compare( ) method of the string class. Using this method you can compare characters through casing rules and the alphabetic order. It returns 32-bit signed integer value. If returning value is equal to zero then both string are equal otherwise string is greater or less.Suppose, your string returns less than zero value it means your first string is less than to string b.
Lets take an simple example
Source code<div>
<asp:Button ID="Button1" runat="server" Text="String Compare" onclick="Button1_Click" />
<br />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
Business logic code
#region stringcompare
protected void Button1_Click(object sender, EventArgs e)
{
string a = "hello";
string b = "hello";
int c = string.Compare(a, b);
if (c == 0)
{
Label1.Text = "Both string are equal";
}
else
{
if (c < 0)
{
Label1.Text = "string a is less than string b";
}
else
{
Label1.Text = "string a is greater than string b";
}
}
}
#endregion
Code generate the following output
Comments
Post a Comment