0

I have the following HTML in my MasterPage:

<input class="button" type="button" value="Select User" onclick='<%# string.Format(@"location.href={0}", ResolveUrl("~/SelectUser.aspx")) %>' />

I'm trying to figure out how to get ResolveUrl to work with an HTML input button, but no matter how I twist and turn it I can't get it right (meaning the click never redirects the page to SelectUser.aspx). I could use an ASP.NET Button, but then I'd have to monkey with my CSS and I really don't want to spend the time doing that.

Any help on how to go about doing this would be greatly appreciated. Thanks!

Jagd
  • 7,169
  • 22
  • 74
  • 107

3 Answers3

4

I use href like below and make sure that there is no runat="server" tag.

    href = "<%=this.ResolveUrl("~/abc.aspx")%>" 
DotNetUser
  • 6,494
  • 1
  • 25
  • 27
1

Either use an ASP.NET Button or make it runat"=server".

The Forgotten Controls: HTML Server Controls

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
0

ResolveUrl will only work if you call Page.DataBind() in your Page_Load

Richard
  • 33
  • 1
  • 4