Building the Membership List Page

Building the Membership List Page

To build a Membership List page for an ASP.NET web application, you can use the GridView control to display a list of users, along with their membership information.

Here are the steps to build a Membership List page:

Create a new web form in your application called “MembershipList.aspx”.

Drag and drop a GridView control onto the page from the Toolbox in Visual Studio.

Configure the GridView control by setting its properties. For example, you can set the DataSourceID property to the ID of a SqlDataSource control that retrieves user information from the membership database.

<asp:GridView ID=”GridView1″ runat=”server” DataSourceID=”SqlDataSource1″ AutoGenerateColumns=”False”>

  <Columns>

    <asp:BoundField DataField=”UserName” HeaderText=”Username” />

    <asp:BoundField DataField=”Email” HeaderText=”Email” />

    <asp:BoundField DataField=”CreateDate” HeaderText=”Join Date” DataFormatString=”{0:d}” />

    <asp:CheckBoxField DataField=”IsApproved” HeaderText=”Approved?” />

  </Columns>

</asp:GridView>

<asp:SqlDataSource ID=”SqlDataSource1″ runat=”server” ConnectionString=”<%$ ConnectionStrings:MembershipConnectionString %>”

  SelectCommand=”SELECT UserName, Email, CreateDate, IsApproved FROM aspnet_Users ORDER BY CreateDate DESC”></asp:SqlDataSource>

Customize the appearance of the GridView control by adding CSS styles or other markup to the page. Test the page by running the application and navigating to the “MembershipList.aspx” page. You should see a list of users with their membership information displayed in the GridView control.

Apply for ASP.NET Certification Now!!

https://www.vskills.in/certification/certified-aspnet-programmer

Back to Tutorial

Get industry recognized certification – Contact us

Menu