Reputation: 1269
I wonder if I can simulate the action of the button
(source: xonefm.com)
in this website by VB.NET code ?
http://www2.xonefm.com/hot10/index_in.aspx
Upvotes: 0
Views: 1857
Reputation: 415735
Is this your web site? If so, you can probably just call the click event for the button directly (assuming it causes a postback).
Are you scraping someone else's site? In that case, use a System.Net.WebClient
or System.Net.HttpWebRequest
object to send a similar request to the server that the browser would send if you click the button. There are two ways to find out what the request will be:
Upvotes: 1
Reputation: 7889
From server code you could use ClientScriptManager.GetPostBackEventReference which renders out a postback event reference heres a link on msdn http://msdn.microsoft.com/en-us/library/system.web.ui.page.getpostbackeventreference.aspx
heres a sample
Allows selecting gridview row without select column.
protected override void Render(HtmlTextWriter writer)
{
GridView g = GridView1;
foreach (GridViewRow r in g.Rows)
{
if(DataControlRowType.DataRow == r.RowType)
{
r.Attributes["onMouseOver"] = "this.style.cursor='pointer';this.style.cursor='hand'";
r.Attributes["OnClick"] = ClientScript.GetPostBackEventReference(g, "Select$" + r.RowIndex, true);
}
}
base.Render(writer);
}
Upvotes: 1