Link to home
Start Free TrialLog in
Avatar of kapes13
kapes13

asked on

ASP .NET Data grid binding question.

Hi I have a data grid which I bind a data table of 8 rows to via setting the grid's datasource with a Databind() statement.

Problem is, during the data bound event for the grid there are only 5 grid arguments.  Can someone explain why this is and what could be causing the grid to drop the other 3 rows during processing?  Any steps in the right direction would be great.

Avatar of Chris Bloom
Chris Bloom
Flag of United States of America image

did you check the pagesize of the gridview?

I am assuming you meant GridView rather than DataGrid (older .net control).


<asp:GridView ID="GridView1" runat="server" PageSize="10">
</asp:GridView>

Open in new window

Avatar of kapes13
kapes13

ASKER

Nope, it's a DataGrid, as I looked in my ASPX source file, maybe I should use a Gridview?  Too much bouncing around to keep focus on these controls!
Depends on what version of .NET you are running.  GridView is the successor to DataGrid.

see this article:  http://msdn.microsoft.com/en-us/library/05yye6k9.aspx

Either way, both controls have the "PageSize" property you can set.
Avatar of kapes13

ASKER

Thanks for that, I might try a Gridview as used in other projects but can you bind a DataTable directly to the Gridview, thought I wrestled with that for a few but not sure.
ASKER CERTIFIED SOLUTION
Avatar of Chris Bloom
Chris Bloom
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kapes13

ASKER

Well I have to rewrite all the custom columns for a GridView, so just going to stick to DataGrid for now and see about the binding array because of the data I have to pull into the custom controls at binding.  Just can't get why GridArguments has a different count than DataTable.  Probably something simple I overlooked.
Avatar of kapes13

ASKER

Paging manipulation does not help in this case.  I know it is the indexing, but I can't grasp what is going on in the DataGrid Arguments that limits the number of rows after I bound the DataTable to them, should be equal.

Have to come back to this tomorrow.  If anyone has any ideas or can post a sample (with custom columns in DataGrid) might knock this out.

Thanks.
Avatar of kapes13

ASKER

Okay I got back to this with an open mind and together with Chris taking time to assist and myself going over his materials I discovered that I could omit my bind event and allow the definition of my custom columns to receive the data directly during the DataBind.  All is well!  Moving on and thank you!