Why can't ms make API's somewhat compatable

L

Lloyd Sheen

<rant>

In asp.net you define the datasource and do a databind to cause the contents
of a control to change. In winforms (combobox as example) I just spent a
while trying to figure out the equivalent.

Refresh - Nope
Datasource = new datasource - Nope

but

Datasource=Nothing
Datasource=new datasource - Yes

Makes no sense and is about as easy to figure out as Vista is.

</rant>

LS
 
C

Cor Ligthert[MVP]

Lloyd,

They were much more compatible, it get always the idea that (some) people
who were doing classic ASP want that behaviour.

(A kind of that (some) VB6 people want only that behaviour)

Cor
 
L

Lloyd Sheen

Cor,

I would think that a Databind method is much easier to understand than
setting the datasource to nothing and then to the source.

I think the asp way is much more logical. Setting something to nothing
while it may cause a refresh is really not very intuitive.

Thanks
Lloyd Sheen
 
C

Cor Ligthert[MVP]

Lloyd,

There is not any need to set a datasource to nothing in normal
circumstances.

This can only be as you want to show an empty grid.

Cor
 
L

Lloyd Sheen

Cor Ligthert said:
Lloyd,

There is not any need to set a datasource to nothing in normal
circumstances.

This can only be as you want to show an empty grid.

Cor

On the load of the app I load a dropdown. There is a second dropdown who's
value depend on the first dropdown. When the selection in the first is
changed I rebind the second dropdown. If I do not set the datasource to
nothing and then databind the list contains the original items.

I put a little debugging code in the selectionchange event and found that
without setting the datasource to nothing I would have the datasource with a
different number of items than the number of items in the dropdown. Setting
the datasource to nothing prior to resetting the datasource fixed the
problem.

LS
 
J

Jack Jackson

On the load of the app I load a dropdown. There is a second dropdown who's
value depend on the first dropdown. When the selection in the first is
changed I rebind the second dropdown. If I do not set the datasource to
nothing and then databind the list contains the original items.

I put a little debugging code in the selectionchange event and found that
without setting the datasource to nothing I would have the datasource with a
different number of items than the number of items in the dropdown. Setting
the datasource to nothing prior to resetting the datasource fixed the
problem.

LS

What type of object is the data source? Perhaps it doesn't implement
a notification event that would tell the control to refetch its list.
 
L

Lloyd Sheen

Jack Jackson said:
What type of object is the data source? Perhaps it doesn't implement
a notification event that would tell the control to refetch its list.

Datasource is a list(of anyobject).

Problem exists for any object.

LS
 
C

Cor Ligthert[MVP]

Lloyd,

Can be a bug or whatever, however a workaround is never common behaviour.
You are talking about compatibility.

Cor
 
J

Jack Jackson

Datasource is a list(of anyobject).

Problem exists for any object.

LS

My guess is that if you used BindingList(Of T) instead of List, the
bound control would be notified when the list changes and you wouldn't
have to rebind. BindingList implements IBindingList which supports
pushing updates both ways.
 
L

Lloyd Sheen

Jack Jackson said:
My guess is that if you used BindingList(Of T) instead of List, the
bound control would be notified when the list changes and you wouldn't
have to rebind. BindingList implements IBindingList which supports
pushing updates both ways.

Ok I just tried to change the to BindingList. First off there is no
addrange, second no sort.

But lets get to what I was saying. Why are the api's for asp and win apps
different. MS is supposed to be making things easy for developers (or at
least that is the appearance they give).

Lloyd Sheen
 
C

Cor Ligthert[MVP]

Lloyd,

You are the first who calls not the method to databind something well, I
never have understood why it was only needed by aspnet.

Cor
 
L

Lloyd Sheen

Cor Ligthert said:
Lloyd,

You are the first who calls not the method to databind something well, I
never have understood why it was only needed by aspnet.

Cor

Cor,

My concern is not whether either is correct. It is because MS does not
seem to understand or care that having different sets of API's for
essentially the same operation goes against everything they preach. Look at
the various connections, dataadapters etc. Since they "implement" they are
forced to have a common interface. Why MS could not do something similar
with databinding is beyond me.

Lloyd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top