Solved

hyperlink with __doPostBack

Posted on 2008-06-16
7
1,055 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
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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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.…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 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