Did it happened so that you try to use __doPostBack javascript function but it didn't work?
__doPostBack - is a function which makes a postback to the server with an target element ID, and it should also fire the corresponding Event on server-side automatically. This is a very useful function.
Well there are several possible situations that I know where it doesnt work:
1) because you are passing an invalid ID;
2) you should use btnObj.ClientID for ASP.NET controls
3) because you are trying to call __doPostBack for a button that is placed on a page with Master Page or for a button that is inside an ASCX control.
The problem with the third one have gave me headache.
The problem there is that btnObj.ClientID is actually not the correct name of the element :) because it will return you and ID of: extreme_dev instead of the actual id extreme$dev which is correct.
This is why you should use btnObj.UniqueID instead.
So for example: __doPostBack(btnObj.UniqueID, '');
Good luck! :)
Please share this article!
20 comments:
wow, this was what I needed ... Excellent!
I am glad it helped you!
how to fix javascript__doPostBack in IE 7, when i tried to do a dropdown on intranet site but the dropdown list does not work.. it happened to 1 system only. i tried to uninstall Java, delete registry file and folder. Also reinstall IE7 but still dropdown list is not working. it just showing javascrip __doPostBack on the bottom left corner on IE7. can help on this..?
Hi bycoconut,
Sorry but I can't understand what the problem is exactly, could you please explain one more time?
is a text "__doPostBack" displayed somewhere on the page?
or something else?
If you can then send me an email with some more details, if you can: some code, screenshot... or something else that you think that could help me to help you :)
Regards,
Roman
my email: rgherman.blog@gmail.com
I also have a question to you about your blog, re visitors, seo (if you are doing that)
i've emailed to you Roman. Please check any time. Thanks =)
What is the object name required for an UpdatePanel instead of a button?
Hello,
First of all there should be an element which is causing a postback inside/outside the UpdatePanel.
So for the __doPostBack function you should pass that's elementId.
There should be a button/textbox/dropdown which is causing the postback, it is not the UpdatePanel that is causing it.
At least that is my understanding, please let me know if I am wrong.
Regards,
Roman
What is the connection string for my own PC no server and no password..........
What is the object name required for an UpdatePanel instead of a button?
Hi Bhashkar
An UpdatePanel can not trigger a postback by its own, you need to have a button, a dropdown, or something inside it.
Hi,
I am facing a strange issue. I have a asp:calendar in my master page.. i want to reload the asp:calendar from my content page.. I placed a hidden button on my master page, and on click of that i put
mycalendar.VisibleDate = DateTime.Now for reloading the calendar
and i call __doPostback(<>, '') ; from my content page.
it causes the calendar reload every second postback.. not working on every call.
that is i have some changes on 25th may on contentpage , and calling dopostback -the calendar rebinds but doesnot indicate 25th may.
then i make some changes on 27th may on my content page, and calling dopostback - the calendar rebinds, but indicates 25th may now.. if i again call dopostback, it will show 27th may..why this odd pbm comes?
can you please help?
Hi Anbarasan,
You probably need to rebind the calendar, there should be something like mycalendar.Refresh()/Rebind...
Hi, This is Charan...
Starting from today, I am facing problem with javascript:_dopostback in my ASP.NET web site built under .NET v2.0
This issue exists only in IE 7, the other browsers like IE 8 are working fine.
Issue Description: When ever I try to click on any link buttons which calls the postback... It prompts the _dopostback() error message in the status bar.
I am just passing a URL to the URLVD.
The same issue exist with all other control's which calls javascript..
Hi Charan,
is javascript enabled on your IE7 browser?
I have the same issue, When calling __doPostBack() fron DEV environment it works fine but when deploying in IIS7 on windows 7 It just skip the __doPostBack(), I am using the same machine for DEV and Server
Thanks
This article is very much engaging... I will forward it so many people who are interested in this sector..
excllent post
do like this
__doPostBack('<%= savebtn.UniqueID %>', "
Saved me there! I couldn't figure out why my postback wasn't working.
I still getting no postback event I tried both ClientID or UniqueID. By the way, thanks for your great sharing. May be I missing something
Post a Comment
your thoughts are welcome: