G
gnewsgroup
I know that we can re-use/share code by placing the code in App_Code.
But, is it possible for MyPage.aspx.cs to call a method defined in
AnotherPage.aspx.cs?
Suppose, in AnotherPage.aspx.cs, we define a method which binds a
DropDownList to a database table. Let's call the method
BindDropDownList().
In MyPage.aspx, we are gonna use the same DropDownList. Is it
possible, in MyPage.aspx.cs, to simply instantiate AnotherPage and
call BindDropDownList()? Something like
// This is MyPage.aspx.cs
AnotherPage anotherPage = new AnotherPage();
anotherPage.BindDropDownList();
Does this sound whimsical?
I guess the answer is Nope, and we better write a generick-ish
BindDropDownList and stick it in a class under App_Code, right?
But, is it possible for MyPage.aspx.cs to call a method defined in
AnotherPage.aspx.cs?
Suppose, in AnotherPage.aspx.cs, we define a method which binds a
DropDownList to a database table. Let's call the method
BindDropDownList().
In MyPage.aspx, we are gonna use the same DropDownList. Is it
possible, in MyPage.aspx.cs, to simply instantiate AnotherPage and
call BindDropDownList()? Something like
// This is MyPage.aspx.cs
AnotherPage anotherPage = new AnotherPage();
anotherPage.BindDropDownList();
Does this sound whimsical?
I guess the answer is Nope, and we better write a generick-ish
BindDropDownList and stick it in a class under App_Code, right?