OTM
asked on
passing variables from a class in app_code without using 'return' - asp.net c#
Hi,
How can i pass a variable such as a string or a no. from the class file to a webform control or the webforms codebehind file?
Can i use a session variable?
i cant use:
return variablehere;
as its used for another purpose already.. I hope this makes sense.
Thanks,
Sam
How can i pass a variable such as a string or a no. from the class file to a webform control or the webforms codebehind file?
Can i use a session variable?
i cant use:
return variablehere;
as its used for another purpose already.. I hope this makes sense.
Thanks,
Sam
You could use a Session variable, but it is a bit of a messy solution. Your other options are either a "ref" variable, or an "out" variable:
http://www.c-sharpcorner.com/UploadFile/mahesh/out_and_ref11112005002102AM/out_and_ref.aspx
http://www.c-sharpcorner.com/UploadFile/mahesh/out_and_ref11112005002102AM/out_and_ref.aspx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
A "getter" was exactly what i needed, i just needed a good example to learn from and now i've implemented this into my project.
Thanks
Thanks
http://msdn.microsoft.com/en-us/library/0f66670z(v=vs.71).aspx
-saige-