Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
HI
I am developing a program which requires to read updated value of a Label control in updatePanel using javascript code please help

I am using following javascript code to do the same...
but not succeeded..some need some help
 

 
<script>
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
 
    function endRequestHandler()
    {
    var userID = '<%= Label1.Text %>';
        alert(userID);
        SelectSibling(event);
    }
</script >
</pre>
 

It returns the first value always....but I need the current value(updated Value)..
 
Thanks in Advance.
Posted 31-Jan-13 20:42pm
Comments
vinodkumarnie at 1-Feb-13 4:46am
   
can you share your source code...?
Raaj_007 at 1-Feb-13 5:23am
   
Here is the code <pre> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Test</title> </head> <body> <form id="frmGridView" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"/> <script type="text/javascript" language="javascript"> Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler); function endRequestHandler() { var userID = ""; alert(userID); SelectSibling(event); } </script> <asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional"> <asp:Timer ID="Timer1" runat="server" Interval="300" ontick="Timer1_Tick"> <asp:Label ID="Label1" runat="server" Text="Label"> <br /> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" /> </Triggers> </form> </body> </html> protected void Timer1_Tick(object sender, EventArgs e) { Label1.Text=(i++).ToString(); gridView.DataSource = GetDataSource(); gridView.DataBind(); } </pre>

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 447
1 OriginalGriff 430
2 Shai Vashdi 250
3 Emre Ataseven 165
4 Abhinav S 128
0 Sergey Alexandrovich Kryukov 8,894
1 OriginalGriff 5,200
2 Peter Leow 3,955
3 Maciej Los 3,535
4 Abhinav S 3,208


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid