Solved

datatgrid

Posted on 2004-10-04
7
184 Views
Last Modified: 2010-05-19
can somebody tell me how to dynamically change the number of rows in a datagrid based on a value entered by the user
thank you in advance
0
Comment
Question by:yalamanchir
7 Comments
 
LVL 2

Expert Comment

by:fulp02
ID: 12221931
Take the user's Input and go through the data set that many amout of times and copy the values one by one that you want to enter ! Hope that helps sorry I can not be more presice !
Good Luck . FuLP
0
 
LVL 9

Expert Comment

by:noulouk
ID: 12221967
Hi yalamanchir,

What do you mean exactly by "change the number of rows" ?

Is it paging problem ?
If so, modify the datagrid page size with the user value and (re)bind datas.

Or a data problem ?
Then , when you (re)bind datas, modify the filter of your dataview considering the user value.

Hope this will help you.
Regards.
0
 

Author Comment

by:yalamanchir
ID: 12222178
i want to have textbox for the users to enter a number... and if they enter 10
i want to populate that many rows in my datagrid
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 8

Accepted Solution

by:
gregasm earned 200 total points
ID: 12223541
You set the datasource to a table perhaps, right?

then you should add rows the the underlying datatable, and that will "add" rows to the datagrid.

public function addrows(numrows as integer)

        Dim table As DataTable = CType(DataGrid1.DataSource, DataTable)
        For i As Integer = 1 To numrows
            Dim row As DataRow = table.NewRow
            table.Rows.Add(row)
        Next i
    End Sub
0
 
LVL 19

Assisted Solution

by:arif_eqbal
arif_eqbal earned 300 total points
ID: 12224086
You can not change the Number of Rows in the DataGrid directly.
The Datagrid shows the number of rows based on the underlying dataTable
So in case you want to modify the Number of Rows you'll have to modify the Number of rows in the Underlying Table

0
 
LVL 6

Expert Comment

by:PreachDotNet
ID: 12227896
You will need to update your sql to pull just the number of records you want ie
"SELECT TOP " & CInt(TextEntry.Text) & " * FROM tblCustomer WHERE ......... "
Dont forget to rebind your datagrid to update the changes
0
 
LVL 8

Expert Comment

by:gregasm
ID: 12303433
What's up with the C?
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now