Click here to Skip to main content
15,893,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

From past few hours i am struggling with very strange problem.

I have 3 drop down controls.
1st control is binding on page_load event
2nd control is binding on 1st drop down click
then its retrieving value and binding 3 drop down control > this happens on 1st drop down click only. Here goes issue, it shows datatable filled properly but not showing records in drop down on page.

Do anybody have an idea what issue can be.
Code is running properly.

code :
dtRequestBy = objDB.GetEmployeeName(cmbGroup.Text)
                    drRequestBy = dtRequestBy.NewRow()
                    drRequestBy.Item("FullName") = ""
                    drRequestBy.Item("Emp_id") = 0
                    dtRequestBy.Rows.InsertAt(drRequestBy, 0)
                    RadComboBox1.DataTextField = "FullName"
                    RadComboBox1.DataValueField = "Emp_id"
                    RadComboBox1.DataSource = dtRequestBy
                    RadComboBox1.DataBind()


Public Function GetEmployeeName(ByVal g_name As String) As DataTable
            Try
                cn = New SqlConnection(cnStr)
                cn.Open()

                Dim strSQL As String
                strSQL = "select emp.Emp_id, FullName = emp.Emp_Salutation + ' ' + emp.Emp_FirstName + ' ' + emp.Emp_LastName from employee emp left join groups gp on gp.g_id=emp.emp_g_id WHERE gp.g_Name='" & g_name & "' order by Emp_FirstName"
                Dim myDS As New DataSet
                Dim myDataAdapter As New SqlDataAdapter(strSQL, cn)
                myDataAdapter.Fill(myDS, "Employee")
                Return myDS.Tables(0)
            Catch ex As Exception

            Finally
                If cn.State = ConnectionState.Open Then cn.Close()
            End Try
        End Function


Any help is greatly appreciated.
Posted
Comments
Dipankar Basu 17-Nov-11 11:58am    
Do you want to say,
2nd and 3d DropDownList Filled after select a data from 1st DropDownList


Please explain .
Sushma_Patel 17-Nov-11 12:33pm    
Yes, 2 dropdown in binded and value is selected based on 1st dropdown click and based on 2 dropdown value 3rd dropdown is binded(this happens on 1st dropdown click only).
Eg. From category > Group is binded and value is selected and > Employee is binded based on group

1 solution

Data loaded but not show in DropDownList.

Set AutoPostBack "True" of 1st DropDownList. Hope this will work.
 
Share this answer
 
Comments
Sushma_Patel 17-Nov-11 12:45pm    
Yes, already set to True

<telerik:RadComboBox ID="cmbDocCode" runat="server" TabIndex="3" AutoPostBack="true" MarkFirstMatch="true" ToolTip="Select EmptyMessage="Select" Width="157px" Height="200px" Filter="Contains">

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900