how to get javascript value in pageload

Detect acrobat reader installed in client machine. I have to check this in page load. I have hidden field in .aspx to get the return value. 

I had used page.registerstartupscript to execute javascript. I can execute the script but i can't retrieve the return value.

I can get the value only by using  _doPostBack("hidAcrobat","1");

I need the retrieve the value without page refresh.

 Can you please suggest regarding the issue.








4/11/2007 5:37:27 AM 91979 articles. 3 followers. Follow

7 Replies

Similar Articles

[PageSpeed] 5

declare your hidAcrobat hidden variable in aspx file like bellow.
Line1. <input type="hidden" runat="server" id="hidAcrobat">

 after post back you can read the value of hidden variable in cs file using

Line2. String value = hidAcrobat.Value();

 If you are using the visual studio. if you write the line1 in aspx page automatically in cs file a variable hidAcrobat will be created of type System.Web.UI.HtmlControls.HtmlInputHidden

if you are not using the visual studio, you have to write it explicitl like

Protected WithEvents hidAcrobat As System.Web.UI.HtmlControls.HtmlInputHidden

Please mark as answer if my post is useful and Please correct me if I am wrong anything here.
4/11/2007 9:53:39 AM

Thanks duttavr ...

I used same us mentioned below:

<input type="hidden" runat="server" id="hidAcrobat">

 after post back you can read the value of hidden variable in cs file using

Line2. String value = hidAcrobat.Value();
But in page load i can't get th string value in hidden text at the first time. If i use dopostback in javascript i can get the value.
Can you suggest regarding this... it will greatful to you.
Thanks & regards,


4/12/2007 10:20:17 AM
At first time the hidden control witch you have created does not contain any value.
So assign your required value before post back. Find the code bellow.
<%@ Page Language="vb" AutoEventWireup="true" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication11.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="">
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
			<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
			<input type="hidden" runat="server" id="aaa" size="21">
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
hidAcrobat.Value = "Hello" End If
End Sub

Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = hidAcrobat.Value
End Sub

Please mark as answer if my post is useful and Please correct me if I am wrong anything here.
4/17/2007 9:29:26 AM

 hi karnan!

had you resolved this problem, i have a trouble same you and read this post but can not help yet.

if yours is working, can you tell me the way?

thanks advance.


11/26/2007 1:10:30 AM

Hi All,

I am new to .Net. I am converting a source which is in .net 1.1 to .net3.5.

In 1.1 those people had used scritps for calendar popup.

Let me show the sample code first

In JSCalendar.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JSCalendar.aspx.cs" Inherits="JSCalendar" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >

<head runat="server">

<LINK href="cal/popcalendar.css" type="text/css" rel="stylesheet">

<title>Test Calender</title>

<script language="javascript" src="cal/popcalendar.js"></script>

<script language="javascript">

function test()



var strValue = document.getElementById('txt_Date').value;


if (strValue != '')



var strarr = strValue.split("/");


strValue = strarr[1] + '/' + strarr[0] + '/' + strarr[2];


var d = new Date(strValue);

var d1= d.getDate();


d1 = d1 + 3;



var Month = d.getMonth();


Month = Month + 1;


strMonth = Month + "";

if(strMonth.length == 1)

Month = '0' + Month;


var strDay = d.getDate() + "";

if(strDay.length == 1)

strDay = '0' + strDay;



document.getElementById('txt_Date1').value = strDay + '/' + Month + '/' + d.getFullYear();






<form id="form1" method="post" runat="server">


<TABLE id="tbl_control" cellSpacing="0" cellPadding="0" border="0">


<TD align="right"><asp:label id="lbl_Date" Font-Bold="true" runat="server">Date :</asp:label></TD>

<TD align="center" style="width: 107px"><asp:textbox id="txt_Date" runat="server" Columns="6" Width="99px" OnTextChanged="txt_Date_TextChanged"></asp:textbox></TD>

<TD><asp:image id="imgCalendar" runat="server" ImageUrl="cal/calendar.gif"></asp:image></TD>




<td></td><td style="width: 107px"></td>




<TD align="right"><asp:label id="lbl_Date1" Font-Bold="true" runat="server">Date 1 :</asp:label></TD>

<TD align="center" style="width: 107px"><asp:textbox id="txt_Date1" runat="server" Columns="6" Width="99px" OnTextChanged="txt_Date1_TextChanged"></asp:textbox></TD>




<br />





In JSCalendar.aspx.cs



using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class JSCalendar : System.Web.UI.Page


string scriptStr = null;

protected void Page_Load(object sender, EventArgs e)


string scriptStr = "javascript:return popUpCalendar(this," + getClientID() + @", 'dd/mm/yyyy', '__doPostBack(\'" + getClientID() + @"\')')";

imgCalendar.Attributes.Add("onclick", scriptStr);


#region Web Form Designer generated code

override protected void OnInit(EventArgs e)



// CODEGEN: This call is required by the ASP.NET Web Form Designer.





/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()


this.Load += new System.EventHandler(this.Page_Load);



// Get the id of the control rendered on client side

// Very essential for Javascript Calendar scripts to locate the textbox

public string getClientID()


return txt_Date.ClientID;


// This propery sets/gets the calendar date

public string CalendarDate




return txt_Date.Text;




txt_Date.Text = value;



// This Property sets or gets the the label for

// Dateselector user control

public string Text




return lbl_Date.Text;




lbl_Date.Text = value;



protected void txt_Date_TextChanged(object sender, EventArgs e)


//Iam tring to print the value





What I am going to do is:

1. calling js for calendar popup and selecting the date.

2. With the date selected I am printing it in the testbox.

3. After getting the date I am calling a function test() in js which will execute in aspx file and will take the value of selected date and will add 3 days more to it and it will print it in another textbox (txt_Date1).

