Problem : Datagrid and databinding

Problem : Datagrid and databinding

Post by Marc L'Ecuye » Wed, 06 Mar 2002 00:28:58

I have a datagrid with 2 dropdownlist in edit mode. I have to filter the 2nd
dropdownlist when I select something in the 1st one. So I set the
AutopostBack property of the 1st dropdownlist to true, and I added this in
the HTML code for the 1st dropdown OnSelectedIndexChanged='Bleah'

Now, when I select something in the 1st dropdown, it calls the 'Bleah'
function. Here's the code I wrote in this function :

Dim str1stComboText As String =

CType(Session("MyTable"), DataTable).DefaultView.RowFilter = "cSpecial = '"
& str1stComboText & "'"

DropDownList).DataSource = CType(Session("MyTable"),


Everything's seems OK until I execute the Databind method. I receive the
error :

Object variable or With block variable not set.

Does anybody know what is wrong ?



1. Databinding problem with a datagrid

Hi All,

I am having problems trying to bind a datagrid to a dataset and table...
I pass an already filled dataset into a component then try to use the
"SetDataBinding" method of a datagrid, passing in the dataset and the
tablename I want to bind to.

Here's my Code:

'Form Constructor....
Public Sub New(ByRef ds As Data.DataSet, ByRef dr As Data.DataRow)
    'This call is required by the Windows Form Designer.


    MngmntDS = ds        'Set the already declared modular dataset to that
passed in...
    Call PopulateForm()

End Sub

Private Function PopulateForm()
        Me.dgTeams.SetDataBinding(MngmntDS, "Team")
    End Try
End Function

I get the following info on the error:

An unhandled exception of type 'System.Exception' occurred in
Additional information: Complex DataBinding accepts as a data source either
an IList or an IListSource

What am I doing wrong or not doing?

Any help?


2. Ring Tones

3. Problem with DataGrid.DataBind()

4. BSERead2.05 !!

5. PROBLEM: Calling Databind After Changing SelectedIndex in a DataGrid

6. answer to convert asp to with function CreateObject()

7. Datagrid, paging and databinding problems?

8. question in dlsw... does sdlc-2-sdlc work for dlsw?

9. Tricky Problem, databinding within databinding

10. Problem : Datagrid and databinding

11. DataGrid - Add New Row From DataGrid DataBind Event Handler?

12. Adding rows with databound datagrid and the binding going funny

13. oracle databind to datagrid now returning anything