i have code like this:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server">
<asp:Button ID="btnSaveBooks" runat="server" Text="Save" CssClass="col-md-4 form-control" Width="8%" ForeColor="White" BackColor="#333333" OnClick="btnSaveBooks_Click" />
<asp:Button ID="btnActive" runat="server" Text="" OnClientClick="ohSnap('Task finished.', 'green');"/>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<div id="ohsnap"></div>
But how to active btnActive's OnClientClick in btnSaveBooks's OnClick event?
you can use this code to call JS function
in code behind
protected void btnSaveBooks_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(UpdatePanel2, UpdatePanel2.GetType(), "msgbox", "alert('FiveDot File uploaded successfully');", true);
}
1) Make client Id mode of button 'btnActive" static
ClientIDMode="Static"
2)Then in your 'btnSaveBooks_Click' Method use below Line
document.getElementById('btnActive').click(); return false;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.