Asp.Net Scrapping Grid Pages
Posted
by SH
on Stack Overflow
See other posts from Stack Overflow
or by SH
Published on 2010-05-05T23:58:00Z
Indexed on
2010/05/06
0:08 UTC
Read the original article
Hit count: 180
I need cod in C#.
Look, i am trying to post the search.aspx page which contains Asp.Net grid. When grid is rendered it loads very first page on the screen and then there are number of pages in the grid header.
I scrap first page, and now i want to move on to the next page. All this is being done using following code:
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://pubrec3.hillsclerk.com/oncore/search.aspx?" + param);
myRequest.Method = "GET";
myRequest.KeepAlive = false;
HttpWebResponse webresponse;
try
{
webresponse = (HttpWebResponse)myRequest.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream = new
StreamReader(webresponse.GetResponseStream(), enc);
string r = loResponseStream.ReadToEnd();
loResponseStream.Close();
webresponse.Close();
//if (GetRecordCount(r))
ExtractResultTable(bd, ed, r);
}
catch (Exception ex)
{
}
The above code grabs first page... and now i have to move on to the next page.
This is the link which produces a grid with 3 pages.
Using above code i need to load the 2nd page with the same search criteria but the records found in 2nd page. and then so on.
I know there is a trick to navigate through the grid pages. I used it but it did not work on this page. the trick is, you can pass __EVENTTARGET and __EVENTARGUMENT in query string to navigate through the gird but it does not work on this website.
I am desperately searching a way, how to cope with this website. i really want this done. i do not want any code but a way to nevigate throgh the grid using query string if it does work.
Otherwise please be specific to the problem.
© Stack Overflow or respective owner