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 }); }
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="JobId" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="JobId" HeaderText="JobId" InsertVisible="False" ReadOnly="True" SortExpression="JobId" />
<asp:BoundField DataField="JobName" HeaderText="JobName" SortExpression="JobName" />
<asp:BoundField DataField="AboutJob" HeaderText="AboutJob" SortExpression="AboutJob" />
<asp:BoundField DataField="Salary" HeaderText="Salary" SortExpression="Salary" />
<asp:HyperLinkField DataNavigateUrlFields="JobId" DataNavigateUrlFormatString="Default2.aspx?JobId={0}" HeaderText="Click to view " Text="details" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [JobId], [JobName], [AboutJob], [Salary] FROM [AddJob]"></asp:SqlDataSource>
</div>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="JobId" DataSourceID="SqlDataSource2">
<Columns>
<asp:BoundField DataField="JobId" HeaderText="JobId" InsertVisible="False" ReadOnly="True" SortExpression="JobId" />
<asp:BoundField DataField="JobName" HeaderText="JobName" SortExpression="JobName" />
<asp:BoundField DataField="AboutJob" HeaderText="AboutJob" SortExpression="AboutJob" />
<asp:BoundField DataField="Experience" HeaderText="Experience" SortExpression="Experience" />
<asp:BoundField DataField="Qualification" HeaderText="Qualification" SortExpression="Qualification" />
<asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
<asp:BoundField DataField="FunctionalArea" HeaderText="FunctionalArea" SortExpression="FunctionalArea" />
<asp:BoundField DataField="Salary" HeaderText="Salary" SortExpression="Salary" />
<asp:BoundField DataField="Contact_person" HeaderText="Contact_person" SortExpression="Contact_person" />
<asp:BoundField DataField="Contact_Person_Numer" HeaderText="Contact_Person_Numer" SortExpression="Contact_Person_Numer">
<ControlStyle Width="10px" />
<ItemStyle Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="Email_id" HeaderText="Email_id" SortExpression="Email_id" />
<asp:BoundField DataField="Work" HeaderText="Work" SortExpression="Work" />
<asp:BoundField DataField="company_name" HeaderText="company_name" SortExpression="company_name" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [AddJob] WHERE ([JobId] = @JobId)">
<SelectParameters>
<asp:QueryStringParameter Name="JobId" QueryStringField="JobId" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="JobId" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="JobId" HeaderText="JobId" InsertVisible="False" ReadOnly="True" SortExpression="JobId" />
<asp:BoundField DataField="JobName" HeaderText="JobName" SortExpression="JobName" />
<asp:BoundField DataField="AboutJob" HeaderText="AboutJob" SortExpression="AboutJob" />
<asp:BoundField DataField="Salary" HeaderText="Salary" SortExpression="Salary" />
<asp:HyperLinkField DataNavigateUrlFields="JobId" DataNavigateUrlFormatString="Default2.aspx?JobId={0}" HeaderText="Click to view " Text="details" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [JobId], [JobName], [AboutJob], [Salary] FROM [AddJob]"></asp:SqlDataSource>
</div>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="JobId" DataSourceID="SqlDataSource2">
<Columns>
<asp:BoundField DataField="JobId" HeaderText="JobId" InsertVisible="False" ReadOnly="True" SortExpression="JobId" />
<asp:BoundField DataField="JobName" HeaderText="JobName" SortExpression="JobName" />
<asp:BoundField DataField="AboutJob" HeaderText="AboutJob" SortExpression="AboutJob" />
<asp:BoundField DataField="Experience" HeaderText="Experience" SortExpression="Experience" />
<asp:BoundField DataField="Qualification" HeaderText="Qualification" SortExpression="Qualification" />
<asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
<asp:BoundField DataField="FunctionalArea" HeaderText="FunctionalArea" SortExpression="FunctionalArea" />
<asp:BoundField DataField="Salary" HeaderText="Salary" SortExpression="Salary" />
<asp:BoundField DataField="Contact_person" HeaderText="Contact_person" SortExpression="Contact_person" />
<asp:BoundField DataField="Contact_Person_Numer" HeaderText="Contact_Person_Numer" SortExpression="Contact_Person_Numer">
<ControlStyle Width="10px" />
<ItemStyle Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="Email_id" HeaderText="Email_id" SortExpression="Email_id" />
<asp:BoundField DataField="Work" HeaderText="Work" SortExpression="Work" />
<asp:BoundField DataField="company_name" HeaderText="company_name" SortExpression="company_name" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [AddJob] WHERE ([JobId] = @JobId)">
<SelectParameters>
<asp:QueryStringParameter Name="JobId" QueryStringField="JobId" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
Comments
Post a Comment