By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,333 Members | 1,389 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,333 IT Pros & Developers. It's quick & easy.

how to get the variable from page_load

P: n/a
I am using ASP.net and C# as code behind.

I wrote one function in the "page load" (code behind) and how can i call
back the variable in the aspx page?

Thank you.

if i put response.write, error message prompted: "WebService1.WebForm10.aa'
is inaccessible due to its protection level"

So, how to solve it?

Thank you very much!!
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi.
I wrote one function in the "page load" (code behind) and how can i call
back the variable in the aspx page?


You wrote a function in the "page load"? then you speak about a variable --
what do you mean exactly?

If you want to store a variable for s session use the "Session"-object,
like:

String myVariableWhichIWantToUseInTheSession = "abc";
Session["SomeIdentifier"] = myVariableWhichIWantToUseInTheSession;
....
and to use it:
String myVariable = (String) Session["SomeIdentifier"];

// don't forget exception handling

I hope this helps you - your posting was not very clear.

--> Please use your real name.
hth,
Chris
Nov 13 '05 #2

P: n/a
"lsf_80" <li***@ytlesolutions.com> wrote in message news:<OE**************@TK2MSFTNGP10.phx.gbl>...
I am using ASP.net and C# as code behind.

I wrote one function in the "page load" (code behind) and how can i call
back the variable in the aspx page?

Thank you.

if i put response.write, error message prompted: "WebService1.WebForm10.aa'
is inaccessible due to its protection level"

So, how to solve it?

Thank you very much!!


I'm guessing that you declared the variable in the code behind as a
private variable. Private variables will not be available to the page,
since the page is not an instance of the code-behind class, but an
instance of a class derived from the code-behind class. If you declare
the variable as public or protected, it should work fine.
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.