smichaels1234
Registered User.
- Local time
- Today, 05:12
- Joined
- May 12, 2008
- Messages
- 64
Hi all,
I am hoping that someone might know the answer to this. I have built just a simple form in VS.Net 2005 using Ajax controls. I have a form that has 2 Drop Down Lists called ddlBusinessUnit and the other called ddlUnitNum. I dragged 2 CascadingDropDownLists to the Form as well. In each I set there parameters for Child and Parent Lists. ddlBusinessUnit is the Parent and ddlUnitNum is the Child. I also created a webservice and this is where all of my code behind is going. The problem that I am having is that I am creating 2 different Functions which are here:
<WebMethod()> _
Public Function GetBusinessUnit(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim values As New List(Of CascadingDropDownNameValue)
Dim conn As New SqlConnection(WebConfigurationManager.ConnectionStrings("PS_PRODConnectionString").ConnectionString)
Dim comm As New SqlCommand("SELECT DISTINCT NBMCU, NBUNIT FROM PRODDTA.F1521", conn)
Dim reader As SqlDataReader
reader = comm.ExecuteReader
While reader.Read
values.Add(New CascadingDropDownNameValue(reader("NBMCU").ToString(), reader("NBUNIT").ToString()))
End While
Return values.ToArray
End Function
<WebMethod()> _
Public Function GetUnitNum(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
If Not (kv.ContainsKey("NBMCU")) Then
Return Nothing
End If
Dim values As New List(Of CascadingDropDownNameValue)
Dim conn As New SqlConnection(WebConfigurationManager.ConnectionStrings("PS_PRODConnectionString").ConnectionString)
Dim comm As New SqlCommand("dbo.SP_PRODDTA_F1521_UnitNum", conn)
comm.CommandType = Data.CommandType.StoredProcedure
Dim ad As New SqlDataAdapter(comm)
Dim ds As New DataSet
ad.Fill(ds)
For Each row As DataRow In ds.Tables(0).Rows
values.Add(New CascadingDropDownNameValue(row("NBUNIT").ToString(), row("NBMCU").ToString()))
Next
Return values.ToArray
End Function
And the problem that I am having is here:
values.Add(New CascadingDropDownNameValue(reader("NBMCU").ToString(), reader("NBUNIT").ToString()))
Because I want to only have 1 "NBMCU" Field in this expression like so:
values.Add(New CascadingDropDownNameValue(reader("NBMCU").ToString()))
So my question is what can I do to specify only 1 field and no other fields.
I am hoping that someone might know the answer to this. I have built just a simple form in VS.Net 2005 using Ajax controls. I have a form that has 2 Drop Down Lists called ddlBusinessUnit and the other called ddlUnitNum. I dragged 2 CascadingDropDownLists to the Form as well. In each I set there parameters for Child and Parent Lists. ddlBusinessUnit is the Parent and ddlUnitNum is the Child. I also created a webservice and this is where all of my code behind is going. The problem that I am having is that I am creating 2 different Functions which are here:
<WebMethod()> _
Public Function GetBusinessUnit(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim values As New List(Of CascadingDropDownNameValue)
Dim conn As New SqlConnection(WebConfigurationManager.ConnectionStrings("PS_PRODConnectionString").ConnectionString)
Dim comm As New SqlCommand("SELECT DISTINCT NBMCU, NBUNIT FROM PRODDTA.F1521", conn)
Dim reader As SqlDataReader
reader = comm.ExecuteReader
While reader.Read
values.Add(New CascadingDropDownNameValue(reader("NBMCU").ToString(), reader("NBUNIT").ToString()))
End While
Return values.ToArray
End Function
<WebMethod()> _
Public Function GetUnitNum(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
If Not (kv.ContainsKey("NBMCU")) Then
Return Nothing
End If
Dim values As New List(Of CascadingDropDownNameValue)
Dim conn As New SqlConnection(WebConfigurationManager.ConnectionStrings("PS_PRODConnectionString").ConnectionString)
Dim comm As New SqlCommand("dbo.SP_PRODDTA_F1521_UnitNum", conn)
comm.CommandType = Data.CommandType.StoredProcedure
Dim ad As New SqlDataAdapter(comm)
Dim ds As New DataSet
ad.Fill(ds)
For Each row As DataRow In ds.Tables(0).Rows
values.Add(New CascadingDropDownNameValue(row("NBUNIT").ToString(), row("NBMCU").ToString()))
Next
Return values.ToArray
End Function
And the problem that I am having is here:
values.Add(New CascadingDropDownNameValue(reader("NBMCU").ToString(), reader("NBUNIT").ToString()))
Because I want to only have 1 "NBMCU" Field in this expression like so:
values.Add(New CascadingDropDownNameValue(reader("NBMCU").ToString()))
So my question is what can I do to specify only 1 field and no other fields.