You must Sign In to post a response.
  • Category: JQuery

    How to fire jQuery event after postback?

    Are you looking for information on jQuery? Want to know how to fire jQuery event after postback? Read this thread to learn more about jQuery with examples.

    Hi friends,
    I have a DashBoard Page in ASP.Net with C#, Which contains a timer control wchich call page every 25 Sec. I have an image button for any new alert.
    First time when page Load it works. It means clicking on image button, its dril down a DIV & LINK button, but it works only once, after Page refresh (By timer control), it does not work.
    Here is inline code.
    <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">

    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />


    <script src=""></script>
    <script type="text/javascript">

    $("#<%=this.bellIMG.ClientID %>").click
    function (event) {

    //$("#mydiv").css({ visibility: "visible" })
    $("#<%=this.mydiv.ClientID %>").css({ visibility: "visible" })
    $("#<%=this.mydiv.ClientID %>").fadeToggle()


    <div id="mydiv" runat="server" style="width:150px height:350px background-color:#d2edca z-index:1 position: absolute visibility:hidden margin-left:110px overflow:scroll" >


    <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="25000"></asp:Timer>

    And CODE BEHIND Code is......

    protected void Page_Load(object sender, EventArgs e)
    if (!IsPostBack)

    private void BIND_BELL()
    DataSet DS = new DataSet()
    lblTKTING.Text = "Ticketing Alert:"
    if (con.State == ConnectionState.Closed)
    OracleDataAdapter ODA = new OracleDataAdapter(QRY, con)
    if (DS.Tables[0].Rows.Count > 0)
    bellIMG.Visible = true
    for (int i = 0 i < DS.Tables[0].Rows.Count i++)
    LinkButton Bell_lnk = new LinkButton()
    Bell_lnk.ID = "Bell_lnk_" + i.ToString()
    Bell_lnk.Text = DS.Tables[0].Rows[i]["DUTY_ID"].ToString()


    //Bell_lnk.Attributes.Add("onclick", "BELL_LNK_click(" + Bell_lnk.Text + ")")

    Bell_lnk.Attributes.Add("onclick", "BELL_LNK_click(" + Bell_lnk.Text + ")" + this.Page.ClientScript.GetPostBackEventReference(Bell_lnk, "").ToString())
    bellIMG.Visible = false
    lblTKTING.Text = "Ticketing Alert: 0"
    catch (Exception ex)

    protected void Timer1_Tick(object sender, EventArgs e)
  • #725249
    Hi LuckyIBM,
    This issue occur because your placement of the code for event fired gets wrong after page gets refreshed.
    For resolving this issue write your event as follows:

    $(document).on("click","id or class of your image button",function(){write your respective code});

    This function scans entire document for the particular item you provided and binds provided event.
    Remember write this code outside of document.ready function.

This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.