Attention: We are retiring the ASP.NET Community Blogs. Learn more >

BindingManager does not update control bound to a Child table

I think this is a bug.

See an example of this at http://dotnetrocks.blogspot.com/ Thursday, June 24, 2004 entry. 

I have a DataTable that contains 10 DataRows.

Lets call it "names".

I have a textbox on a form bound to the "names.enddate" field\datacolumn.

    Me.TextBox1.DataBindings.Add("Text", ds, "names.enddate")

The first DataRow does not have a value for enddate.

The 2nd DataRow does.

When I run the app, the textbox displays the Text set at Design Time ("This

is my test" in my example)

    Me.TextBox1.Location = New System.Drawing.Point(120, 56)

    Me.TextBox1.Name = "TextBox1"

    Me.TextBox1.TabIndex = 3

    Me.TextBox1.Text = "This is my test"

If I move to the next record by adding 1 to the Position

    Me.BindingContext(ds, "names").Position += 1

I see the value for enddate in the textbox for the 2nd DataRow.

If I move back to the first DataRow

    Me.BindingContext(ds, "names").Position -= 1

I no longer see "This is my test", I see a blank textbox, which is what I should see.

When I first run the app I should not see "This is my test" in the textbox, I should see an empty textbox.

See an example of this at http://dotnetrocks.blogspot.com/ Thursday, June 24, 2004 entry. 

 

 

 

 

No Comments