0

I have following markup in one of my asp.net pages.

<a href="javascript:__doPostBack('ctl00$ctl33$g_e246fa90_ed81_4990_9da8_88086176f196$Grid_Private_Pay','Sort$Created')">Created</a>

As you can see href contains javascript code, I want to execute this code in order to raise postback to server. I tried to trigger the click event of anchor tag but it seems to be not working. Is there any solution?

Thanks.

Vivek N
  • 991
  • 12
  • 22
Nikhil Chavan
  • 1,685
  • 2
  • 20
  • 34

1 Answers1

1

take a look at this comment on a similar post. I think it's what you're looking for.

<a id="someclientid" name="someuniqueid" href="javascript:void(0);" onclick="__doPostBack('someuniqueid', '');">val</a>

Then add the IPostBackEventHandler, and the anchors' __doPostBack statement will fire its RaisePostBackEvent method automatically for you.

Community
  • 1
  • 1
programndial
  • 157
  • 9