Re: Dynamic Controls - Still!
From: Jim Cheshire [MSFT] (jamesche_at_online.microsoft.com)
Date: 11/12/04
- Next message: Coleen: "Re: Doubt : ASP.NET problem"
- Previous message: Kevin Spencer: "Re: Doubt : ASP.NET problem"
- In reply to: Coleen: "Re: Dynamic Controls - Still!"
- Next in thread: Coleen: "Re: Dynamic Controls - Still!"
- Reply: Coleen: "Re: Dynamic Controls - Still!"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 12 Nov 2004 21:55:36 GMT
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]
| > |
| > |
| > |
| >
|
|
|
- Next message: Coleen: "Re: Doubt : ASP.NET problem"
- Previous message: Kevin Spencer: "Re: Doubt : ASP.NET problem"
- In reply to: Coleen: "Re: Dynamic Controls - Still!"
- Next in thread: Coleen: "Re: Dynamic Controls - Still!"
- Reply: Coleen: "Re: Dynamic Controls - Still!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|