Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8079083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:59:39+00:00 2026-06-05T15:59:39+00:00

I have two aspx pages: DashboardPreview.aspx: This is the homepage. It shows top 5

  • 0

I have two aspx pages:

  1. DashboardPreview.aspx: This is the homepage. It shows top 5 dashboards in a DataGridView. It shows other information too.

  2. DashboardList.aspx: It shows all the dashboards with pagination in a DataGridView.

There are several controls available for each dashboard (i.e. for each row of the DataGridView). For example: a dashboard can be “edited” and “shared” with other users.

I would like to code the DataGridView only ONCE.

Then, I would like to use that code in both the pages. How do I do it?

Note: I create DataGridView by dragging and dropping it from Toolbox of Visual Studio i.e. I did not code the entire thing myself. However, I did create controls like “Share” button myself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:59:41+00:00Added an answer on June 5, 2026 at 3:59 pm

    If you want to reuse a server control across pages then you need to create a User Control.

    To create a User Control:

    1. I would create a specific folder for user controls.
    2. Right click that folder and select “Add New Item” and then select User Control.
    3. Enter the GridView inside of that User Control

    Your User Control will look something like this:

    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="YourUserControlName.ascx.vb" Inherits="Controls_YourUserControlName" %>
    
    <asp:GridView ID="GridView1">
        <!-- Do you grid view stuff here -->
    </asp:GridView>
    

    To use a User Control you need to register it on the page you want to use it on. The code looks like this:

    <%@ Register Src="~/Controls/ucGrid.ascx" TagName="ucGrid" TagPrefix="uc" %>
    

    Then you would use it just like a server control.

    <uc:ucGrid ID="GridView" runat="server" />
    

    However, registering the User Control on every page can become tedious, so to make things easier you can register them in your web.config.

    <system.web>
      <pages>
        <controls>
          <add tagPrefix="uc" src="~/Controls/ucGrid.ascx" tagName="ucGrid"/>
        </controls>
      </pages>
    </system.web>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two pages, test1.aspx and test2.aspx test1.aspx has this protected void Page_Load(object sender,
I have a method which I have to use in two aspx pages. This
Among other, I have two pages in my Web Site project. Default.aspx and TeacherControlPanel.aspx.
I have two pages. One aspx page and the other an aspx page but
I have two pages, the parent and from this page I am using: window.open('OrderDetailsFull.aspx?ObjectID='
I have two pages, NonMember.aspx and Member.aspx. If a user comes to the site,
I have two pages that inherit from one master page, First.aspx or second.aspx. Navigation
I have two pages: Default.aspx and Target.aspx. On Default.aspx are two buttons: Button1 redirects
I have two pages page1.aspx and page2.aspx, both have code behind with partial classes.
I have two aspx pages i.e. default1.aspx and default2.aspx. Default1 contains some controls, tables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.