How can I refeer to controls placed in TemplateField

O

odd.morten.sveas

Hi

I'm building a web site where some users can create receivables
(invoices). This website will support several organisations and
different users migth have responibility for more that one
organisation.

My problem is when I'm buliding this receivables page. The receivable
are entered through a asp.net DetailsView. The first thing a user will
do i to choose organisation. This is done by adding a DropDownList in a
TemplateField . Next, the user will find a customer. She will choose
between the customers belonging to the organisation just choosen. Here
comes my problem: I will use a DropDownList in a TemplateField here as
well, but how can this list be filtered by the selection of
organisation?

I have tried to use a where clause and SelectParameter, I'm not sure
how to refeer to the DropDownList in a TemplateField. I seems that the
compiler is not awhere of controls within the DetailsView.

I should mention that I use SQL server as DataSource, and that all
DropDownLists are populated from this DataSource.
 
B

Brock Allen

You can't directly access the controls under the template because they're
just a "template" of what you'd like created. Typically to access the controls
under a template you access them after the template is created, so I'd suggest
looking into the various events the FormView fires to let you know the template
was created or data bound. So check out DataBinding or DataBound events.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top