Click here to Skip to main content
15,908,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all..
i have update panel like
ASP.NET
<asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:Timer runat="server" ID="UpdateTimer" Interval="10000" OnTick="UpdateTimer_Tick" />
    <asp:UpdatePanel runat="server" ID="TimedPanel" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="UpdateTimer" EventName="Tick" />
        </Triggers>
        <ContentTemplate>
 <div id="emplist" style="position: absolute; right: -55px; color: Red; background-color: Black;
                padding: 2px 14px; text-align: center; cursor: pointer; font-weight: bold;">
                EMP List
            </div>
            <div id="emplistsh" style="position: absolute; top: 32px; right: 4px; overflow: visible;
                z-index: 10000; margin-top: 5px; height: 300px;">
                <asp:Panel ID="pnllist" runat="server" Height="525px" ScrollBars="Vertical">
                    <asp:GridView ID="gridlist" runat="server" CellPadding="0" CellSpacing="0" AutoGenerateColumns="false">
                        <Columns>
                            <asp:TemplateField ShowHeader="false">
                                <ItemTemplate>
                                    <asp:Image ID="imgstatus" runat="server" ImageUrl="~/img/black.png" Width="15px"
                                        Style="padding: 1px; padding-top: 10px;" />
                                    <a style="removed: pointer; padding: 0px 1px 1px 1px;" target="_blank">
                                        <%# Eval("list")%></a>               
                                </ItemTemplate>
                            </asp:TemplateField>
                        
                        </Columns>
                    </asp:GridView>
                </asp:Panel>
      </div>
 </ContentTemplate>
    </asp:UpdatePanel>


and i was search a lot in Google finally i got script for apply jquery effects inside update panel script like
JavaScript
 function BindEvents()
{
     $(document).ready(function(){ // do something }); insteed of
          // $("#chatlist").hide(2000);
            $("#emplist").click(function(){
             $("#emplistsh").toggle(2000);
            });
     });

}

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(BindEvents);

and timer tick event goes like:

C#
protected void UpdateTimer_Tick(object sender, EventArgs e)
   {

       try
       {
           MySqlCommand cmd = new MySqlCommand("select e.firstname as list,replace(e.firstname,' ','') as headlist,e.empid,u.status,concat(firstname,' ',lastname) as fullname from employee e,usertable u where u.username=e.empid and e.empid!='" + Session["username"].ToString() + "' AND empstatus='0' order by firstname asc", con);
           MySqlDataAdapter da = new MySqlDataAdapter(cmd);
           DataSet ds = new DataSet();
           da.Fill(ds, "employee");
           gridlist.DataSource = ds.Tables["employee"];
           gridlist.DataBind();

       }
       catch (Exception ex)
       {
           // Response.Redirect("login.aspx");
       }
       finally
       {
           if (con.State == ConnectionState.Open)
               con.Close();
       }
   }


as it is working fine for some time after timer tick event runs it is getting back to original position i mean after clicking emplist it is hiding but after timer tick it is automatically showing employee so how can i hide "emplistsh"(div) permanently up to clicking on "emplist"(div) list.i was working on this for last 3 days. can any one help me please
thanks in advance...
Posted
Updated 26-Mar-12 2:28am
v2

Because the UpdatePanel is performing an out of band call to refresh the contents within it the document.ready event is not being fired.

Try this

C#
function BindEvents()
{
    $("#emplist").click(function(){
    $("#emplistsh").toggle(2000);
    });
}

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(BindEvents);
 
Share this answer
 
Comments
tulasiram3975 26-Mar-12 8:22am    
thank you for giving solution
it is firing sir. but after timer tick event the div is showing content it needs to hide until user click on div...
but this time also same thing happening sir...
i was correct the code like this then it will worked perfectly..
C#
$("#emplist").click(function(){
    $("#emplistsh").toggle(2000);
  
    vari++;
    if(vari==1)
     $("#emplistsh").hide();
     else if(vari == 2)
      {
      $("#emplistsh").show();
      vari=0;
      }
    });
    if(vari==0)
  $("#emplistsh").show();
  else if(vari==1)
    $("#emplistsh").hide();
    else if(vari==2)
      $("#emplistsh").show();
}

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(BindEvents);

JavaScript

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900