Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 17th, 2010, 06:11 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Default

sir, I am having problem in coding the if construct.

Code:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" AppendDataBoundItems="true" DataSourceID="LinqDataSource1" DataTextField="Name" DataValueField="Id" Width="129px">
    <asp:ListItem Value="-1">Please Choose Album</asp:ListItem>
</asp:DropDownList>
in the page_load event I am trying to set up the if construct like
Code:
If Not DropDownList1.SelectedItem Then
            ListView1.Visible = False
End If
But in first line I am having problem to properly code it.
how I can check the selected item for nothing ("asp:ListItem Value="-1">Please Choose Album</asp:ListItem>")?
 
Old April 17th, 2010, 06:48 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi sophia,

Quote:
how I can check the selected item for nothing
It's not Nothing; it's -1, so this should work:

Code:
If Not DropDownList1.SelectedValue = -1 Then
            ListView1.Visible = False
End If
Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 17th, 2010, 06:57 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Default

Not working.
Still getting the same message with Please Choose Album option.
Any other method to solve???
 
Old April 17th, 2010, 07:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If you debug, what's the value of the SelectedItem / SelectedValue?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 17th, 2010, 07:17 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Default

Problem was as we were getting the same value (-1) so it was getting out of loop due to NOT in if construct. I did remove it and now working fine.
Heuh a little missing made a thing giant.
well problem solved but thanks goes to you
Thank you sir.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Photo Album Questions m3ben BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 April 4th, 2007 12:12 PM
paging in photo album xperre BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 April 2nd, 2007 03:32 PM
Error posting photo to photo album abel714 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 10 February 5th, 2007 03:07 AM
Wrox Photo Album Help rsearing BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 6 September 27th, 2006 02:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.