Link to home
Start Free TrialLog in
Avatar of ChiBella
ChiBella

asked on

hyperlink with __doPostBack

I am using a third party grid (obout) that has a limitation using a linkbutton in a grid cell to execute a postback. The linkbutton messes up whenever a sort of filter is executed on the grid. This happens when the grid is in callbackmode only. When the grid does a full postback, the linkbutton works just fine. This is a known issue that will be fixed in a future release they tell me.

The work around is to replace the linkbutton with a hyperlink containing a "__doPostBack". I'm not sure why this is a workaround. Can someone show me how to use a hyperlink to force a postback to execute a procedure in code behind which will query the database based upon the key field passed by the hyperlink?
Can't seem to find a working example of this anywhere.

Thanks,
Chi
Avatar of joechina
joechina

Try create a test page with only a standard linkbutton
Then open the page in browser then view source, you will something like.
<a id="LinkButton1" href="javascript:__doPostBack('LinkButton1','')">LinkButton</a>

Is this what you are looking for?
Avatar of ChiBella

ASKER

Maybe,

Are you saying the hyperlink with _doPostBack will look the same as a linkbutton? The grid will not work with a linkbutton for some reason.
ASKER CERTIFIED SOLUTION
Avatar of joechina
joechina

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes that's the issue but how do I implement the href do_postback in this case?
Use
<a id="LinkButton1" href="javascript:__doPostBack('LinkButton1','')">LinkButton</a>
instead of
<asp:LinkButton>...</...>
in your asp page
Well, there was more to it than that. You also have to capture the event and argument in code behind.  I did find an excellent example in case anyone else needs to know how to do this:

http://forums.asp.net/p/1252181/2317659.aspx

I now have another issue related to this. I have an ajax updatepanel wrapped around the collapsible panels and the grid and this appears to be slowing everything down. I tried wrapping just the link but it fails.
Updatepanel does have performance issue.
That's why lots of application is using REST style ajax call.
Can you try just wrap the whole grid instead of a part of it?