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 / February 2006

Tip: Looking for answers? Try searching our database.

Dynamicly adding controls after Page_Load event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GS - 14 Feb 2006 19:05 GMT
Hi,

I dynamicly add custom control in SelectedIndexChanged even of GridView which is firing after Page_Load. My control is not being rendered to page becouse of that (I assume). How to avoid this situation? Sample below

protected void dgrCompanies_SelectedIndexChanged(object sender, EventArgs e)
{
GoogleControl MyGoogleControl = new GoogleControl ();
PlaceHolderForMap.Controls.Add(MyGoogleControl);
}
Terry Burns - 14 Feb 2006 19:50 GMT
No, your conrol will be rendered after PreRender which happens after this event.

Have you set your control to visible
Have you positioned your control
Have you checked the Z-Order of the control
Is the PlaceHolder visible.
Have you checked that this should appear with no data in it for example ?

Signature

Terry Burns
http://TrainingOn.net

 Hi,

 I dynamicly add custom control in SelectedIndexChanged even of GridView which is firing after Page_Load. My control is not being rendered to page becouse of that (I assume). How to avoid this situation? Sample below

 protected void dgrCompanies_SelectedIndexChanged(object sender, EventArgs e)
 {
 GoogleControl MyGoogleControl = new GoogleControl ();
 PlaceHolderForMap.Controls.Add(MyGoogleControl);
 }
GS - 14 Feb 2006 20:25 GMT
Control is not positioned on webpage at all. My understanding that I can load it programmatically without putting it on webpage (one reference is set at <%@ reference
Placeholder is visible. Code below works fine for TextBox control for example but not for custom control.

 No, your conrol will be rendered after PreRender which happens after this event.

 Have you set your control to visible
 Have you positioned your control
 Have you checked the Z-Order of the control
 Is the PlaceHolder visible.
 Have you checked that this should appear with no data in it for example ?

 --
 Terry Burns
 http://TrainingOn.net

   "GS" <nospam@nowhere.com> wrote in message news:ObgfvmZMGHA.1532@TK2MSFTNGP12.phx.gbl...
   Hi,

   I dynamicly add custom control in SelectedIndexChanged even of GridView which is firing after Page_Load. My control is not being rendered to page becouse of that (I assume). How to avoid this situation? Sample below

   protected void dgrCompanies_SelectedIndexChanged(object sender, EventArgs e)
   {
   GoogleControl MyGoogleControl = new GoogleControl ();
   PlaceHolderForMap.Controls.Add(MyGoogleControl);
   }
Terry Burns - 14 Feb 2006 23:39 GMT
Hold on, your original post asked.

>My control is not being rendered to page becouse of that (I assume).

So what is it you think isnt happening that you think should ?

Signature

Terry Burns
http://TrainingOn.net

 Control is not positioned on webpage at all. My understanding that I can load it programmatically without putting it on webpage (one reference is set at <%@ reference
 Placeholder is visible. Code below works fine for TextBox control for example but not for custom control.

   "Terry Burns" <me@mine.com> wrote in message news:%23rkEKAaMGHA.3196@TK2MSFTNGP09.phx.gbl...

   No, your conrol will be rendered after PreRender which happens after this event.

   Have you set your control to visible
   Have you positioned your control
   Have you checked the Z-Order of the control
   Is the PlaceHolder visible.
   Have you checked that this should appear with no data in it for example ?

   --
   Terry Burns
   http://TrainingOn.net

     "GS" <nospam@nowhere.com> wrote in message news:ObgfvmZMGHA.1532@TK2MSFTNGP12.phx.gbl...
     Hi,

     I dynamicly add custom control in SelectedIndexChanged even of GridView which is firing after Page_Load. My control is not being rendered to page becouse of that (I assume). How to avoid this situation? Sample below

     protected void dgrCompanies_SelectedIndexChanged(object sender, EventArgs e)
     {
     GoogleControl MyGoogleControl = new GoogleControl ();
     PlaceHolderForMap.Controls.Add(MyGoogleControl);
     }
Teemu Keiski - 15 Feb 2006 08:27 GMT
Hi,

Dynamical controls would need to be added on every request. Control
instances aren't stored anywehere, and as you create them initially in code,
you are also responsible for creating them on postback (subsequently as long
as control is "in action")

FYI: http://aspnet.4guysfromrolla.com/articles/092904-1.aspx

Signature

Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

Hi,

I dynamicly add custom control in SelectedIndexChanged even of GridView
which is firing after Page_Load. My control is not being rendered to page
becouse of that (I assume). How to avoid this situation? Sample below

protected void dgrCompanies_SelectedIndexChanged(object sender, EventArgs e)
{
GoogleControl MyGoogleControl = new GoogleControl ();
PlaceHolderForMap.Controls.Add(MyGoogleControl);
}

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



©2009 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.