Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Sir i am using this code which extracts data from a site. previously i saved the extracted data int oa csv file but now i want to show teh data in gridview . i have written that code taht shows data in to gridview . it is successfull. however i want paging facility in gridview like next and previous button. how can i achieve this ( just i searched PAGING ALLOW PAGING PROPERTY but it is not allowed in c# desktop applications)

C#
public partial class Form1 : Form
    {
        string location1, location2;
        public delegate void AddRowToGridViewDelegate(string r1, string r2);
        AddRowToGridViewDelegate addRowToGridViewDelegateobject;

        public Form1()
        {
            InitializeComponent();
            addRowToGridViewDelegateobject = new AddRowToGridViewDelegate(AddRowToGridViewfunction);
        }
        void AddRowToGridViewfunction(string r1, string r2)
        {
            string[] data = { r1, r2};
            dataGridView1.Rows.Add(data);
        }
void GetAllData2(string res2, string link2)
       {
           location1 = ""; location2 = ""; 
           try
           {
               string[] wh1 = Regex.Split(res2, "<div id=location><a href=\"index.asp\">");
               string[] wh3 = Regex.Split(wh1[1], ".asp\">");
               string[] wh4 = Regex.Split(wh3[0], "<");
               location1 = wh4[0].Replace(",", "");
           }
           catch { }
           try
           {
               string[] wh1 = Regex.Split(res2, "<div id=location><a href=\"index.asp\">");
               string[] wh3 = Regex.Split(wh1[1], ".asp\">");
               string[] wh5 = Regex.Split(wh3[1], "<");
               location2 = wh5[0].Replace(",", "");
           }
           catch { }

           string data = location1 + "," + location2;
           this.Invoke(addRowToGridViewDelegateobject, location1,location2);


thanks in advance
Posted
Comments
strogg 7-Jun-11 13:24pm    
There's no paging available for datagridview. And there's a good reason for it. Windows controls like datagridview are more powerful and can load tens of thousands of rows and still work fast. Web pages do not work well with so much data easily and therefore paging is employed to overcome the shortcomings. There's no point in asking for paging in a windows app. Sorting and searching also works in a snap with all the data present in one view. You have to realize the advantages.

1 solution

 
Share this answer
 
Comments
Espen Harlinn 7-Jun-11 16:01pm    
My 5, > 60K good work :)
thatraja 7-Jun-11 16:07pm    
Thank you.
:) But not enough, also only with less authority points :(

Looks like you are still busy with your work, huh?
Also couldn't see Jens too, he is inactive since last month starting.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900