Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to generate _doPostBack even if no ASP.NET controls there?

Posted on 2008-11-13
2
Medium Priority
?
392 Views
Last Modified: 2013-11-08
Some of my aspx page have no controls on them, but I still want to wire some onclicks of html controls to the .NET 3.5 code using Request.Form["__EVENTTARGET"]. I've had this working great using this:

Page.GetPostBackEventReference(this);

This way, even if there are no .NET controls on the page, the _doPostBack function gets generated by .NET then I can use it on my html pages like onclick="_doPostBack(this,args).

Now it the compiler is telling me Page.GetPostBackEventReference is obsolete and have to use Page.ClientScript.GetPostBackEventReference, but I don't know how to get it working the same way it was. It has different parameters with types I haven't used before, like PostBackOptions. Can someone help with this so I tell .NET to ALWAYS spit out the _doPostBack javascript function on the page no matter what?
0
Comment
Question by:bemara57
2 Comments
 
LVL 9

Accepted Solution

by:
amx earned 1000 total points
ID: 22952266
This link should help you to understand how to use Page.ClientScript.GetPostBackEventReference

http://www.dotnetjohn.com/articles.aspx?articleid=221
0
 
LVL 7

Assisted Solution

by:moseack
moseack earned 1000 total points
ID: 22953070
I recommend also to read about IPostBackEventHandler, it's the interface that "listens" to _doPostBack().
http://aspadvice.com/blogs/joteke/archive/2005/09/26/12894.aspx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses
Course of the Month13 days, 1 hour left to enroll

579 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