upto now it is ok... I am getting what I am expected.

Now, the problem started for me... when a value or some data is changed in txt_Date... I am calling a method in aspx.cs file called txt_Date_TextChanged. Here I want to access the values of txt_Date and txt_date1 and also I want to print the values of txt_Date and txt_date1.

 I am unable to go into txt_Date_TextChanged. I had kept a break point there. I am not going in to the method.

Please help me...

Thanks in advance.......


12/27/2008 6:09:02 PM


The TextChanged event is raised when the content of the text box changes between posts to the server. 

JScript does not support events. So if you are changing the value of your text in JS its not going to fire the event.

Courage is the zone of exploration, accomplishment, fortitude, and determination.

Mark as Answer if issue is resolved.
12/31/2008 7:35:52 AM

 try setting autopostback=true on txt_Date.

Zeeshan Umar

~ Please Mark as Answer if it solves your query ~
12/31/2008 8:08:57 AM

Similar Artilces:

Developed WebService 1.1 for Client 1.1. Getting error "Server was unable to process the Request" Pls Help
Hi., I developed Microsoft Web Services2003 for the Client Application 2003. When it runs in 5 machines it gives good performance and has no errors. But if i run the same application in about 80 client machines. Getting error "Server was unable to process the request". I use Sql Server 2005 as my database. I get error even when i login at a time for about 25 users. Tried modifying machine.config too. But went unsuccessful. Live Server is 2003 using IIS 6.0 I use very expensive data handling.  Its very urgent pls help. Have to post in Live Server. Thank u., ...

Getting Xml tag values into
hi in my application i have the xml file ( ImageType.xml ). it contains some string values. <ROOT> … <SupportedDataTypeList>             <ImageDataType value="XAImage" value_type="string"/>             <ImageDataType value="CTImage" value_type="string"/>             <ImageDataType value="USMultiFrameImage" value_type="string&q...

used a to converter and am now getting a syntax error.
ok I used a cool utility at to convert some to and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line ...

Get values set by javascript to .net enabled textbox
I have a bit of javasript that writes a value to a text box.  The text box is read only. Textbox code:<input type="text" id="txtColor1" runat="server" readonly="readonly" size="6" /> Snippet from javascript functioncolorBox = document.getElementById('<%= txtColor1.ClientID %>');colorBox.value = colorCode;  Code behind:string color1 = txtColor1.Value Whenever I attempt to get the value out of the text box after it has been changed by the javascript, it always reverts back to the old data and not the new. Anyo...

Sending SMS using or using or
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

get html textbox value in behind)
  i am new to Can anybody say how to get Input textbox value in b4 sending answer Thankx  string value = Resquest.Form["textboxname"].ToString(); Hi,There are two ways to access it. 1) Make it runat="server" and access it in code behind like textbox1.value2) Another way is by using     Request.Form["textbox1"].ToString(); I hope this will be helpful to you.Thanks, Alpesh DhaneshaPlease don't forget to "Mask as Answer" if it helped. just add runat =server to html  ...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Getting Start With .net
hi i'm intersted to learn (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

getting started in VS2005 C# which book should I get
Hello, I am getting started with VS2005, I have use VS2003 but not very much -(I did 4 small applications in it),  I am wondering which book you would recommend to learn the new features of VS2005, while learning more of C# programing in general There some links to good books in this thread i posted : Also these two make good reference material  Professional Visual Studio 2005 (Programmer to Programmer)   Microsoft Visual Studio 2005 Unleashed  So far I recommend Wrox's C# 2005  Read the beginning chap...

I am not getting my mail open on my net as net is running
Name: Email: rmbala91atgmaildotcom Product: Firefox Summary: I am not getting my mail open on my net as net is running Comments: My mail is not getting opening. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20100401 Firefox/3.6.3 From URL: Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

How to get RS (From VB6) to .NET (VB.NET)
Hi Friends,         I have requirement, there is one function in VB6 it returns a RS, I need to call that function in  VB.NET, how to get those values into .NET, if can any body can help (pass me some code snippets), that will be greate, Thank you.Madhu... -Madhu hey guys i got this one just by using fill method.-Madhu...

Getting error in Net::SFTP with get function
------=_Part_7028_3315294.1193837808284 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi All, I have the following code as part of my program; print "---=========> $file, $localFile\n"; $sftp -> get( $file, $localFile ) || warn("errrrr0rrrrr _---> $!".$sftp->status."\n");^M Even though it has downloaded the file properly, it is giving the following message: ---=========> /trading/tiscrdenhlist10310000.txt.old, /export/home/crdadm/rajeev/tiscrdenhlist103...

How do I get started with AJAX.Net?
Hi All, I'm a seasoned developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

Web resources about - how to get javascript value in pageload -

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

Lightbox (JavaScript) - Wikipedia, the free encyclopedia
On a Lightbox-enabled page, a user can click an image to have it magnified in a Lightbox window, which resizes itself according to the size of ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
about dmoz - help Top : Computers : Programming : Languages : JavaScript : Tools : Obfuscators Tools for obfuscation/compression JavaScript code. ...

Facebook File-Transfer App Pipe Relaunches, Now Works Via JavaScript, WebRTC
... allowed Facebook users to send and receive files up to 1 gigabit in size. A new version of Pipe debuted Monday, and the app now works via JavaScript ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

JavaScript SDK - Facebook-Entwickler
Overview The JavaScript SDK provides a rich set of client-side functionality for accessing Facebook...

Senior Front-End Developer (Javascript and AJAX)
Company: Sometrics Category: Software Development Location: Los Angeles, CA How to Apply: Description: We are looking for ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken .… ...

Resources last updated: 1/5/2016 12:09:46 PM