Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 January 12th, 2009, 11:31 PM
Authorized User
 
Join Date: Dec 2008
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Default Selecting All from Dropdowlist

Hello Eveybody:

I am having problems to display a dropdownlist control into a DataGrid. The problem is that when I select "All" from the dropdownlist my Gridview is empty. However for any other values is working fine. As you will see in the code "All" means All the records"

Dim sqlqry AsString
Dim dropdownvalue AsString
dropdownvalue = DropDownList1.SelectedValue
Dim comp AsInteger = String.Compare(dropdownvalue, "ALL")
'dropdownvalue = "ALL"

If comp = 0 Then
sqlqry = "select * from CompletedOrders"
Me.SqlDataSource2.SelectCommand = sqlqry
Else
sqlqry = "select * from CompletedOrders where Week#=@Week#"
Me.SqlDataSource2.SelectCommand = sqlqry
'Dim pm As New Parameter("CompletedOrders", TypeCode.Int32, 1)
'Me.SqlDataSource2.SelectParameters.Add(pm)
EndIf

Thank you. Let me know what is missing Here
 
Old January 12th, 2009, 11:52 PM
Authorized User
 
Join Date: Dec 2008
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Default

I know what happens, The value "All is Actually "All " this is because that comlum is nchard(5) and not nchard(3). Now everything is working fine.

Roberto




Quote:
Originally Posted by taboadar View Post
Hello Eveybody:

I am having problems to display a dropdownlist control into a DataGrid. The problem is that when I select "All" from the dropdownlist my Gridview is empty. However for any other values is working fine. As you will see in the code "All" means All the records"

Dim sqlqry AsString
Dim dropdownvalue AsString
dropdownvalue = DropDownList1.SelectedValue
Dim comp AsInteger = String.Compare(dropdownvalue, "ALL")
'dropdownvalue = "ALL"

If comp = 0 Then
sqlqry = "select * from CompletedOrders"
Me.SqlDataSource2.SelectCommand = sqlqry
Else
sqlqry = "select * from CompletedOrders where Week#=@Week#"
Me.SqlDataSource2.SelectCommand = sqlqry
'Dim pm As New Parameter("CompletedOrders", TypeCode.Int32, 1)
'Me.SqlDataSource2.SelectParameters.Add(pm)
EndIf

Thank you. Let me know what is missing Here




Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting MAX Value nirmal_s19 SQL Server ASP 1 May 8th, 2007 01:04 AM
help in selecting elements spandit XSLT 1 April 9th, 2007 07:27 PM
Selecting attributs Ma7T XSLT 2 August 5th, 2005 04:21 AM
Selecting Data.. NitinJoshi General .NET 3 January 18th, 2005 02:59 AM
Selecting once where there are many onlyu2 MySQL 1 March 25th, 2004 06:22 AM





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