Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bubberz
Constraint Violating Yak Guru
289 Posts |
Posted - 2005-09-05 : 23:06:14
|
When I run this code I get:Object reference not set to an instance of an object.It's referring to the line of:ddlTitle1.DataSource = DSHere's the code:Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommandDataGrid1.EditItemIndex = e.Item.ItemIndex'Build the DDL For the Title sectionCon1.Open()Dim strDDL As StringstrDDL = "SELECT DISTINCT Title FROM Employees ORDER BY Title"Dim da As New OleDb.OleDbDataAdapter()da.SelectCommand = New OleDb.OleDbCommand(strDDL, Con1)Dim DS As New DataSet()da.Fill(DS)Dim ddlTitle1 As DropDownList = e.Item.FindControl("ddlTitle") ddlTitle1.DataSource = DS ddlTitle1.DataMember = "Employees" ddlTitle1.DataTextField = "Title" ddlTitle1.DataValueField = "Title" ddlTitle1.DataBind() Con1.Close() |
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
|
olay80
Yak Posting Veteran
62 Posts |
Posted - 2005-09-07 : 09:57:42
|
maybe ur not the dropdown object is not being instentiated correctly that's why it's not getting the datasource DSOliver |
 |
|
|
|
|