473,395 Members | 1,443 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,395 software developers and data experts.

items.insert into dropdown in datagrid

I need to add a line to choose a size into a dropdown . Since I have
the dropdown nested inside a datagrid this is not working.When a page
displays there are several rows of dropdowns but only the top dropdown
has the option added. The others do not.

I am using the following code

Dim ddlPsize As DropDownList
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")

I obviously need to loop through the rows of the datagrid but I can
not seem to get it to work. I tried something like this

Dim i As Integer
Dim wRowsCount As Integer = itemInfo.Items.Count
Dim ddlPsize As DropDownList

For i = 0 To wRowsCount - 1

ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")

Next

But it did nothing

Ideas?

Thanks
LK

Oct 9 '07 #1
5 5465
If you are with asp.net 2.0, you can set AppendDataBoundItems = true and add
the size item in the markup.

If you are with 1.1, move your loop to the PreRender event. You can also
insert ddl items for every datagrid item in the datagrid's ItemDataBound
event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Me LK" <kl*****@charter.netwrote in message
news:11*********************@k79g2000hse.googlegro ups.com...
>I need to add a line to choose a size into a dropdown . Since I have
the dropdown nested inside a datagrid this is not working.When a page
displays there are several rows of dropdowns but only the top dropdown
has the option added. The others do not.

I am using the following code

Dim ddlPsize As DropDownList
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")

I obviously need to loop through the rows of the datagrid but I can
not seem to get it to work. I tried something like this

Dim i As Integer
Dim wRowsCount As Integer = itemInfo.Items.Count
Dim ddlPsize As DropDownList

For i = 0 To wRowsCount - 1

ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")

Next

But it did nothing

Ideas?

Thanks
LK

Oct 9 '07 #2
tried the origional code in the datagrid prerender, the page prerender
and the itemdatabound events. Nothing. Also tried the following code
in all three. Still nada. Any more ideas?
Dim myDataGridITem As DataGridItem
For Each myDataGridITem In itemInfo.Items
Dim ddlPsize As DropDownList
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")

Next
On Oct 9, 2:14 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
If you are with asp.net 2.0, you can set AppendDataBoundItems = true and add
the size item in the markup.

If you are with 1.1, move your loop to the PreRender event. You can also
insert ddl items for every datagrid item in the datagrid's ItemDataBound
event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

"Me LK" <klka...@charter.netwrote in message

news:11*********************@k79g2000hse.googlegro ups.com...
I need to add a line to choose a size into a dropdown . Since I have
the dropdown nested inside a datagrid this is not working.When a page
displays there are several rows of dropdowns but only the top dropdown
has the option added. The others do not.
I am using the following code
Dim ddlPsize As DropDownList
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")
I obviously need to loop through the rows of the datagrid but I can
not seem to get it to work. I tried something like this
Dim i As Integer
Dim wRowsCount As Integer = itemInfo.Items.Count
Dim ddlPsize As DropDownList
For i = 0 To wRowsCount - 1
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")
Next
But it did nothing
Ideas?
Thanks
LK- Hide quoted text -

- Show quoted text -

Oct 9 '07 #3
Should be

dlPsize = (myDataGridITem FindControl("ddlsizes"))

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Me LK" <kl*****@charter.netwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
tried the origional code in the datagrid prerender, the page prerender
and the itemdatabound events. Nothing. Also tried the following code
in all three. Still nada. Any more ideas?
Dim myDataGridITem As DataGridItem
For Each myDataGridITem In itemInfo.Items
Dim ddlPsize As DropDownList
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")

Next
On Oct 9, 2:14 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
>If you are with asp.net 2.0, you can set AppendDataBoundItems = true and
add
the size item in the markup.

