Guest hb2 Posted October 20, 2005 Share Posted October 20, 2005 i have a questioon..why when i create a DropDownList item in asp.net and bind it to database value then try to display it :Dim DropDownList1 As New DropDownListDim objCmd As New OleDbCommand("SELECT id FROM student", objConn)Dim objD As OleDbDataAdapterobjD = New OleDbDataAdapter(objCmd)Dim data As New DataSetobjD.Fill(data, "student")DropDownList1.DataSource = dataDropDownList1.DataBind()Response.Write(DropDownList1)the final result in the screen is not the dropdownlist but:System.Web.UI.WebControls.DropDownList so what is the problem?? Link to comment Share on other sites More sharing options...
Guest michrf Posted October 25, 2005 Share Posted October 25, 2005 hi hb2... you must specify value for the datagrid.datvalue and datagrid.datatext (im not sure abt the syntax though) ... DropDownList1.DataSource = data DropDownList1.DataValue = column name DropDownList1.DataText = column name DropDownList1.DataBind() Link to comment Share on other sites More sharing options...
sarang Posted November 3, 2005 Share Posted November 3, 2005 I have a question.What is delay signature?And how it is made? Link to comment Share on other sites More sharing options...
aspnetguy Posted November 24, 2005 Share Posted November 24, 2005 You can't just use Response.Write. That is for writing text but DropDownList1 is an object.You have to add it to the Page COntrols.Dim DropDownList1 As New DropDownListDim objCmd As New OleDbCommand("SELECT id FROM student", objConn)Dim objD As OleDbDataAdapterobjD = New OleDbDataAdapter(objCmd)Dim data As New DataSetobjD.Fill(data, "student")DropDownList1.DataSource = dataDropDownList1.DataBind()Controls.Add(DropDownList1) 'Use this line to add it to the page Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now