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

Posted on 2008-11-13
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:


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?
Question by:bemara57
    LVL 9

    Accepted Solution

    This link should help you to understand how to use Page.ClientScript.GetPostBackEventReference
    LVL 7

    Assisted Solution

    I recommend also to read about IPostBackEventHandler, it's the interface that "listens" to _doPostBack().

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    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.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 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

    19 Experts available now in Live!

    Get 1:1 Help Now