Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to access content page controls in a class file?

I invoked a method of .cs class file through page methods[static method] in code behind of contentpage.
Master is null,
content place holder is null,
How to get the controls of this content place holder into .cs class file>>>>?


Actually I want to fill the drop down list through a method in .cs class file, so just to hinder page post, 'm using page methods, hence I need those controls, any suggestion is appreciated
Posted
Updated 12-Dec-12 21:55pm
v2

1 solution

You should NEVER do this, because it breaks the separation of logic. You should pass data from your controls in to cs files, but not the controls themselves.
 
Share this answer
 
Comments
[no name] 13-Dec-12 3:54am    
Actually I want to fill the drop down list through a method in .cs class file, so just to hinder page post, 'm using page methods, hence I need those controls,
any suggestion is appreciated
Christian Graus 13-Dec-12 3:56am    
Your cs file should return the data and your page should put it in to the list.
[no name] 13-Dec-12 4:01am    
Thank you, but, I knew it, but my case is different, as I am using static method , I can't get UI controls of the page class in static method, so I am trying to fill the items from another class,
Christian Graus 13-Dec-12 4:08am    
Your page class has the UI controls. It can call a static method and pass in data. What you're saying makes no sense. The instance of a page class is the start and end of where your UI elements exist. It's not static. A non static class can call static methods on other classes.
[no name] 13-Dec-12 4:17am    
since the content is null, so I again tried to access in the method.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900