The problem I have is this: I have one GridView with a list objects as its data source, it binds with no problem. I have a DropDownList which have the event SelectedIndexChanged, and with this event, I add a new object to the list, after added I want to do a GridView1.Databind() so the new object appears in the GridView.
But this does not work, after I do GridView1.Databind() the data from the GridView gets lost. It even shows the EmptyDataText, but if I refresh the page, everything appears. Also, the DropDownList uses an object list as DataSource and was supposed to use DropDownList1.Databind() but it doesn't work too. It has the same data after the DataBinding, what I did to correct at least the DropDownList was to set the DropDownList again manually.DataTextField = object.attribute1 and DropDownList.DataValueField = object.attribute2. But with the GridView I'm stuck, can someone explain how the method DataBind works with a list of objects?