Do not use on any
shared computer
September 6, 2008 02:14pm pdt
 
[x]
Attachment Details

Set dropdownlist select value in gridview

I have two dropdownlists in a gridview.  When the first one, cboFabricProductID is selected I am trying to look up the factoryID and set another ddl.  Here is my code.  It is looking up the id but is not changing the second ddl, cbofactoryID.  Please help!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Dim vProduct As DropDownList = DirectCast(sender, DropDownList)
        Dim vProductID As Integer = vProduct.SelectedValue
 
        Dim mtg As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("TMCdb")
        Dim connection As New SqlConnection(mtg.ConnectionString)
        Dim cmd As New SqlCommand("Select FactoryID from tblProducts WHERE ProductID = " & vProductID & "", connection)
        Try
            connection.Open()
            Dim vFactoryID As Integer = cmd.ExecuteScalar
            Session("FactorID") = vFactoryID
            CType(gvOrderDetails.FindControl("cboFactoryID"), DropDownList).SelectedValue = vFactoryID
            connection.Close()
        Catch
        End Try
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: vzorn
Question Asked On: 05.10.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by DarkoLord

Rank: Wizard

Expert Comment by DarkoLord:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by vzorn
Author Comment by vzorn:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628