Solved

datatgrid

Posted on 2004-10-04
7
199 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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