473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to Make Code-Behind Reflect Changes To Designer?

I have an existing page, that works, and I'm trying to enhance it by adding a
dropdown in a datagrid. When I add the dropdown, I expect the code-behind
file to be updated by VS. It should be updated to contain a type declaration
for the new dropdown with a variable name that is the same as the id that I
set in the designer.

Do I expect correctly?

Well, it's not happening. And it doesn't matter whether it's an HTML or a
web control. The type declaration is not being generated automatically. If
I add the declaration manually, it fools the compiler but not the runtime.

I think there may be something important here that I do not understand. Can
anyone tell me what I need to read about in order to debug this situation?

Thanks.
Dec 14 '05 #1
2 1178
There isn't a single instance of the dropdownlist. When you put a control
into a template list, the "normal" declaretive model isn't correct anymore.
If you do:

<itemTemplate>
<asp:dropdownlist id="x" runat="server" />
</itemTemplate>

you can't simply manipulate X like you would any other control. Which "X"
do you want? The one in row1, row2, row3??

Typically, you hook into the grids/list/repeater's ItemDataBound event,
which fires for each row being bound:

e.Item <-- the row being bound. From that, you can access the dropdownlist
via a FindControl

DropDownList x = (DropDownList)e.Item.FindControl("x");

take a look at:
http://openmymind.net/MyArticles.aspx?documentId=8

Karl

--

MY ASP.Net tutorials
http://www.openmymind.net/

"JebBushell" <jebbushell AT yahoo DOT com> wrote in message
news:E7**********************************@microsof t.com...
I have an existing page, that works, and I'm trying to enhance it by adding
a
dropdown in a datagrid. When I add the dropdown, I expect the code-behind
file to be updated by VS. It should be updated to contain a type
declaration
for the new dropdown with a variable name that is the same as the id that
I
set in the designer.

Do I expect correctly?

Well, it's not happening. And it doesn't matter whether it's an HTML or a
web control. The type declaration is not being generated automatically.
If
I add the declaration manually, it fools the compiler but not the runtime.

I think there may be something important here that I do not understand.
Can
anyone tell me what I need to read about in order to debug this situation?

Thanks.

Dec 14 '05 #2
j3b
Thanks Karl.

Here's your answer implemented:

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

where ddlBrand is a local instance of HtmlSelect that has previously
been databound.

Works great. Thanks again.
Karl Seguin wrote:
There isn't a single instance of the dropdownlist. When you put a control
into a template list, the "normal" declaretive model isn't correct anymore.
If you do:

<itemTemplate>
<asp:dropdownlist id="x" runat="server" />
</itemTemplate>

you can't simply manipulate X like you would any other control. Which "X"
do you want? The one in row1, row2, row3??

Typically, you hook into the grids/list/repeater's ItemDataBound event,
which fires for each row being bound:

e.Item <-- the row being bound. From that, you can access the dropdownlist
via a FindControl

DropDownList x = (DropDownList)e.Item.FindControl("x");

take a look at:
http://openmymind.net/MyArticles.aspx?documentId=8

Karl

--

MY ASP.Net tutorials
http://www.openmymind.net/

"JebBushell" <jebbushell AT yahoo DOT com> wrote in message
news:E7**********************************@microsof t.com...
I have an existing page, that works, and I'm trying to enhance it by adding
a
dropdown in a datagrid. When I add the dropdown, I expect the code-behind
file to be updated by VS. It should be updated to contain a type
declaration
for the new dropdown with a variable name that is the same as the id that
I
set in the designer.

Do I expect correctly?

Well, it's not happening. And it doesn't matter whether it's an HTML or a
web control. The type declaration is not being generated automatically.
If
I add the declaration manually, it fools the compiler but not the runtime.

I think there may be something important here that I do not understand.
Can
anyone tell me what I need to read about in order to debug this situation?

Thanks.


Dec 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

354
by: Montrose... | last post by:
After working in c# for a year, the only conclusion I can come to is that I wish I knew c. All I need is Linux, the gnu c compiler and I can do anything. Web services are just open sockets...
19
by: Swaregirl | last post by:
Hello, I would like to build a website using ASP.NET. I would like website visitors to be able to download code that I would like to make available to them and that would be residing on my...
1
by: Robert | last post by:
Vb.Net Make dll that contain one function. Help Please. I would like to call a function from different applications. I think i have to make a dll. I have Visual Basic.net 2003 Standard...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
8
by: Seeker | last post by:
Hello, In using Solaris Pro Compiler to compile Pro*C code. I am getting this error: make: Fatal error in reader: parser_proc_online.mk, line 26: Badly formed macro assignment Based on other...
28
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions!...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
7
by: John Harrison | last post by:
This is from SGI's FAQ, its the justification for why list<T>::size() is linear time in their library (and in gcc library too since their code is based on SGI) <quote> Why is list<>::size()...
12
by: =?Utf-8?B?S2plbGw=?= | last post by:
Hello I've taken a four days training in C#, very good training, experienced teacher and all that, very positive. Went home spent a week making my first application, slightly more than the...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.