Solved

hyperlink with __doPostBack

Posted on 2008-06-16
7
1,061 Views
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.

Thanks,
Chi
0
Comment
Question by:ChiBella
[X]
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
7 Comments
 
LVL 13

Expert Comment

by:joechina
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?
0
 

Author Comment

by:ChiBella
ID: 21796667
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.
0
 
LVL 13

Accepted Solution

by:
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.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

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

Expert Comment

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

Author Comment

by:ChiBella
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:

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

Expert Comment

by:joechina
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?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 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