Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

Runtme controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
guy - 27 Oct 2007 12:45 GMT
have a Placeholder on whch a dynamically add controls at run tme, TextBox
DropDownList or CheckBox. I can populate these and providing I save the
placeholder n the SessionState etc. clear them etc.

However if I type into a dynamically added TextBox I can find no way of
getting at the text n code.

Any ideas?

Guy
Mark Rae [MVP] - 27 Oct 2007 12:59 GMT
> Any ideas?

Not without seeing your code...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Michael Nemtsev, MVP - 28 Oct 2007 06:52 GMT
Hello guy,

all controls are stored into page hierarch, nonwithstanding the fact how
you add them - statically or dynamically.

everything you need to do is just use FindControl method recursely on the
root objects to find your added control.

You can use the following codesnippets
- http://weblogs.asp.net/palermo4/archive/2007/04/13/recursive-findcontrol-t.aspx
- http://www.codekeep.net/snippets/0451a411-a6f8-4f78-9959-be8e9fa69393.aspx

---
WBR,
Michael  Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour 

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

g> have a Placeholder on whch a dynamically add controls at run tme,
g> TextBox DropDownList or CheckBox. I can populate these and providing
g> I save the placeholder n the SessionState etc. clear them etc.
g>
g> However if I type into a dynamically added TextBox I can find no way
g> of getting at the text n code.
g>
g> Any ideas?
g>
g> Guy
g>
Phil H - 28 Oct 2007 11:57 GMT
> have a Placeholder on whch a dynamically add controls at run tme, TextBox
> DropDownList or CheckBox. I can populate these and providing I save the
[quoted text clipped - 6 lines]
>
> Guy

Hi Guy

I was faced with a similar situation. My solution was to give the
dynamically added controls a unique code in the ID field and store
them in Session state. On postback any changes to content are shown in
the Request.Header list (a dictionary list of events and control
states in the form (client_ID, value)) against the client_ID
(allocated by the server except that underscore characters are
replaced with $). Although client_ID is not under the programmers
control it will have a construction based on the ID property and will
have the special code embedded within it. You'll then need to use
string search functions to identify it in the list of controls stored
in Session state.

HTH

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.