Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
Hi all,

i have multiple gridviews(11) in 1 page.if gridview has many data then the user has to scroll down all the page.i dont want it happen like that way.it is not efficient right..then how to make the page can be pagination in order user can click 'next' or '1,2,3' if the page has many data.but if the data is small then there is no need for pagination.

please someone can help me.with code..i dont have any idea how to do it.
Posted

Hi frnd,

For your scenario you can implement in lot's of way:

1) you can use tab control and divide each grid in tab wise. Tab controls
2) you can also use view control for each grid will deride into each view.View control help

now you have to choose how u want to implement it.

hope this will help:)
 
Share this answer
 
Comments
RaviRanjanKr 5-Jan-12 15:29pm    
A suggestion :- Please avoid of using Short text speak words like u instead of using 'you' and 'frnd' instead of using 'Friend' :)
musiw 5-Jan-12 20:54pm    
hi patel,

currently im trying to use tab container.hope it will go smooth..

do you know how to create gridview dynamically.the gridview that we usually use is only column that available.this time i want to create a gridview like a table.

example:

Column0 | Column1
Row0 Databound | Databound

Row1 Databound | Databound

is it possible?
Nigam Patel 5-Jan-12 23:20pm    
yes it is possible to create a gridview dynemically.

you can make Autocolumngenerated Property true for gridview.
So it will generate column as per datatable Column.
hope it will help:)
musiw 6-Jan-12 3:23am    
i try search the code how to create the gridview dynamically.but i found nothing.do you know where i can find it?i dont know how to customize gridview turn to be the one i want..
musiw 6-Jan-12 4:15am    
sorry for the question.i already manage to customize it.

but now the problem is i want to bind the data to gridview.there is 2 different data will display in the column.each of data has its own ID in the same table db.how can i bind 2 data which has different ID in the same gridview?i already done that but the second data is display in the both column.seems like gridview bind the last data.

SqlDataAdapter sqlcom0 = new SqlDataAdapter("select no_of_train from transshipment where id_transshipment =1", myConnection);

DataSet ds0 = new DataSet();


sqlcom0.Fill(ds0, "transshipment");
gd_transshipment.DataSource = ds0.Tables["transshipment"].DefaultView;

gd_transshipment.DataBind();



SqlDataAdapter sqlcom10 = new SqlDataAdapter("select no_of_train from transshipment where id_transshipment =2", myConnection);
DataSet ds10 = new DataSet();
sqlcom10.Fill(ds10, "transshipment");
gd_transshipment.DataSource = ds10.Tables["transshipment"].DefaultView;
gd_transshipment.DataBind();
you can use AJAX Tab Container control. In each of the tabs you can distribute the data. you can CSS for better display.
check these links about Tab Container.

Tabs[^]

ajax tabcontainer and tabpanel[^]

Tab Container[^]
 
Share this answer
 
Comments
musiw 5-Jan-12 0:05am    
ok..so u are suggesting me using tabcontainer..ok interesting..

but if one of the tab which there is a case gridview is empty because the report is not there..so the tab will appear empty?then user proceed to click next tab which has report..

or any other idea?
Nigam Patel 6-Jan-12 0:18am    
you can also change the logic like if Grid is emplty then disable the Tab? ( if you only display data then you can Apply this logic)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900