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 remove last character from the string, you can use Remove method of the StringBuilder class.
In this method, you must specify the length of the string also specify how many character remove from the string. Lets take an example , we take a StringBuilder class object, append this object with some text. After assigning some string value into object, you can remove characters from the string object.
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Click"
Width="80px" />
<asp:Label ID="Label1" runat="server" BackColor="#FFFF66" Text="Label"></asp:Label>
</form>
protected void Button1_Click(object sender, EventArgs e)
{
StringBuilder stringA = new StringBuilder();
stringA.Append("it is a text. ");
stringA.Append("it is another text.");
Label1.Text = stringA.ToString();
stringA.Remove(stringA.Length - 1, 1);
Label1.Text += "<br /><br />after removing last character from stringbuilder....<br />";
Label1.Text += stringA.ToString();
}
In this method, you must specify the length of the string also specify how many character remove from the string. Lets take an example , we take a StringBuilder class object, append this object with some text. After assigning some string value into object, you can remove characters from the string object.
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Click"
Width="80px" />
<asp:Label ID="Label1" runat="server" BackColor="#FFFF66" Text="Label"></asp:Label>
</form>
Code behind code-
protected void Button1_Click(object sender, EventArgs e)
{
StringBuilder stringA = new StringBuilder();
stringA.Append("it is a text. ");
stringA.Append("it is another text.");
Label1.Text = stringA.ToString();
stringA.Remove(stringA.Length - 1, 1);
Label1.Text += "<br /><br />after removing last character from stringbuilder....<br />";
Label1.Text += stringA.ToString();
}
Comments
Post a Comment