How to use gridview control in asp.net

/
0 Comments

The GridView control displays the values of a data source in a table. Each column represents a field, while each row represents a record.

GridView Located in ToolBox

Description :
Gridview Located under data tab in toolbox.

Drag from ToolBox

Description :
it shows the gridview as markup after drag and drop done from toolbox

Bind source into Gridview

Description :
Created the list with type of UserInfo object and added dummy values into that list. we need use DataSource property for set the data for display in the grid. after that we need call dataBind method.

Gridview in Browser

Description :
it is displayed all columns which are available from source

Markup with fixed columns for display

Description :
it will avoid to show unwanted columns in gridview and we need set the property AutoGenerateColumns as False. it will prevent the creation of columns with automatically.

Gridview after fixed columns in Browser

Description :
it will avoid to show unwanted columns in gridview

Add Paging for Gridview markup

in browser after AllowPaging property

Description :
we need set AllowPaging as true and pagesize as your wish.

Error throwing while Paging in Browser

Description :
Error occured while clicking the page number

Add Paging events for avoid error

use OnPageIndexChanging property

Description :
we need create a event with databind again for paging and need set OnPageIndexChanging as newly created event name.

Paging in Browser

Description :
it is working fine now.it is navigated to second page



You may also like

No comments:

Powered by Blogger.