Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Cascading ComboBox in RadGridView retrieving data from SQL

$
0
0

Hi support!

 I have search for cascading comboboxes inside radgridview and found a couple of sample, but all of them use data in class.

My scenario is different.

I have 1 radgridview where ItemSource is bind to a SQL table (using LINQ to SQL binding). My table is similar to this:

- Transaction_Type

- Customer_ID (GridViewComboBoxColumn1)

- Invoice_ID (GridViewComboBoxColumn2)

- Amount

- User_ID

So, I want to apply combobox cascading on columns "Customer_ID" and "Invoice_ID". Right now, I am setting Customer_ID.ItemsSource and Invoice_ID.ItemsSource with results from a query I execute on Main_Loaded_Event (I query database asyn via WCF webservice, and then I use these lines to set itemssource:

((Telerik.Windows.Controls.GridViewComboBoxColumn)this.GridControl_1.Columns["Account_Invoice_ID"]).ItemsSource = e.Result.metodo_sp_Account_Invoice_SelectResult

 

So, this specific ItemsSource (Invoice_ID) already contains a "relation" data to Customer.

The problem is that I can't find how to link both comboboxes..

I tried to use BeginningEdit event from radgridview to filter the second combobox (Invoice_ID) but this is not working properly. This is what I have:

((Telerik.Windows.Controls.GridViewComboBoxColumn)(((Telerik.Windows.Controls.GridView.GridViewCellBase)(e.Cell)).Column)).ItemsSource = Customer_Invoices.Where(x => x.Customer_ID == SelectedCustomerID).

 The problem with this approach, is that while editing a row, this filters ALL rows comboboxes, causing empty results on rows not being edited.

Is there any sample project for cascading comboboxes in a radgridview when using WCF webservices?

 

Thanks!


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>