I've made multiple posts re different aspects of dynamically adding web and
user controls.. First off, thx for all the responses.. I think I've figured
it out.
I am looking for some feedback on how I am implementing certain
functionlity.. Details follow..
Scenario
======
The application allows users to create new reports to the application. For
each report, there can be multiple delivery channels. For example, Word Doc,
PDF, HTML. Real Media etc. New delivery channels can be added at any time.
Delivery channels are of 2 types; some are strictly links, others can be
links and downloadble. For example,
Report Name : My Report
Delivery Channels : Word, Real Media
For Word, there will be a text box for URL and a FileInput (if its
downloadable from our server)
For Real Media there will only be a textbox for URL
Once a user enters a new report, they are sent to a screen which lists the
various delivery channels. Here they get to specify which delivery channels
apply for the report. Given that the delivery channels will change over
time, I am adding input controls on the fly based on the list of delivery
channels in the db.
For example, for Word I generate a textbox control like this : <input
name="txt_1" type="text" id="txt_1" /> (this is the HTML generated by the
web server control, assume ID of Word is 1).
For Streaming, I would generate <input name="txt_3" type="text" id="txt_3"
/><input name="fileUpload_3:fileToUpload" id="fileUpload_3_fileToUpload"
type="file" /> (Assume ID for Streaming is 3, the fileUpload is a user
control I've created to manage file uploads).
Reading Data
=========
when it comes to storing the data entered by the user, the Save_Click event
is implemented as follows:
- obtain list of valid delivery channel IDs
- do a Page.FindControl("txt_" & id) and Page.FindControl("fileUpload_" & id
& "_fileToUpload") to find the control for the channel IDs.
- read the data and write to the DB.
Does this approach make sense? Are there better/ more efficient ways to make
this happen?
Thx.
Bijoy
(apologies for the lengthy post) 1 1229
Bijoy,
If that works, go for it. You should always implement the simplest
solution that will work; however, I would do on thing a bit differently.
Instead of depending on the id's to find the controls, keep references to
the controls when you dynamically add them. Then you can reference them
more easily in the event handlers. You can have just a ControlCollection
member variable that holds references to these controls.
If what I said above doesn't make any sense, then just go with what you
know. :)
Best regards,
Jeffrey Palermo
"Bijoy Naick" <b_*****@yahoo.ca> wrote in message
news:On**************@TK2MSFTNGP10.phx.gbl... I've made multiple posts re different aspects of dynamically adding web
and user controls.. First off, thx for all the responses.. I think I've
figured it out.
I am looking for some feedback on how I am implementing certain functionlity.. Details follow..
Scenario ======
The application allows users to create new reports to the application. For each report, there can be multiple delivery channels. For example, Word
Doc, PDF, HTML. Real Media etc. New delivery channels can be added at any time. Delivery channels are of 2 types; some are strictly links, others can be links and downloadble. For example,
Report Name : My Report Delivery Channels : Word, Real Media
For Word, there will be a text box for URL and a FileInput (if its downloadable from our server) For Real Media there will only be a textbox for URL
Once a user enters a new report, they are sent to a screen which lists the various delivery channels. Here they get to specify which delivery
channels apply for the report. Given that the delivery channels will change over time, I am adding input controls on the fly based on the list of delivery channels in the db.
For example, for Word I generate a textbox control like this : <input name="txt_1" type="text" id="txt_1" /> (this is the HTML generated by the web server control, assume ID of Word is 1).
For Streaming, I would generate <input name="txt_3" type="text" id="txt_3" /><input name="fileUpload_3:fileToUpload" id="fileUpload_3_fileToUpload" type="file" /> (Assume ID for Streaming is 3, the fileUpload is a user control I've created to manage file uploads).
Reading Data =========
when it comes to storing the data entered by the user, the Save_Click
event is implemented as follows:
- obtain list of valid delivery channel IDs - do a Page.FindControl("txt_" & id) and Page.FindControl("fileUpload_" &
id & "_fileToUpload") to find the control for the channel IDs. - read the data and write to the DB.
Does this approach make sense? Are there better/ more efficient ways to
make this happen?
Thx.
Bijoy (apologies for the lengthy post)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Leonard J. Reder |
last post by:
Hello,
Although posted this a few weeks ago I still have gotten much feedback
so I want to put this out again and see if the response gets a bit more
interesting.
I have been searching on the...
|
by: Simon Cooke |
last post by:
Hi there;
A while back when I was in Albany, NY, I came across what looked like a
really great C++ book for the experienced programmer. Unfortunately, I
couldn't buy it and take it with me...
|
by: christopher diggins |
last post by:
I would like some feedback if the follow code is standard compliant, and are
there any obvious redundancies or inefficiencies? The purpose of the code is
to emulate the behaviour of a struct FuBar...
|
by: Brent |
last post by:
Like many sites, mine has a standard "look" -- a template, if you will
-- that visitors see on each page. I've tried to keep the code and HTML
separate to the extent possible, and for most standard...
|
by: Alan Silver |
last post by:
Hello,
MSDN (amongst other places) is full of helpful advice on ways to do data
access, but they all seem geared to wards enterprise applications. Maybe
I'm in a minority, but I don't have those...
| |
by: Luc Kumps |
last post by:
(Sorry about the previous post, it got transmitted before it was complete)
We try to separate implementation and interface defintions, but we run into
a problem. I hope the guru's can solve this,...
|
by: lorlarz |
last post by:
Looking for feedback on Matching Exercises Maker/ Builder:
http://mynichecomputing.com/ReadIt/translateT.html
For one thing, I am concerned about storing the matching kwork (known
word)
as...
|
by: Christopher Vogt |
last post by:
Hej everybody,
I built something for myself that might help some of you as well.
Looking at a couple of PHP template engines made me think.
I have two main requirements for a presentation...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |