Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
In my aspx page i have static method.
I am not able to access any controls from static method
How can i access the controls inside that page
 
Thanks in advance,
Posted 26-Aug-11 20:32pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

How can you access some members from a non-static (instance) method? Never though about it? It it possible because the instance (object) having those instance members is passed to the call in the form instance.method(). In fact, instance reference is passed as an implicit parameter to method().
 
Are you getting a hint? All you need it to add an explicit parameter of the class type to the method and do nearly the same. But why doing it if there are instance methods? In some relatively rare cases it can be useful.
 
—SA
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you cant access nonstatic controls from a static method.
static methods can access static variables only..
 
if my answer is not correct then dont forgot to intimate me.... just leave a comment
  Permalink  
v2
Comments
RaisKazi at 27-Aug-11 3:12am
   
Agree. 5!

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 420
1 OriginalGriff 210
2 Kornfeld Eliyahu Peter 210
3 DamithSL 210
4 mukesh mourya 85
0 OriginalGriff 7,215
1 DamithSL 5,199
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,757
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 28 Aug 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100