473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can i access variable of page_load

1
Expand|Select|Wrap|Line Numbers
  1. public  void Page_Load(object sender, EventArgs e)
  2.         {
  3.             string param1 = Request.QueryString["param"];
  4.             string param2 = Request.QueryString["param"];
  5.             string param3 = Request.QueryString["param"];
  6.  
  7.  
  8.             if (param1 != null)
  9.            { DateTime fromDate = DateTime.Parse(param1);}
  10.  
  11.             if (param2 != null)
  12.             { DateTime toDate = DateTime.Parse(param2); }
  13.  
  14.             if (param3 != null)
  15.             { string DeviceID = param3; }
  16.         }
  17.  
i want to use "fromDate, toDate and DeviceID" in another class how can access them from another class
Mar 22 '11 #1
1 1794
you neeed to declare the fromdate as public. in th other class just refrence the page_load as follows..
page_load myrefpage = new page_load();
myrefpage.fromdate //this is how you call the variable.

pay attention on how the state of the page_load is used. as my example above shows it involves instantiating a new page_load..you can try the static method so that you can reuse it
Mar 25 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ken Fine | last post by:
I have a Sub which defines a variable. I'm wondering if there's anyway I can get at that variable outside of the context of the Sub -- to pass the variable's contents to another page, for instance....
3
by: Barbara | last post by:
Is it possible in C# to merge two strings to access variable? (Like in JScript: document('variable'+200).style...) What I am trying to do is: I have a class Structure.cs I would like to create...
5
by: jeet_sen | last post by:
Hi, My external javascript test.js contains a variable definition var a = "Hello,world!!"; I dynamically loaded the script test.js using the following fucntion: function loadScript(url) { var...
1
by: kadapa22 | last post by:
hi all, i'm passing a variable from parent to child using showmodaldialog and i need to access the variable value (passed from parent) in child window. how can i do that? thnx
7
by: Boki | last post by:
Hi All, I want to change WindowState of form1 from form2. I tried these two methods, but no luck on both. (1) Declare a public method: /* function of form1 */ public void...
4
by: sdanda | last post by:
I am new to this. I am working on vb.net windows applications.I created a Main form named as Form1. In this project i added some more windows forms. I would like to access the variable in main...
1
by: Gernot Pfeifer | last post by:
Hello together, I have the the following problem (since hours of Google-Search)... I have an HTML-Page (I will call it "Mainpage") On this Mainpage, I have an iFrame. I would now the iFrame to...
3
by: LayneMitch via WebmasterKB.com | last post by:
Okay....now can anyone tell me why my 'document.write' command isn't reading the variables assigned to the cookie_info object through the readCookie() function? This is really teeing me off. ...
7
by: thesti | last post by:
hi, how to access a variable in a form from a different form? i have a DataSet variable in form1 which needs to be accessed by form2. when i type the exact name as the DataSet variable in...
1
by: Autostrad | last post by:
Below; I have 2 classes (forms), Namely, "PrintOneEmployee" and "DeleteOne". In class "PrintOneEmployee"; I want to declare a variable with name of "fileName" to contain the name of the file...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.