Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / November 2007

Tip: Looking for answers? Try searching our database.

Drop down question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Me LK - 11 Nov 2007 05:25 GMT
I have a nested dropdown inside a datagrid.  One for colors one for
sizes. Not all items have colors or sizes, however, so I need to find
a way to detect if the drop down is blank and make the control not
visible.  If there is a value then I need to add a choose a size. I am
having no problem with the choose a size being added to the control.
It just does not recognize when the value is null or blank. The
control is still visible.

  Dim myDataGridITem As DataGridItem

           For Each myDataGridITem In itemInfo.Items

               Dim ddlPsize As DropDownList
               ddlPsize = (myDataGridITem.FindControl("ddlsizes"))

               If ddlPsize.DataTextField Is GetType(DBNull) Then
                   ddlcolors.Visible = False

               Else

                   ddlPsize.Items.Insert(0, "Choose a Size")
               End If
                         Next
Barrie Wilson - 11 Nov 2007 07:57 GMT
a little hard to follow what you're iterating here but, from what I think I
get of it, it seems to me your table of "items" should probably have a
column (or two) that indicates whether or not color and size are attributes
of the item ... of course you can test these values and then respond
accordingly on the DDList(s)

the other thought I have:  why don't you test for "ddlPsize.Items.Count < 1"
rather than "ddlPsize.DataTextField Is GetType(DBNull)" ?

and the logic looks puzzling: if there's no color, then you choose a size ..
and vice-versa;  doesn't sound right ....

>I have a nested dropdown inside a datagrid.  One for colors one for
> sizes. Not all items have colors or sizes, however, so I need to find
[quoted text clipped - 19 lines]
>                End If
>                          Next
Me LK - 11 Nov 2007 19:00 GMT
Thanks your answer worked.

I also found an error in my code regarding size and color as you
noticed.

  If ddlPsize.DataTextField Is GetType(DBNull) Then
                   ddlcolors.Visible = False

should have read

  If ddlPsize.DataTextField Is GetType(DBNull) Then
                 ddlPsize.Visible = False

I have the same coding for both size AND color not one OR the other.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.