Dropdown List help

M

Me LK

I have a drop down list nested in a datagrid. It works fine. When
there is no data in he DDL I change the list to visible = false and
show a label with the word "none". That works fine. What I need to do
now is list the word "none" in the database if there is no value in
the DDL. This I can not seem to do. Here is the code I have tried

Private Sub iteminfo_selectedindexchange(ByVal sender As
System.Object, ByVal e As EventArgs) Handles
itemInfo.SelectedIndexChanged


Dim Psize
Dim ddlPsize As DropDownList
ddlPsize =
itemInfo.Items(itemInfo.SelectedIndex).FindControl("ddlsizes")

If ddlPsize.Items.Count < 1 Then
Psize = "none"

Else
Psize = ddlPsize.SelectedValue
End If

If there is a value in the ddl then the correct value is placed in the
database. If there is no value in the DDL and the user clicks the add
to cart button the page refreshes, grid is gone and there is nothing
at all in the database.
 
D

David C

Why not just use AppendDataBoundItems="true" in DDL and just add a listitem
for "none".

David
 
M

Me LK

I believe that AppendDataBoundItems is ASP.NET 2 and I am using 1.1

I can't add a list item for none because the user doesn't know if
there is no size or if there is a size. If there is a size I need a
list of choices. If there is no size, because the item is a hat for
example, I need to drop down to disappear or else I will have a choose
a size and then the user has to select the word none. It seems tacky
that way. If I get desperate I will place the word none into the
database but I hoped that I could programmatically deal with it.
 
M

Me LK

I am not sure what you are saying. I just need a way to
programmatically send the word none into the database when there is no
value. I do not know why the programming above does not work. It seems
logical that the word none would be placed into the daabase if there
is no value from what I have programmed. If thre is a value then
the

Psize = ddlPsize.SelectedValue

works. Why doesn't the

Psize = "none"

work as well?
 

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,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top