hyperlink with __doPostBack

Posted on 2008-06-16
Last Modified: 2012-06-27
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.

Question by:ChiBella
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 13

Expert Comment

ID: 21794561
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?

Author Comment

ID: 21796667

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.
LVL 13

Accepted Solution

joechina earned 500 total points
ID: 21798456
If you put <asp:LinkButton>, it will be rendered to html by ASP.NET runtime.
I am thinking your 3rd party control not rendering the control properly caused the issue.
So they ask you to put html instead of asp control by urself.
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.


Author Comment

ID: 21817668
yes that's the issue but how do I implement the href do_postback in this case?
LVL 13

Expert Comment

ID: 21818411
<a id="LinkButton1" href="javascript:__doPostBack('LinkButton1','')">LinkButton</a>
instead of
in your asp page

Author Comment

ID: 21822888
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:

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.
LVL 13

Expert Comment

ID: 21827217
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?

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Securing WEBAPI on Azure 2 55
Aspx calendar pop up control 3 37
Shared Service Environment 2 54
Ajax calendar distorted 4 17
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question