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 run array until at specified position, you can simply use copy ( ) method. In this method define some parameters. Like array name, index where you want to start from,ending index etc.<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Click"
BackColor="#99CCFF" />
<div>
<asp:Label ID="Label1" runat="server" BackColor="Yellow"></asp:Label>
</div>
</form>
Code behind code
protected void Button1_Click(object sender, EventArgs e)
{
{
string[] Fruits = new string[]
{
"Apple",
"Banana",
"Mango",
"Orange",
};
Label1.Text = "Fruits array: <br />";
foreach (string s in Fruits)
{
Label1.Text += s + "<br />";
}
int length = 3;
int index = 1;
string[] copiedarray = new string[length];
Array.Copy(Fruits, index, copiedarray, 0, length);
Label1.Text += "<br /> New array from Fruits array [index no 1 to 3]:<br />";
foreach (string s in copiedarray)
{
Label1.Text += s + "<br />";
}
}
OutPut-
Comments
Post a Comment