Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There is a button in vew.aspx . I want to access that button in my ControlModel.cs . But the application is designed in a way that they both have no knowledge of each other . How can I access the button in my Control class.
Posted

1 solution

First declare one variable as object Globaly.

and write in view.cs as--

object b;
object but;

foreach(object b in this.Controls())
{
if (TypeOf(b) == Button)
{
but Button = CType(b, Button);
// here pass but to global variable. if ur variable is butctrl then
butctrl=but
}
}

Now in ControlModel.cs
u can get butctrl as ur button from view.aspx.
 
Share this answer
 
Comments
rajh7 21-Nov-11 9:33am    
First declare one variable as object Globaly? which class do I put this code in and where exactly?
Manisha Tambade 21-Nov-11 9:45am    
if ur ControlModel file added as module then declare there,else add one module
in project and declare there.
Manisha Tambade 21-Nov-11 9:51am    
if u hv any class where all variables common or accessible to all project are stored,declare there.

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