Last post Sep 30, 2009 05:55 AM by bloggernext
Sep 18, 2009 05:39 AM|bloggernext|LINK
I have added blank rows in gridview(through footer), but the rows are added at the end of the grid.
so i would like to add rows dynamically at any position just like we achieve it in excel, but by adding rows through a button outside the gridview.
So if you have any idea how this can be achieved do help me out.
as.net 2.0 C# GridView
Sep 18, 2009 11:51 AM|karthicks|LINK
hi, in the grid datasource datatable, do like below
then just rebind the grid with the dataset
Sep 23, 2009 10:20 AM|bloggernext|LINK
thankyou for the reply.
excuse for the delay
do excuse me if i sound naive i am novice to asp.net.
i tried what u said but if there issituation if there are 255 rows and columns(in the database i mean) then how to bind all these elements to the grid.
asp .net 2. 0 C#GridView
Sep 24, 2009 09:42 AM|Qin Dian Tang - MSFT|LINK
It is no matter how many rows or columns you have, what you need to do is like what the above solution is. Return data into a DataTable and insert new DataRow (empty data) into DataTable and rebind it to GridView. If you don't like the GridView makes too
long due to the huge data source (255 rows), you can do paging in GridView. Just remember insert new row into the data source of GridView, not directly create a GridViewRow into GridView which is hard to implement.
Some basic implementation of GridView can be found in the tutorial of this site:
Sep 29, 2009 05:59 AM|bloggernext|LINK
thanks for the reply.
did what u said but for the part where u advised me to use i have used vertical and hoirzontal toolbars like in excel.
but the problem that i am facing is i want the toolbars to work something like this:
*When i drag the vertical or horizontal tollbars that is when i want the rows and columns to be created at runtime or else only 10-15 rows or columns must be visible at all times.
*If there is data written in lets say 70th row the when u get the control back to the first column or row it should show all the 70 rows and columns if data is erased or deleted let's say then only 10-15 (default rows) must be shown.
is this achievable.
Sep 29, 2009 06:47 AM|vijayst|LINK
Paging is a better solution than scrollbars. If you want to insert a blank row in the 70th row, insert a empty row in the datatable at 70th row, set the pageindex of gridview to say 7, and rebind the gridview. This will automatically take you to the page
where the blank row is inserted.
Sep 30, 2009 05:55 AM|bloggernext|LINK
thnx for the reply
thnx in advance.
asp.net 2.0 c#(Gridview)