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 }); }
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Height="42px" onclick="Button1_Click"
Text="Click" Width="84px" BackColor="#990000" ForeColor="White" />
<div style="width: 110px; height: 37px; margin-bottom: 28px">
<asp:Label ID="Label1" runat="server" Text="Label" BackColor="#CCFF33"
BorderColor="Black"></asp:Label>
</div>
<p>
</p>
</form>
<asp:Button ID="Button1" runat="server" Height="42px" onclick="Button1_Click"
Text="Click" Width="84px" BackColor="#990000" ForeColor="White" />
<div style="width: 110px; height: 37px; margin-bottom: 28px">
<asp:Label ID="Label1" runat="server" Text="Label" BackColor="#CCFF33"
BorderColor="Black"></asp:Label>
</div>
<p>
</p>
</form>
code behind code -
protected void Button1_Click(object sender, EventArgs e)
{
StringBuilder stringb = new StringBuilder();
int intgerValue = 110;
string stringValue = "Apple";
Boolean BooleanValue = true;
stringb.AppendFormat("intger Value: {0}.string Value: {1} and Boolean Value: {2}", intgerValue, stringValue, BooleanValue);
Label1.Text = stringb.ToString();
}
Output-
Comments
Post a Comment