Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Referencing value of a dynamically created control

Reply
Thread Tools

Referencing value of a dynamically created control

 
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      07-13-2004
I have a placeholder object in which I am dynamically placing controls based on a database query. Of course during postback these controls go away. I have seen other questions posed where someone wants the dynamically created controls to appear on the page. However in my case I don't really need to have the control displayed after postback, but I do need its value. When I look at the trace output from the page after postback, it lists the value of my dynamically created controls, but I cannot figure how to reference those values. Does anyone have any ideas?
 
Reply With Quote
 
 
 
 
Davide Vernole [MVP]
Guest
Posts: n/a
 
      07-13-2004
Mike <(E-Mail Removed)> typed:
> I have a placeholder object in which I am dynamically placing
> controls based on a database query. Of course during postback these
> controls go away. I have seen other questions posed where someone
> wants the dynamically created controls to appear on the page. However
> in my case I don't really need to have the control displayed after
> postback, but I do need its value. When I look at the trace output
> from the page after postback, it lists the value of my dynamically
> created controls, but I cannot figure how to reference those values.
> Does anyone have any ideas?


Mike I think the problem is always the same: you create the controls
everytime the page is load and not only during the first load (the second
one is the right way !).

Try to do this:

if(!IsPostBack)
{
//....first load....create or load controls
}

HTH
--
Davide Vernole
MVP ASP/ASP.NET
Microsoft Certified Solution Developer


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
Managing ViewState of a dynamically created Custom Composite Server Control -(where the original is also dynamically created) dickster ASP .Net Building Controls 0 12-08-2005 09:32 AM
posted value missing in dynamically created control Andy Fish ASP .Net 0 11-04-2004 01:39 PM
Referencing Dynamically Created Controls in PlaceHolder Leona Vo via .NET 247 ASP .Net Web Controls 0 06-11-2004 01:14 AM
Referencing Dynamically created controls Chris Kennedy ASP .Net Building Controls 1 04-12-2004 07:52 PM



Advertisments