I would like to populate a column's drop down provider with table data based on another column's value in the same row. Is this possible?
Do you happen to have a sample in VB instead of C#?
Yes It should.
Just download the attached sample adjust the references to match your own. Also ig_res folder is needed to be added to the project since I've removed it due to space upload limitation.
Thanks
Will this concept work with two SQL data sources?
Hi,
Let me know if you have any questions with this.
Thanks.
Hello davefevold,
The attached sample shows how can be implemented cascading WebDropDown in context of WebDataGridThe user is able to click on cell from Category column to choose one. Then when the user click on the next cell from Title column all titles will be filtered on the server based on the chosen category.
ASPx page:
Code behind:
public partial class _Default : System.Web.UI.Page { Order order = null; protected void Page_Load(object sender, EventArgs e) { order= new Order(); WebDataGrid1.DataSource = order.Books; } protected void eProvider_ItemsRequested(object sender, DropDownItemsRequestedEventArgs e) { Category param = (Category)Enum.Parse(typeof(Category), e.Value.ToString()); List<Book> list = order.Books .ToList() .Where(p => p.CategoryBook == param) .ToList<Book>(); ((WebDropDown)sender).DataSource = list; ((WebDropDown)sender).TextField = "Title"; ((WebDropDown)sender).Items.Clear(); ((WebDropDown)sender).DataBind(); } public enum Category { ASP, PHP, JAVA } public class Book { public Category CategoryBook { get; set; } public int BookId { get; set; } public string Title { get; set; } } public class Order { public List<Book> _books; public List<Book> Books { get { return _books; } } public Order() { //init for books _books = new List<Book>(); _books.Add(new Book() { BookId = 1, CategoryBook = Category.PHP, Title = "Pro PHP: Patterns, Frameworks, Testing and More" }); _books.Add(new Book() { BookId = 2, CategoryBook = Category.PHP, Title = "Beginning PHP and MySQL: From Novice to Professional, Third Edition" }); _books.Add(new Book() { BookId = 3, CategoryBook = Category.ASP, Title = "Foundations of ASP.NET AJAX" }); _books.Add(new Book() { BookId = 4, CategoryBook = Category.ASP, Title = "Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional, Second Edition" }); _books.Add(new Book() { BookId = 5, CategoryBook = Category.ASP, Title = "Pro ASP.NET MVC Framework" }); _books.Add(new Book() { BookId = 6, CategoryBook = Category.ASP, Title = "Beginning ASP.NET E-Commerce in C#: From Novice to Professional" }); _books.Add(new Book() { BookId = 7, CategoryBook = Category.JAVA, Title = "Beginning Java™ EE 6 Platform with GlassFish™ 3: From Novice to Professional" }); _books.Add(new Book() { BookId = 8, CategoryBook = Category.JAVA, Title = "Practical Liferay: Java–based Portal Applications Development" }); } } }