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

adding server controls at the client at run time

z f
hi, tough one? for me it is currently.

i have a user control that contains other controls like text boxes.

in the client i need to dynamically add the user control using DHTML.
i achive this by having the control hidden and grabbing it's innerHTML to a
new container in the HTML.
i also change controls ID suffix in order to be able to track added controls
like in old HTML.

for example txt_name_x_ becomes txt_name_1_.

now i need to instanciate the container control in the server after submit.

can this be done? without me having to get all the HTML submited internal
contained inputs of the control.

TIA!


Jan 24 '06 #1
4 1379
ZF,

I'm not positive what you're looking for based on your post, but I have a
sample of reloading dynamic controls in order to access their values that
may help you to see. It's at:
http://www.aboutfortunate.com?page=codelibrary. Just search for dynamic
control and you'll see a few different samples. The one I think you'll be
most interested in is: "Reload dynamically created user controls in order to
use their viewstate".

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"z f" <do**@send.mails> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
hi, tough one? for me it is currently.

i have a user control that contains other controls like text boxes.

in the client i need to dynamically add the user control using DHTML.
i achive this by having the control hidden and grabbing it's innerHTML to
a new container in the HTML.
i also change controls ID suffix in order to be able to track added
controls like in old HTML.

for example txt_name_x_ becomes txt_name_1_.

now i need to instanciate the container control in the server after
submit.

can this be done? without me having to get all the HTML submited internal
contained inputs of the control.

TIA!

Jan 24 '06 #2
z f
in the sample you specified, you load the control, but the control gets its
"default" instance.
i need the control to "load" it's state from what is being submitted, and
being submited more than one instance.
so i need to differentiate the controls instances by their IDs.
is giving the newly loaded control the rqeuired ID will do the job?
i'm not sure.
the result should be something like is achived by a repeater that spawns
many instances of a control (in the <ItemTemplate>) to the client, and then
in the submit, even that it is not being binded again to the data, creates
the instances of the "spawned" control and creating them dynamically .

thanks

"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:Os**************@TK2MSFTNGP12.phx.gbl...
ZF,

I'm not positive what you're looking for based on your post, but I have a
sample of reloading dynamic controls in order to access their values that
may help you to see. It's at:
http://www.aboutfortunate.com?page=codelibrary. Just search for dynamic
control and you'll see a few different samples. The one I think you'll be
most interested in is: "Reload dynamically created user controls in order
to use their viewstate".

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"z f" <do**@send.mails> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
hi, tough one? for me it is currently.

i have a user control that contains other controls like text boxes.

in the client i need to dynamically add the user control using DHTML.
i achive this by having the control hidden and grabbing it's innerHTML to
a new container in the HTML.
i also change controls ID suffix in order to be able to track added
controls like in old HTML.

for example txt_name_x_ becomes txt_name_1_.

now i need to instanciate the container control in the server after
submit.

can this be done? without me having to get all the HTML submited internal
contained inputs of the control.

TIA!


Jan 24 '06 #3
zf,

Did you also check out the "Dynamically add text boxes (or any web control)
to a page" sample?

It's doing what you are asking about.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"z f" <do**@send.mails> wrote in message
news:e6**************@tk2msftngp13.phx.gbl...
in the sample you specified, you load the control, but the control gets
its "default" instance.
i need the control to "load" it's state from what is being submitted, and
being submited more than one instance.
so i need to differentiate the controls instances by their IDs.
is giving the newly loaded control the rqeuired ID will do the job?
i'm not sure.
the result should be something like is achived by a repeater that spawns
many instances of a control (in the <ItemTemplate>) to the client, and
then in the submit, even that it is not being binded again to the data,
creates the instances of the "spawned" control and creating them
dynamically .

thanks

"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote
in message news:Os**************@TK2MSFTNGP12.phx.gbl...
ZF,

