I would like to create a class that changes some basic
attributes of a web page based on values in a database.
Things like background color, font, text color, etc. My
problem is that I'm not sure how to pass the
variable 'this' to a class function. I need to be able
modify the properties of the controls on the web page.
Has anyone done something like this?
Thanks for the help!
Gary 3 1207
I believe your problem lies in the fact that your function defines the
parameter type as a reference to the Base Page class, rather than a
reference to your inherited Page class. The types don't match exactly.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
Big things are made up of
lots of little things.
"Gary Monk" <g_****@hotmail.com> wrote in message
news:02****************************@phx.gbl... Kevin,
Thanks for the reply.
I'm receiving the following error...
C:\inetpub\wwwroot\MYOWorks\schedule.aspx.cs(114): The best overloaded method match for 'MYOWorks.MYOPage.SetPageDefaults(ref System.Web.UI.Page)' has some invalid arguments
I didn't mention in my first post I'm using C#. I'm not sure if this makes a difference in the coding example.
Here is the code I'm using...
In the class...
public void SetPageDefaults(ref System.Web.UI.Page objPage) { . . .
In the program...
pageSetup.SetPageDefaults( ref this );
Thanks, Gary
-----Original Message----- In your class:
private function doWithThis(ref System.Web.UI.Page objPage){ // do something with the Page }
In your page:
ClassName.doWithThis(ref this);
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com Big things are made up of lots of little things.
"Gary Monk" <g_****@hotmail.com> wrote in message news:02****************************@phx.gbl... I would like to create a class that changes some basic attributes of a web page based on values in a database. Things like background color, font, text color, etc. My problem is that I'm not sure how to pass the variable 'this' to a class function. I need to be able modify the properties of the controls on the web page.
Has anyone done something like this?
Thanks for the help! Gary
.
Oops. I said "her." Sorry, Gary!
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
Big things are made up of
lots of little things.
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl... Well, yes and no. It is a reference, and you can pass it to a function and make changes to the data contained therein, but not the reference itself.
In her case, it really wouldn't make any difference, since she only wants to make changes to the properties of the page.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer http://www.takempis.com Big things are made up of lots of little things.
"szabelin" <szabelin@szabelin> wrote in message news:03****************************@phx.gbl... Kevin, I was just curios why pass objPage by ref? Isn't objPage already a reference?
Thanks
-----Original Message----- In your class:
private function doWithThis(ref System.Web.UI.Page objPage){ // do something with the Page }
In your page:
ClassName.doWithThis(ref this);
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com Big things are made up of lots of little things.
"Gary Monk" <g_****@hotmail.com> wrote in message news:02****************************@phx.gbl... > I would like to create a class that changes some basic > attributes of a web page based on values in a database. > Things like background color, font, text color, etc. My > problem is that I'm not sure how to pass the > variable 'this' to a class function. I need to be able > modify the properties of the controls on the web page. > > Has anyone done something like this? > > Thanks for the help! > Gary
.
No problem. Thanks for the help!!!
Gary -----Original Message----- Oops. I said "her." Sorry, Gary!
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com Big things are made up of lots of little things.
"Kevin Spencer" <ke***@takempis.com> wrote in message news:Ob**************@TK2MSFTNGP12.phx.gbl... Well, yes and no. It is a reference, and you can pass
it to a function and make changes to the data contained therein, but not
the reference itself.In her case, it really wouldn't make any difference,
since she only wants to make changes to the properties of the page.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer http://www.takempis.com Big things are made up of lots of little things.
"szabelin" <szabelin@szabelin> wrote in message news:03****************************@phx.gbl... > > Kevin, I was just curios why pass objPage by ref?
Isn't > objPage already a reference? > > Thanks > > > >-----Original Message----- > >In your class: > > > >private function doWithThis(ref System.Web.UI.Page > objPage) > >{ > >// do something with the Page > >} > > > >In your page: > > > >ClassName.doWithThis(ref this); > > > >-- > >HTH, > > > >Kevin Spencer > >Microsoft MVP > >..Net Developer > >http://www.takempis.com > >Big things are made up of > >lots of little things. > > > >"Gary Monk" <g_****@hotmail.com> wrote in message > >news:02****************************@phx.gbl... > >> I would like to create a class that changes some
basic > >> attributes of a web page based on values in a
database. > >> Things like background color, font, text color,
etc. My > >> problem is that I'm not sure how to pass the > >> variable 'this' to a class function. I need to be
able > >> modify the properties of the controls on the web
page. > >> > >> Has anyone done something like this? > >> > >> Thanks for the help! > >> Gary > > > > > >. > >
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: harry |
last post by:
I have an object that's passed in to a function as a parameter i.e public
boolean getProjectTitle(ProjectHeader_DTO obj) {...}
If I then call a method on this object inside the function i.e...
|
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {...
|
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of...
|
by: dave.harper |
last post by:
I'm relatively new to C++, but have a question regarding functions and
arrays. I'm passing a relatively large array to a function several
thousand times during the course of a loop, and it seems...
|
by: kalinga1234 |
last post by:
there is a problem regarding passing array of characters to another
function(without using structures,pointer etc,).can anybody help me to
solve the problem.
|
by: Charles Sullivan |
last post by:
The library function 'qsort' is declared thus:
void qsort(void *base, size_t nmemb, size_t size,
int(*compar)(const void *, const void *));
If in my code I write:
int cmp_fcn(...);
int...
|
by: Christopher Benson-Manica |
last post by:
Does the following program exhibit undefined behavior? Specifically,
does passing a struct by value cause undefined behavior if that struct
has as a member a pointer that has been passed to...
|
by: Andrew Bullock |
last post by:
Hi,
I have two classes, A and B,
B takes an A as an argument in its constructor:
A a1 = new A();
B b = new B(a1);
|
by: TS |
last post by:
I was under the assumption that if you pass an object as a param to a method
and inside that method this object is changed, the object will stay changed
when returned from the method because the...
|
by: dave_dp |
last post by:
Hi, I have just started learning C++ language..
I've read much even tried to understand the way standard says but still
can't get the grasp of that concept.
When parameters are passed/returned...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |