473,386 Members | 1,883 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,386 software developers and data experts.

Retrieving User's Input from Dynamically added WebControls

I've built a WebForm with a Table added dynamically in Page_Load when
IsPostBack is false. The table includes a couple of TextBoxes,
RadioButtonLists and CheckboxLists.

On postback, those controls are not present nor their valves in
Request.Form.AllKeys.

What is the strategy to use in order to accomplish list? (Pointers to tech
articles would be very helpful, as I'm not even sure where to start)

TIA,

geo
Jan 20 '06 #1
3 2518
I think you should make these controls as Server side controls ( runat =
server), define them in the code behind file, and then use them.

Here is a weak pointer http://www.asp101.com/lessons/htmlcontrols.asp

HTH,
r.
I've built a WebForm with a Table added dynamically in Page_Load when
IsPostBack is false. The table includes a couple of TextBoxes,
RadioButtonLists and CheckboxLists.

On postback, those controls are not present nor their valves in
Request.Form.AllKeys.

What is the strategy to use in order to accomplish list? (Pointers to
tech articles would be very helpful, as I'm not even sure where to
start)

TIA,

geo

Jan 20 '06 #2
Thanks for your input Ranjan, perhaps I wasn't very clear.

They are server controls, since they are created in code. It would be much
easier if I could define them declaratively, however, I don't know before
the request is made, based upon the Query string and what that points to in
the database, what the page should contain.

Having looked into this further, it looks like the page life cycle might
hold the answer. Perhaps I should create the controls in another page event
other than Page_Load??

Basically, I need to know how to create controls dynamically so that I can
get the values out on the postback.

TIA,
geo
"Ranjan Sakalley" <construqt.yahoo.com> wrote in message
news:75*************************@news.microsoft.co m...
I think you should make these controls as Server side controls ( runat =
server), define them in the code behind file, and then use them.

Here is a weak pointer http://www.asp101.com/lessons/htmlcontrols.asp

HTH,
r.
I've built a WebForm with a Table added dynamically in Page_Load when
IsPostBack is false. The table includes a couple of TextBoxes,
RadioButtonLists and CheckboxLists.

On postback, those controls are not present nor their valves in
Request.Form.AllKeys.

What is the strategy to use in order to accomplish list? (Pointers to
tech articles would be very helpful, as I'm not even sure where to
start)

TIA,

geo


Jan 20 '06 #3
Hi Geo,

As for dynamic ASP.NET server controls, both Page_Init and Page_Load is the
possible place to create and add them. However, Init is the prefered one
since the Page haven't begun loading viewstate at that time.... So the
general steps for creating dynamic webcontrols and retrieve values from
them in other events are:

1. creating them in Page Init or Load events and add them into page's
control collection/hierarchy...

2. In page's post back events (not init or load events) , read their
properties, since at that time, we can ensure the dynamic controls are
created and have restored their properties from viewstate and the posted
values....

Here is a kb article mentioned create dynamic server controls in asp.net
webform:

#HOW TO: Dynamically Create Controls in ASP.NET by Using Visual C# .NET
http://support.microsoft.com/kb/317794/en-us

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Dotnet Gruven" <do**********@newsgroup.nospam>
| References: <eW**************@TK2MSFTNGP09.phx.gbl>
<75*************************@news.microsoft.com>
| Subject: Re: Retrieving User's Input from Dynamically added WebControls
| Date: Fri, 20 Jan 2006 11:58:11 -0500
| Lines: 49
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Response
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#m**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-128-25-74.hsd1.ma.comcast.net 24.128.25.74
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:372449
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks for your input Ranjan, perhaps I wasn't very clear.
|
| They are server controls, since they are created in code. It would be
much
| easier if I could define them declaratively, however, I don't know before
| the request is made, based upon the Query string and what that points to
in
| the database, what the page should contain.
|
| Having looked into this further, it looks like the page life cycle might
| hold the answer. Perhaps I should create the controls in another page
event
| other than Page_Load??
|
| Basically, I need to know how to create controls dynamically so that I
can
| get the values out on the postback.
|
| TIA,
| geo
|
|
| "Ranjan Sakalley" <construqt.yahoo.com> wrote in message
| news:75*************************@news.microsoft.co m...
| >I think you should make these controls as Server side controls ( runat =
| >server), define them in the code behind file, and then use them.
| >
| > Here is a weak pointer http://www.asp101.com/lessons/htmlcontrols.asp
| >
| > HTH,
| > r.
| >
| >
| >
| >> I've built a WebForm with a Table added dynamically in Page_Load when
| >> IsPostBack is false. The table includes a couple of TextBoxes,
| >> RadioButtonLists and CheckboxLists.
| >>
| >> On postback, those controls are not present nor their valves in
| >> Request.Form.AllKeys.
| >>
| >> What is the strategy to use in order to accomplish list? (Pointers to
| >> tech articles would be very helpful, as I'm not even sure where to
| >> start)
| >>
| >> TIA,
| >>
| >> geo
| >>
| >
| >
|
|
|

Jan 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joel Reinford | last post by:
I am working on an ASP.NET web app. One of the pages will be using several user controls. The controls will be loaded dynamically based on SQL Server data. I need to be able to retrieve the...
7
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control...
4
by: Bas Groeneveld | last post by:
I am developing an ASP.NET application part of which consists of a data entry wizard defined by entries in a data table - ie the controls on each page of the wizard are determined by definitions in...
4
by: sydney.luu | last post by:
Hello, I would greatly appreciate if someone can show me how to dynamically build a Repeater with unknown number of columns at design time. I have looked various threads in this newsgroup,...
9
by: Chris | last post by:
I am dynamically adding a user control to each row in a gridview. The reason I am doing it dynamically is the user control is different depending on certain data in the gridview. The gridview...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
5
by: Nathan Sokalski | last post by:
I have a custom control that I wrote (I inherit from System.Web.UI.WebControls.CompositeControl). I dynamically add this control to my Page, but I was told that dynamically added controls do not...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
0
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,...
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:
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...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
0
jinu1996
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 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.