By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,938 Members | 1,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,938 IT Pros & Developers. It's quick & easy.

Passing web form controls from a page to an external class

P: n/a
I have a web form that has controls to be modified on it. The class that
will modify the controls is not contained inside the page code. How would I
best pass the controls to the external class?

Jun 27 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
As a parameter (MyInstance.MyMethod MyControl) ?

You may want to elaborate a bit as you likely have a particular problem ?
Your code is in App_Code ???

--
Patrice

"Andy B" <a_*****@sbcglobal.neta écrit dans le message de groupe de
discussion : u1**************@TK2MSFTNGP06.phx.gbl...
I have a web form that has controls to be modified on it. The class that
will modify the controls is not contained inside the page code. How would
I best pass the controls to the external class?
Jun 27 '08 #2

P: n/a
Hi...

I dont use app_code since I am using web application projects instead of
website projects. This is what is going on. I have a page called Create.aspx
that has some controls on it (3 labels, 2 textboxes, 2
requiredFieldValidators , 2 textboxcounters and a linkButton). I have to
change state of the controls (1 label, 2 textboxes, 2
requiredFieldValidators, 2 textboxCounters and linkButton). The state of
these controls listed above depends on the CommandName of the link button.
Along with all of this control state switching, I need to create and fill
dataset with different values from the 2 textboxes. To reduce code clutter,
I was told that I should put the code that changes the state of these
controls outside of the page itself. Any advice on what way to go from here?
"Patrice" <http://www.chez.com/scribe/wrote in message
news:D2**********************************@microsof t.com...
As a parameter (MyInstance.MyMethod MyControl) ?

You may want to elaborate a bit as you likely have a particular problem ?
Your code is in App_Code ???

--
Patrice

"Andy B" <a_*****@sbcglobal.neta écrit dans le message de groupe de
discussion : u1**************@TK2MSFTNGP06.phx.gbl...
>I have a web form that has controls to be modified on it. The class that
will modify the controls is not contained inside the page code. How would
I best pass the controls to the external class?

Jun 27 '08 #3

P: n/a
Your best bet would be likely to discuss with the architect that told you to
do so...

In this case you may want to turn this set of controls into a user or custom
controls (googling for this should return tons of links) so that you can
reuse the same ui in other pages...

More generally either :
- the routine is specific to a page and you can then keep it inside a page
- or it could be called from another page and then you could put this in
your own utilities class so that you can call this from anywhere

Also you don't necessarily have to pass the whole control. You could just
call a function that would provide the single state (visible, enabled or
whatever else) that should be applied to this control. This is only if you
do something very specific on a particular control type and that you could
call this from multiple pages that you could put this inside your own
utility class...

In all cases, you'll pass data back and forth using arguements (or perhaps
using properties if you are using a class that can perform long term
operations on the same data)

--
Patrice
"Andy B" <a_*****@sbcglobal.neta écrit dans le message de groupe de
discussion : uw**************@TK2MSFTNGP04.phx.gbl...
Hi...

I dont use app_code since I am using web application projects instead of
website projects. This is what is going on. I have a page called
Create.aspx that has some controls on it (3 labels, 2 textboxes, 2
requiredFieldValidators , 2 textboxcounters and a linkButton). I have to
change state of the controls (1 label, 2 textboxes, 2
requiredFieldValidators, 2 textboxCounters and linkButton). The state of
these controls listed above depends on the CommandName of the link button.
Along with all of this control state switching, I need to create and fill
dataset with different values from the 2 textboxes. To reduce code
clutter, I was told that I should put the code that changes the state of
these controls outside of the page itself. Any advice on what way to go
from here?
"Patrice" <http://www.chez.com/scribe/wrote in message
news:D2**********************************@microsof t.com...
>As a parameter (MyInstance.MyMethod MyControl) ?

You may want to elaborate a bit as you likely have a particular problem ?
Your code is in App_Code ???

--
Patrice

"Andy B" <a_*****@sbcglobal.neta écrit dans le message de groupe de
discussion : u1**************@TK2MSFTNGP06.phx.gbl...
>>I have a web form that has controls to be modified on it. The class that
will modify the controls is not contained inside the page code. How
would I best pass the controls to the external class?

Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.