dbruzzone79
asked on
using __doPostBack to fire linkbutton server-side event within an updatepanel postback
i have a linkbutton in an updatepanel with a server-side event tied to the Click event of the linkbutton. under normal circumstances this is fine, however, i would like to fire some client-side functions prior to the postback of the updatepanel. i figured the best way to do this is by calling __doPostBack myself within a simple javascript function. my problem is two-fold: one, the page is posting back twice and two, the server-side event isnt being fired. i realize that the linkbuttons's event isnt wired up but i am not sure how to do so. also, why would the page post back twice?
does this make sense or do you need more explanation?
does this make sense or do you need more explanation?
<asp:updatepanel id="actionUpdatePanel" runat="server">
<contenttemplate>
<asp:linkbutton id="takeActionAndSaveButton" runat="server" />
</contenttemplate>
</asp:updatepanel>
takeActionAndSaveButton.Attributes.Add("onclick", String.Format("ManualPostBack('{0}', '')", actionUpdatePanel.ClientID));
function ManualPostBack(postBackControlId, serverEvent)
{
__doPostBack(postBackControlId, '');
}
protected void takeActionAndSaveButton_Click(object s, EventArgs
{}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
joechina - i tried your suggestion and it resolved the double-post back issue but i'm still having problems with the server-side event. i abandoned that route for another alternative. thank you for the help.
ASKER