This project is read-only.

__doPostBack is not defined error

Topics: ASP.NET 2.0, Business Logic Layer
Jan 19, 2014 at 7:18 PM
I was trying to build a user control with datalist and buttons so noticed that it throws __dopostback undefined error.

Inorder to test the postback call I placed the below code in contact.aspx

<asp:Button id="btnTest" runat="server" Text="Test Postback" />

In code behind, added
if (!Page.IsPostBack)
            newid.Attributes["onclick"] = Page.ClientScript.GetPostBackEventReference(this, string.Empty);
Also I checked the viewsource code
<input type="submit" name="ctl00$cphBody$btnTest" value="Test Postback" onclick="__doPostBack('__Page','');" id="ctl00_cphBody_btnTest" />

Any idea why __doPostback is undefined.
Jan 20, 2014 at 11:33 AM
Any help?