473,383 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Passing web form controls from a page to an external class

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
3 1557
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
9
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the...
6
by: RBCC | last post by:
Public Class fraction Dim m_numerator As Int16 Dim m_denominator As Int16 Public Event zerodenom() Public Property numerator() As Int16 Get Return m_numerator
3
by: Øystein Olsen | last post by:
Hi, I'm in need of help. My web page is built up from nested masterpages. In the page containing the main content i have a form that I want to post to a external site (isapi dll). I want to use...
5
by: sck10 | last post by:
Hello, I am trying to add the following to a App_Code class. The error I am getting references "Page.Controls". I would like to call this from my content page which uses MasterPages I read...
8
by: ridgedale | last post by:
I wonder if anyone could explain how I pass the field values in my request form to the PHP processor page. My external javascript file is as follows: var sections = ; for (var i=0; i <...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.