Home SWOT Analysis How Strong U R? Articles About Us
Mahatma Gandhi Jawaharlal Nehru Bagat Singh Kamarajar Indira Gandhi

Oh Indian

In remembrance of the Independance day Aug 15, 2007

This site is dedicated to one and all who sincerely participated in freedom struggle. Let us try to fulfill their ambitions!
Skip Navigation Links

ASP.NET - Displaying only the required fields in Grid View


Eventhough we have a number of fields in the physical database table, for quite a many reasons, we want to display only a limited number of fields in the grid view. By default, when we assign the datasource and bind the control, the gridview displays all the fields in the output.

We need to use the following procedure to display only the required fields.

  1. Open the Properties window using GridView Tasks menu and select Edit Menu.
    Choose GridView Tasks
  2. See the following screenshot for your reference. Make sure to remove the tickmark of the Auto-Generate Columns.
    Add a new field and set the HeaderText and DataField property
  3. Choose the type of column you want to display like BoundField, CheckBoxField etc. and click Add button.
  4. Set the HeaderText and DataField properties.
  5. Repeat the above procedures (3 & 4) to add any required fields to the gridview.
  6. Make sure to assign the required datasource to the Gridview property through code. If you don't know how to do this, please refere to Listing of Records in Grid View.
  7. Run to view the result.
Comments from Users (0)
Leave a Reply
Name (Required)  
Mail (will not be published) (required)    
Website
 
Invalid Domain! (http://loveletters.oh-indian.com/blogs/20070912/32/asp-net-displaying-only-required-fields-in-gridview.aspx) You are not allowed member of our Sites for link exchange!