Reputation: 340
I have an ImageButton1 and ImageButton1_Click event. The Image is clickable, and when i click on it the Event fires up...
Doing this works:
Response.Redirect("secondPage.aspx");
But, I would like to load it with :
ImageButton1.NavigationUr = "some url";
how can I have a dynamic link?
Upvotes: 0
Views: 433
Reputation: 9561
Try the ImageButton1.DescriptionUrl property. Set the url on runtime and redirect using the below code.
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect(ImageButton1.DescriptionUrl);
}
Upvotes: 1
Reputation: 226
Perhaps the HyperLink control would fit:
<asp:HyperLink ID="whatever" runat="server" ImageUrl="/foo.png" NavigateUrl="some url" />
Upvotes: 0
Reputation: 31
use firebug to find the exact id and attributes that are being set on the imagebutton (or set a cssClass for client-side access ease), and then use javascript or jquery to set the navigation attribute when you need to.
Upvotes: 0