Very urgent----GridView

csharp , db Kākināda, India
  • 13 years ago

    Hi experts,

    I have a GridView.In that data is populated from database.I am using dataset to bind the data.

    I have a dropdownlist above the Gridview.In that 10,20,30,All options will be there.

    when I select the value 10 from the dropdownlist.only 10 values have to appear in the gridview,if I select 20 then 20 values,if i select all then all the values has to be displayed.

    so I need code for this in C#..

    Thankyou so much for any replies.

     

     

  • 13 years ago
    hi,
     
    To show 10 rows, you have to fetch 10 rows. so to fetch n rows you can use following qyery.

    Select Top N * from Table_Name;
    eg.   Select Top 10 * from Table_Name;  (for 10 rows)
           Select Top 20 * from Table_Name;  (for 20 rows)

    In case of "All" option, you can use,
    Select * from Table_Name

    Now, once your data come in dataset. you can set its DataSource property to that dataset.


















Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programs must be written for people to read, and only incidentally for machines to execute.”