Hi
I am using RIA service and domainDatasource control in order to supply the data to the radgridview
My current problem is that:
-pressing delete one time for a row is ok. However, if i press multiple delete(right now is 3 times continuously), the first two rows will be deleted safely but it will crash at the 3rd row because it says that other delete is in process(maybe it is waiting for the process submiting the change back to the database)
Note: i check on your demo and notice that every time i delete a row. The grid won't automatically highlight the next row. It is good because every time i need to delete a row , i have to select it first . THat might fix my problem. However, I don't know how to defocus like that
+Can you also check for me whether the method i am using for setting default value of a cell in a row is correct or not?
the problem is that if i switch the order of these two then it won't work. Not sure why?
this is my code:
Code behind
I am using RIA service and domainDatasource control in order to supply the data to the radgridview
My current problem is that:
-pressing delete one time for a row is ok. However, if i press multiple delete(right now is 3 times continuously), the first two rows will be deleted safely but it will crash at the 3rd row because it says that other delete is in process(maybe it is waiting for the process submiting the change back to the database)
Note: i check on your demo and notice that every time i delete a row. The grid won't automatically highlight the next row. It is good because every time i need to delete a row , i have to select it first . THat might fix my problem. However, I don't know how to defocus like that
+Can you also check for me whether the method i am using for setting default value of a cell in a row is correct or not?
the problem is that if i switch the order of these two then it won't work. Not sure why?
(financialAccountDomainDataSource.DomainContext
as
FinancialAccountContext).FinancialAccounts.Add(financialAccount);
e.NewObject = financialAccount;
this is my code:
<
riaControls:DomainDataSource
AutoLoad
=
"True"
d:DesignData
=
"{d:DesignInstance my:FinancialAccount, CreateList=true}"
Height
=
"0"
LoadedData
=
"financialAccountDomainDataSource_LoadedData"
Name
=
"financialAccountDomainDataSource"
QueryName
=
"GetFinancialAccountsQuery"
Width
=
"0"
Margin
=
"0,0,616,416"
>
<
riaControls:DomainDataSource.DomainContext
>
<
my1:FinancialAccountContext
x:Name
=
"financialAccountContext"
/>
</
riaControls:DomainDataSource.DomainContext
>
</
riaControls:DomainDataSource
>
<
telerik:RadGridView
ShowGroupPanel
=
"False"
DataLoadMode
=
"Asynchronous"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding ElementName=financialAccountDomainDataSource, Path=Data}"
Name
=
"financialAccountRadGridView"
AddingNewDataItem
=
"financialAccountRadGridView_AddingNewDataItem"
RowEditEnded
=
"financialAccountRadGridView_RowEditEnded"
Deleted
=
"financialAccountRadGridView_Deleted"
EnableRowVirtualization
=
"True"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding AccountNumber, Mode=TwoWay}"
Header
=
"Account Number"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding AccountDescription, Mode=TwoWay}"
Header
=
"Account Name"
/>
<
telerik:GridViewComboBoxColumn
ItemsSource
=
"{Binding ListFinancialTypes, Source={StaticResource financialAccountTypes}}"
DataMemberBinding
=
"{Binding FinancialAccountTypeId, Mode=TwoWay}"
Header
=
"Account Type"
DisplayMemberPath
=
"AccountTypeName"
SelectedValueMemberPath
=
"FinancialAccountTypeId"
/>
<
telerik:GridViewComboBoxColumn
ItemsSource
=
"{Binding ListofActiveStatus, Source={StaticResource activeStatusList}}"
DataMemberBinding
=
"{Binding Active, Mode=TwoWay}"
Header
=
"Active"
UniqueName
=
"Active"
DisplayMemberPath
=
"ActiveDes"
SelectedValueMemberPath
=
"ActiveInt"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ConsolidationAccount, Mode=TwoWay}"
Header
=
"Consolidation"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
Code behind
//TODO: setting default value for Active property of financial Account before inserting
private
void
financialAccountRadGridView_AddingNewDataItem(
object
sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
var financialAccount =
new
FinancialAccount();
financialAccount.Active = 1;
(financialAccountDomainDataSource.DomainContext
as
FinancialAccountContext).FinancialAccounts.Add(financialAccount);
e.NewObject = financialAccount;
}
private
void
financialAccountRadGridView_RowEditEnded(
object
sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e)
{
financialAccountDomainDataSource.DomainContext.SubmitChanges();
}
private
void
financialAccountRadGridView_Deleted(
object
sender, Telerik.Windows.Controls.GridViewDeletedEventArgs e)
{
financialAccountDomainDataSource.DomainContext.SubmitChanges();
}