crazyboybert
Programmer
Hi all
Is it possible to pass a control as a ref to a method of another class? For example..
I have tried the above but don't seem tobe able to pass a control. I guess you are only allowed to pass variables? Would make sense...Is there anyway other way to databind to a control on a webform from a method in a different class?
Cheers
Rob
------------------------------------
Go placidly amidst the noise and haste,
find what peace there may be in silence.
-Anon
------------------------------------
Is it possible to pass a control as a ref to a method of another class? For example..
Code:
public void fillList(ref System.Web.UI.WebControls.DropDownList myList){
//open a database connection and command object
myList.DataSource = myCommand.ExecuteReader();
myList.DataBind();
//close connection
}
then calling method above from webform
System.Web.UI.WebControls.DropDownList myList = new System.Web.UI.WebControls.DropDownList();
namespace.classname.fillList(myList);
I have tried the above but don't seem tobe able to pass a control. I guess you are only allowed to pass variables? Would make sense...Is there anyway other way to databind to a control on a webform from a method in a different class?
Cheers
Rob
------------------------------------
Go placidly amidst the noise and haste,
find what peace there may be in silence.
-Anon
------------------------------------