If you are with 1.1, move your loop to the PreRender event. You can also
insert ddl items for every datagrid item in the datagrid's ItemDataBound
event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP
[ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

"Me LK" <klka...@charter.netwrote in message

news:11*********************@k79g2000hse.googlegr oups.com...
>I need to add a line to choose a size into a dropdown . Since I have
the dropdown nested inside a datagrid this is not working.When a page
displays there are several rows of dropdowns but only the top dropdown
has the option added. The others do not.
I am using the following code
Dim ddlPsize As DropDownList
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")
I obviously need to loop through the rows of the datagrid but I can
not seem to get it to work. I tried something like this
Dim i As Integer
Dim wRowsCount As Integer = itemInfo.Items.Count
Dim ddlPsize As DropDownList
For i = 0 To wRowsCount - 1
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")
Next
But it did nothing
Ideas?
Thanks
LK- Hide quoted text -

- Show quoted text -


Oct 9 '07 #4
Yes!!! Thats IT!!!

Thanks

On Oct 9, 10:46 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Should be

dlPsize = (myDataGridITem FindControl("ddlsizes"))

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

"Me LK" <klka...@charter.netwrote in message

news:11**********************@k79g2000hse.googlegr oups.com...
tried the origional code in the datagrid prerender, the page prerender
and the itemdatabound events. Nothing. Also tried the following code
in all three. Still nada. Any more ideas?
Dim myDataGridITem As DataGridItem
For Each myDataGridITem In itemInfo.Items
Dim ddlPsize As DropDownList
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")
Next
On Oct 9, 2:14 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
If you are with asp.net 2.0, you can set AppendDataBoundItems = true and
add
the size item in the markup.
If you are with 1.1, move your loop to the PreRender event. You can also
insert ddl items for every datagrid item in the datagrid's ItemDataBound
event.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP
[ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
"Me LK" <klka...@charter.netwrote in message
>news:11*********************@k79g2000hse.googlegr oups.com...
I need to add a line to choose a size into a dropdown . Since I have
the dropdown nested inside a datagrid this is not working.When a page
displays there are several rows of dropdowns but only the top dropdown
has the option added. The others do not.
I am using the following code
Dim ddlPsize As DropDownList
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")
I obviously need to loop through the rows of the datagrid but I can
not seem to get it to work. I tried something like this
Dim i As Integer
Dim wRowsCount As Integer = itemInfo.Items.Count
Dim ddlPsize As DropDownList
For i = 0 To wRowsCount - 1
ddlPsize = (itemInfo.Items(0).FindControl("ddlsizes"))
ddlPsize.Items.Insert(0, "Choose a Size")
Next
But it did nothing
Ideas?
Thanks
LK- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

Oct 9 '07 #5
Ooops not it. It shows correctly but now it send the top line (select
a size) to the database instead of the acutal size.

Did I miss something?

Oct 9 '07 #6

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

Similar topics

2
by: Jas | last post by:
I want an ASP page with a dropdown and a simple button. Every time the user chooses an item from the dropdown and clicks on the button i want that value written below in list and allow user to...
1
by: DC Gringo | last post by:
I'm having such a problem with this DropDownList in a user control that is posting back and throwing an error: System.Web.HttpException: A DropDownList cannot have multiple items selected ...
0
by: Tim::.. | last post by:
Can someone please help! I'm trying to write an insert statement for a complex datagrid! The database consists of the following data structure! ..tblContent PageID PK ModDate Description...
2
by: Xavier | last post by:
Hello, I'm working on VS 2003 with the framework 1.1 SP1. I'm trying to insert a combobox on a datagrid . If i use a combobox with the property dropdownstyle = dropdownlist it's OK but if I...
0
by: Elton Wang | last post by:
Hi Bruce, As Cor's suggestion, it's better to post Web DataGrid questions in either dotnet.framework.aspnet or more specially in dotnet.framework.aspnet.datagrid group. Anyway, following code...
2
by: Peter | last post by:
ASP.NET 2003 In the DataGrid how do I select current cell value in the dropdown box when I click on the edit link, currently when I click on the edit link in the DataGrid the dropdown box...
2
by: echan8 | last post by:
I have a dropdown list in a datagrid which I am dynamically adding items to with JavaScript. When I try to access the value of the dropdown list on postback, there is no value. The value is...
1
by: tshad | last post by:
I need to do some work with Javascript and my datagrid controls. I want to do something like: ********************************************************* function CheckQuestion() { var checkBox...
13
by: PetterL | last post by:
I writing a program where I read menu items from a file. But I have problem when I click an menu item i want it to mark that one as checked but I cant access the menu object of that item to see...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.