VS Does Not Generate Ref To HTML Server Control

G

Guest

I retrofit an HTML <select id="SelectBrand" name="SelectBrand"...></select>
into a page and make it a server control.

The aspx.cs file should, but does not, magically acquire the declaration:

protected System.Web.UI.HtmlControls.HtmlSelect SelectBrand;

If I insert the above declaration the compiler is happy but the runtime
fails because the reference is not set.

Any help would be appreciated.
 
K

Karl Seguin

i know you put the elipse (...), but you do have a runat="server" in there,
right?

Karl
 
K

Karl Seguin

This is in ASP.NEt 1,x right? not 2.0

also, is this within a repeater or a grid or something?

Do you have other controls on the page that ARE working?

Karl
 
G

Guest

It's ASP 1.0 and the affected (Select) element is in the EditItemTemplate of
a TemplateColumn that is within the Columns element of a Datagrid.

There are other text and checkbox controls at the same level of nesting
within the same datagrid, and another datagrid, both on the same page and
they all work. I cannot say that the all worked out of the box, however.
Some of them seemed harder to get working than others. I'm still a newbie so
I'm not quite sure how things are supposed to work.
 
G

Guest

Fixed it. Here is the line of code:

dgPumps.Items[dgPumps.EditItemIndex].Cells[5].Controls.Add(ddlBrand);

I was dreaming about how simple it might be. Thanks for making me think.
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top