TwelvestoneBack End

IE / ASP.NET - # in anchor tags in a usercontrol


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
scudsucker
 
2010-02-09

I know there are not to many ASP.NET nerds here, but I'll try this:

I have a page which has a usercontrol embedded in it. The main page is in the root of the site, the usercontrol is in a folder, in the root, named "controls"

In the usercontrol there are a large number of HTML anchor tags inside a jquery tab-pane, with a runat="server" attribute

As they are in a tab-pane, I want the page to remain static (ie, no reload), and, I need the href to have a "hover" state. If I do not have an href attribute, all is fine except there is no "hover" state in IE

The code is list of anchor tags like this:

blah

The code-behind assigns them onclick events depending on circumstances. This works, except that when the page is generated, the href is removed completely.

Output:

blah

  • no hover state, and no "hand" cursor unless specifically set in the CSS for the element.

If I set the href to #

Output is

blah

  • which when clicked directs the browser to the controls/ folder, which is wrong

If I set the href to ~/#

Output is

blah

  • works OK.. but I'd like to be able to set the url to, say #games in order to activate the Jquery tab with id "games"

If I do this

I get

blah

Any clever ideas or workarounds?

Technomancer
 
2010-02-09

Try

blag

scudsucker
 
2010-02-10

That works, though I do not like it much! And it also does not allow me to set the tab to open (given tab id like "games", the jquery tab-pane will open the tab if the URL is changed to include #games)

But then, the HtmlAnchor.Attributes.Add("onclick","") is also not very pleasant IMO, as it adds inline JS anyway.

Perhaps the answer is to spit out some JS that sets the href and onclick on page load, rather than having the .NET generate them.

jamiec
 
2010-02-16

I use a rel attribute for all my jQuery-esque associations

blag

scudsucker
 
2010-02-17

Thanks - didn't know about the rel in this way.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneBack End

IE / ASP.NET - # in anchor tags in a usercontrol