I'm not positive what you're looking for based on your post, but I have a
sample of reloading dynamic controls in order to access their values that
may help you to see. It's at:
http://www.aboutfortunate.com?page=codelibrary. Just search for dynamic
control and you'll see a few different samples. The one I think you'll be
most interested in is: "Reload dynamically created user controls in order
to use their viewstate".

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"z f" <do**@send.mails> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
hi, tough one? for me it is currently.

i have a user control that contains other controls like text boxes.

in the client i need to dynamically add the user control using DHTML.
i achive this by having the control hidden and grabbing it's innerHTML
to a new container in the HTML.
i also change controls ID suffix in order to be able to track added
controls like in old HTML.

for example txt_name_x_ becomes txt_name_1_.

now i need to instanciate the container control in the server after
submit.

can this be done? without me having to get all the HTML submited
internal contained inputs of the control.

TIA!



Jan 24 '06 #4
z f
ok thanks it looks good now.
the Controls.Add(ctl) line did the trick...

the problem i have now is getting the error
Control 'line_template_ctl1_x_' of type 'ComboBox' must be placed inside a
form tag with runat=server.
in the rendering stage.....
and i don't need the added controls to render at all.
it's just for the post processing.
after that all the page will be re-rendered
so i probably have to remove it unless you have other suggestion...
"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:eT**************@TK2MSFTNGP12.phx.gbl...
zf,

Did you also check out the "Dynamically add text boxes (or any web
control) to a page" sample?

It's doing what you are asking about.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"z f" <do**@send.mails> wrote in message
news:e6**************@tk2msftngp13.phx.gbl...
in the sample you specified, you load the control, but the control gets
its "default" instance.
i need the control to "load" it's state from what is being submitted, and
being submited more than one instance.
so i need to differentiate the controls instances by their IDs.
is giving the newly loaded control the rqeuired ID will do the job?
i'm not sure.
the result should be something like is achived by a repeater that spawns
many instances of a control (in the <ItemTemplate>) to the client, and
then in the submit, even that it is not being binded again to the data,
creates the instances of the "spawned" control and creating them
dynamically .

thanks

"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote
in message news:Os**************@TK2MSFTNGP12.phx.gbl...
ZF,

I'm not positive what you're looking for based on your post, but I have
a sample of reloading dynamic controls in order to access their values
that may help you to see. It's at:
http://www.aboutfortunate.com?page=codelibrary. Just search for dynamic
control and you'll see a few different samples. The one I think you'll
be most interested in is: "Reload dynamically created user controls in
order to use their viewstate".

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"z f" <do**@send.mails> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
hi, tough one? for me it is currently.

i have a user control that contains other controls like text boxes.

in the client i need to dynamically add the user control using DHTML.
i achive this by having the control hidden and grabbing it's innerHTML
to a new container in the HTML.
i also change controls ID suffix in order to be able to track added
controls like in old HTML.

for example txt_name_x_ becomes txt_name_1_.

now i need to instanciate the container control in the server after
submit.

can this be done? without me having to get all the HTML submited
internal contained inputs of the control.

TIA!




Jan 24 '06 #5

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

Similar topics

1
by: Jax | last post by:
I am looking to populate web page with controls as a result of a database query. eg (pseudocode) <% foreach(Garment g in GetStuffFromDB()) { //add controls Response.Write("<asp:Button id =...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
0
by: Sileesh | last post by:
Hi I have html table and a Button in an Aspx page. I am adding one row with some textboxes to Html table each time i click on the Button thru Javascript. Now problem is when when i try to...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
2
by: Oleg Ogurok | last post by:
Hi all, Does anyone have example of adding controls on the client side (DHTML) and then persisting them as ASP.NET server controls on the server side? For example, a page has an <input>...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
0
by: Steve K. | last post by:
I understand the concepts and rules for invoking UI methods from a non-UI thread. In the past I have always checked with the control's InvokeRequired property and Invoked my delegate accordingly. ...
4
by: Lewis Holmes | last post by:
Hi I have the following situation in one of my asp.net pages. The user can add multiple table rows to a form by selecting a button. These rows can contain asp.net controls. When this button is...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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: 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:
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...

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.