Solved

hyperlink with __doPostBack

Posted on 2008-06-16
7
1,052 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
  • 4
  • 3
7 Comments
 
LVL 13

Expert Comment

by:joechina
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

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

Expert Comment

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

Author Comment

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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.…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now