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 }); }
If you want to insert another string at 0 index of existing string, suppose you have a string like "jacob" and you want to insert another string like "hello" at 0 index , then you must use insert method of the StringBuilder class with 0 index.
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1"
runat="server"
Height="29px"
onclick="Button1_Click"
Text="Button"
Width="87px" />
</div>
<asp:Label ID="Label1"
runat="server"
BackColor="Yellow"
Text="Label"></asp:Label>
</form>
{
System.Text.StringBuilder stringA = new System.Text.StringBuilder();
stringA.Append("2nd string.");
stringA.Insert(0, "include string in front of stringbuilder. ");
Label1.Text = stringA.ToString();
}
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1"
runat="server"
Height="29px"
onclick="Button1_Click"
Text="Button"
Width="87px" />
</div>
<asp:Label ID="Label1"
runat="server"
BackColor="Yellow"
Text="Label"></asp:Label>
</form>
CodeBhindcode-
protected void Button1_Click(object sender, EventArgs e){
System.Text.StringBuilder stringA = new System.Text.StringBuilder();
stringA.Append("2nd string.");
stringA.Insert(0, "include string in front of stringbuilder. ");
Label1.Text = stringA.ToString();
}
Comments
Post a Comment