Re: Dynamic Controls - Still!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Coleen (coleenholley_at_yaho.com)
Date: 11/12/04


Date: Fri, 12 Nov 2004 14:44:56 -0800

I've got another page where the same code works just fine, but the labels
and textboxes are not nestled inside of any sort of a table. I am checking
for postback = false in the page that works. I tried to create my page in
the exact same manner as the page that does work, and it is still not
triggering the SelectedIndexChanged vent. I tried changing it to work when
the postback = true, but am still having trouble. Argh! This is not
logical! Thanks for your example I will try it and let you know what
happens.

I appreciate your time & effort.

Coleen

"Jim Cheshire [MSFT]" <jamesche@online.microsoft.com> wrote in message
news:yP06dJQyEHA.2544@cpmsftngxa10.phx.gbl...
> Coleen,
>
> I don't really have an example. You just drag and drop the panel on the
> page and then name it. A panel derives from Control just like the Page
> object. Therefore, it has a Controls collection just like a Page.
>
> I just tried what you're doing and it works fine for me. Here's what I
did:
>
> 1. Created a new HTML table.
> 2. Set cell TD1 to runat server.
> 3. Added this code to Page_Load:
>
> Dim ddl As DropDownList = New DropDownList
>
> With ddl
> .Items.Add("Item1")
> .Items.Add("Item2")
> .AutoPostBack = True
> End With
>
> AddHandler ddl.SelectedIndexChanged, AddressOf Me.ddl_SelectedIndexChanged
>
> I then added a subprocedure like this:
>
> Private Sub ddl_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As
> System.EventArgs)
> ' do nothing...
> End Sub
>
> When I set a breakpoint on that event, it hits it fine. Is it possible
> that you haven't set the AutoPostBack property?
>
> Jim Cheshire [MSFT]
> MCP+I, MCSE, MCSD, MCDBA
> ASP.NET Developer Support
> jamesche@online.microsoft.com
>
> This post is provided "AS-IS" with no warranties and confers no rights.
>
>
>
> --------------------
> | From: "Coleen" <coleenholley@yaho.com>
> | References: <eDBQmgOyEHA.2624@TK2MSFTNGP11.phx.gbl>
> <P3Z1a3OyEHA.3820@cpmsftngxa10.phx.gbl>
> | Subject: Re: Dynamic Controls - Still!
> | Date: Fri, 12 Nov 2004 11:41:43 -0800
> | Lines: 129
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
> | Message-ID: <u8iD6#OyEHA.3320@TK2MSFTNGP10.phx.gbl>
> | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
> | NNTP-Posting-Host: virt27212.virtual.state.nv.us 167.154.27.212
> | Path:
>
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
> phx.gbl
> | Xref: cpmsftngxa10.phx.gbl
> microsoft.public.dotnet.framework.aspnet.buildingcontrols:11667
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
> |
> | Yes. Depending on the payment type, I need the labels and associated
> | textboxes to be dynamically populated. I.e., if it is a credit card, I
> need
> | them to enter credit card data, if it's ant Electronic Funds transfer, a
> | different set and so on. I want these to populate according to what is
> | selected from the Dropdownlistbox, but when I place the ddl inside of a
> | table (either HTML or ASPX) the SelectedIndexChanged event does not
> trigger.
> | I am fairly new to VB .Net, but fairly adept at VB6. I am not familiar
> with
> | Panels. If you have a site or example that explains them better than
the
> | .Net Help, I'd really appreciate it. I REALLY appreciate all of your
> help &
> | responses :-)
> |
> | Coleen
> |
> | "Jim Cheshire [MSFT]" <jamesche@online.microsoft.com> wrote in message
> | news:P3Z1a3OyEHA.3820@cpmsftngxa10.phx.gbl...
> | > Coleen,
> | >
> | > Are you dynamically creating a different set of controls based upon
some
> | > condition? The reason I ask is that it might be a lot easier to just
> add
> | a
> | > panel and change the Visible property.
> | >
> | > Jim Cheshire [MSFT]
> | > MCP+I, MCSE, MCSD, MCDBA
> | > ASP.NET Developer Support
> | > jamesche@online.microsoft.com
> | >
> | > This post is provided "AS-IS" with no warranties and confers no
rights.
> | >
> | >
> | > --------------------
> | > | From: "Coleen" <coleenholley@yaho.com>
> | > | Subject: Dynamic Controls - Still!
> | > | Date: Fri, 12 Nov 2004 10:47:28 -0800
> | > | Lines: 61
> | > | X-Priority: 3
> | > | X-MSMail-Priority: Normal
> | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
> | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
> | > | Message-ID: <eDBQmgOyEHA.2624@TK2MSFTNGP11.phx.gbl>
> | > | Newsgroups:
microsoft.public.dotnet.framework.aspnet.buildingcontrols
> | > | NNTP-Posting-Host: virt27212.virtual.state.nv.us 167.154.27.212
> | > | Path:
> | >
> |
>
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
> | > phx.gbl
> | > | Xref: cpmsftngxa10.phx.gbl
> | > microsoft.public.dotnet.framework.aspnet.buildingcontrols:11664
> | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.aspnet.buildingcontrols
> | > |
> | > | Hi Jim Thanks for your help.
> | > |
> | > | I changed the table from an ASP.Net table to an HTML table. I am
till
> | > | having the problem of the control placed inside the table not
> triggering
> | > the
> | > | on SelectedIndexChanged event. To be honest, I don't have a clue
what
> | you
> | > | are talking about as to containers and panels - I'm sorry. Can you
> | please
> | > | send me a link to an example on how to do this? So far, everything
> I've
> | > | tried has not worked.
> | > |
> | > | What I have to have happen is the on the dropdown selection, I need
a
> | set
> | > of
> | > | labels and text boxes to appear to allow the user to enter data
> | pertaining
> | > | to the payment type. I wanted to use a table for alignment
purposes,
> | but
> | > I
> | > | don't have to. I DO have to dynamically have the text in the labels
> | > change,
> | > | and I DO have to have the on SelectedItemChanged or
> SelectedIndexChanged
> | > | event be triggered. Do you have any suggestions, links to examples,
> | etc.
> | > | that you could point me to? Thanks so very much for your help :-)
> | > |
> | > | Coleen
> | > |
> | > | From: Jim Cheshire jamesche@online.microsoft.com
> | > |
> | > | Coleen,
> | > |
> | > | It doesn't matter. The panel is added during design-time and you
can
> | put
> | > | it anywhere. It's simply a placeholder for the dynamic controls
that
> | will
> | > | be added later.
> | > |
> | > | [MSFT]
> | > | MCP+I, MCSE, MCSD, MCDBA
> | > | ASP.NET Developer Support
> | > | jamesche@online.microsoft.com
> | > |
> | > | This post is provided "AS-IS" with no warranties and confers no
> rights.
> | > |
> | > | --------------------
> | > | From: "Coleen" <coleenholley@yaho.com>
> | > |
> | > | I guess I'm a little confused. Does the table get placed inside
the
> | > | container? I've never used containers before, so I honestly don't
> have
> | a
> | > | clue where to start coding..."just add the controls to the Controls
> | > | collection of pnlControls" is the control created and then the
entire
> | > | table placed inside, or is the container placed inside the table?
> | > |
> | > |
> | > | "Jim Cheshire [MSFT]" <jamesche@online.microsoft.com> wrote in
> message
> | > | news:ilB6bA4xEHA.3956@cpmsftngxa10.phx.gbl...
> | > | Coleen,
> | > |
> | > | A table is fine. The thing is that you need to add your dynamic
> | > | controls to a container other than the page. In other words,
suppose
> | you
> | > | were
> | > | adding them to a Panel control called pnlControls. You would just
> add
> | > | the controls to the Controls collection of pnlControls.
> | > |
> | > | pnlControls.Controls.Add(myControl)
> | > |
> | > | That will prevent the controls from getting added outside of the
> <form
> | > | tag and causing a problem.
> | > | Jim Cheshire [MSFT]
> | > |
> | > |
> | > |
> | >
> |
> |
> |
>



Relevant Pages

  • Re: The Electricians Credo, part XXXIV
    ... owns the house know which breaker goes where. ... The NEC requires the panel to be labeled, ... Typically you'll get general labels like first floor lighting, ... The electrician that wired my house made a computer printed label that ...
    (alt.home.repair)
  • Re: performance
    ... >I'm going to create a web form to show some textboxes to users, ... I'm thinking not using 2 pages but use panel ... >server control to group my textboxes and labels, before postback, i ... My questions is hiding a lot of server controls will be ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: VB .NET dynamic number of controls...
    ... > I've been trying todo this by creating arrays of progressbars and labels. ... > progress on, I create a bar and label and add them to a panel. ... no labels, no progress bars. ...
    (microsoft.public.dotnet.general)
  • Re: Panel & click event
    ... If you were just doing text you could use a panel. ... labels on the panel and handle the click event of the panel. ... picture box for the graphics you can handle the click event for it. ... I'm trying to create rectangular areas that contain labels, ...
    (microsoft.public.dotnet.framework.compactframework)