Hi..
I created one user control.this control contains a xamdatagrid with some data taking from one class.
Now i use this control as it is in one window.Now i want to add one new record to this control.
here i want to add this new record means..
Xamdatagrid1.datasource property is not there...how to bind new record to this control.
when i write code for button click new record is not adding..
Can u suggest some sample code to work with user controls to add modify and delete data.
Here i m using xml as my data source..
Please give reply as soon as possible.
Thank u in advance.
Hello,
I am not sure I understand the whole problem. How is the DataSource property not there?
Which is your data source - xml or data from a class?
Assuming that your control is in the main window, you can access it and get reference to the grid inside it like this:
XamDataGrid xamDataGrid = Infragistics.Windows.Utilities.GetAncestorFromType(myUserControl, typeof(XamDataGrid), false) as XamDataGrid;
Then you can get its DataSource and add new records in it -
BindingList<int> integers = control.xamDataGrid1.DataSource as BindingList<int>;
integers.Add(2);
Alex.
Hi Alex..
Thanks for ur quick reply..
Here i create one user control with one xamdatagrid named as xamdatagrid1.
initially grid contains data taking from one class.
Now i use this controls as it is in one window.
Now i want to add one record to this grid.
its giving new record but the old data is not appearing..it is replacing the new record with the old data.
Here my data is presently from one class.
<ObjectDataProvider x:Key="odpObjectDataProvider1" ObjectType="{x:Type local:PhaseBusinessLogic
}"
>
</ObjectDataProvider>
<
=Phase11}">
/>
="True" />
="True"
Presently not from xml..the grid data is taking from one cl***mply static data.
Now i want to add new record to this grid..the new record should be added to bottom fixed.
Can u suggest some answer for this..
thank u in advance..
The code you have pasted is not enought for me to say where the problem might be coming from - I cannot see your user control anywhere, also the code you are using to add the new record.
It is best to attach a sample project to your next post here so that we can look it in (if it is possible) or contact developer support directly on the link below.
http://ko.infragistics.com/support/submitrequest.aspx