Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

malo komplikovaniji databinding

[es] :: .NET :: malo komplikovaniji databinding

[ Pregleda: 2601 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

PeraKojovic
Petar Kojovic
Novi Sad

Član broj: 95569
Poruke: 56
*.ns.ac.yu.



Profil

icon malo komplikovaniji databinding01.09.2006. u 12:38 - pre 214 meseci
Pozdrav, posto sam pitanje postavio na stranim forumima, ne bih da ga prevodim:

Hi all, here is my problem:

(system is VS 2005, C#, ADO .NET 2)
I have a bindingsource, a datagrid, and set of details like fields on the same
form. Next, there are following bindings set:

void Init()
{
BindingSource.DataSource = someLocalTable
datagrid.DataSource = BindingSource

for every control
{
Control.DataBinding.Add("...", BindingSource, "...")
}
}

Moving through a datagrid changes the data in bound detail controls, hence
BindingSource too, changes position. Changing data in controls changes
the data in selected dataGrid row.

The problem is:
I have a button "Insert New", that does exactly this:

1. adds a new row in the local someLocalTable and
fills it with the default values:
DataRow dr = someLocalTable.NewRow();
... fill default values
someLocalTable.Rows.Add(dr);

2. TRIES TO CHANGE THE BINDINGSOURCE-s POSITION TO LAST(newly created table row)
3. This is the step where after changing position on the bindingSource
to the newly created row (.MoveLast()), you expect detail fields change
to null (or empty), and dataGrid changes the ActiveRow and position

However, after adding new row to someLocalTable, I can not change the position
of the bindingSource to that new row. BindingSource.Count returns good nr. of
rows, including the newly created. I tried a lots of things, like rebind all
controls like on the Init method, still no luck. Am I missing something here?
I forgot to mention that the grid is actually Infragistics ultraGrid, but that
doesn't change the basic concept...

Pera
 
Odgovor na temu

mmix
Miljan Mitrović
Profesorkin muz
Passau, Deutschland

SuperModerator
Član broj: 17944
Poruke: 6042



+4631 Profil

icon Re: malo komplikovaniji databinding01.09.2006. u 14:52 - pre 214 meseci
Probaj da novi red dodas kroz BindingSource.AddNew(), to ce ti ujedno vratiti Row (mislim da ce biti umotan u RowView) da mozes da ga menjas programski.

Sloba je za 12 godina promenio antropološki kod srpskog naroda. On je od jednog naroda koji je bio veseo, pomalo površan, od jednog naroda koji je bio znatiželjan, koji je voleo da vidi, da putuje, da upozna,
od naroda koji je bio kosmopolitski napravio narod koji je namršten, mrzovoljan, sumnjicav, zaplašen, narod koji se stalno nešto žali, kome je stalno neko kriv… - Z.Đinđić
 
Odgovor na temu

PeraKojovic
Petar Kojovic
Novi Sad

Član broj: 95569
Poruke: 56
*.ns.ac.yu.



Profil

icon Re: malo komplikovaniji databinding04.09.2006. u 09:06 - pre 214 meseci
Hvala na odgovoru, nisam stigao da probam, ali,
problem je bio u null vrednostima, koje neke kontrole databinding-a bas ne podnose.
Neverovatno, ali mucilo me je (s vremena na vreme sam pokusavao da sredim) barem
nedelju dana...

Pera
 
Odgovor na temu

[es] :: .NET :: malo komplikovaniji databinding

[ Pregleda: 2601 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.