I have a asp Textbox control in my .aspx page. I have a .cs class file , not the code behind file. I want to access this textbox control in this .cs file. I know I can pass it as a parameter.But I’m curious to know if I can do it through some reference way or something.
Share
There is another scenario.
If you have a .cs page like
BasePage.csthat inherits fromSystem.Web.UI.Page, and if your code-behind class inherits from this BasePage, then in the BasePage.cs you can gen a reference to your textbox through FindControl:But in a totally unrelated class it’s as you suspected, the only way is to pass it as a parameter.