Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
645
DataBindings between UltraUIElements and DataRow?
posted

Hi, all,

how does it work the databindings bidirectional between UIElements and one DataRow?

e.g. the Row has three columns (int, string datetime)

(1) Set Value from DataRow to UI

int id = Convert.ToInt32(myRow[0]);

string s = myRow[1].ToString();

DateTime d = Convert.ToDateTime(myRow[2]);

// remove all bindings

ultraCombo1.DataBindings.Clear();

ultraTextEditor1.DataBindings.Clear();

ultraCalendarCombo1.DataBindings.Clear();

// add new bindings

ultraCombo1.DataBindings.Add(new Binding("Text", id.ToString(), ""));

ultraTextEditor1.DataBindings.Add(new Binding("Text", s, "", true, DataSourceUpdateMode.OnValidation));

ultraCalendarCombo1.DataBindings.Add(new Binding("Value", d, "", true, DataSourceUpdateMode.OnValidation));

=> it works!

 

(2) Set Value from UI to DataRow

But after I change TextBox.Text, oder Datetime, I wish i can also see the changes on myRow...

I have tried these methods, but it does not work...

{

myRow.BeginEdit();

myRow.AcceptChanges();

myRow.EndEdit();

}

What's wrong? Many thanks!