![]() |
| ||
| Master/Detail DropDownList and DataGrid Guys I have a dropdownlist control with categories so when I select something from ddlCategory I wana display all the products fall under that category in a datagrid but I dont seem to get that right... here is the bit I have done protected void Page_Load(object sender, EventArgs e) protected void ddlItems_SelectedIndexChanged(object sender, EventArgs e) Thanx in advance |
| ||
| Re: Master/Detail DropDownList and DataGrid hii Add the 3rd line code while binding DDlist. ddlItems.DataSource = dsCategory; Mark as sovled if it helps you!!! |
| ||
| Re: Master/Detail DropDownList and DataGrid I have all my categories loaded on my Dropdownlist but the problem is when I select a category the details of that category do not show on datagrid and I think the problem is on selectedIndexChanged event of the dropdownlist coz I am suppose to be selecting a category then the details appear on the datagrid but thats not working |
| ||
| Re: Master/Detail DropDownList and DataGrid As i understood from you code in selectindexchanged event: daItems.SelectCommand.CommandText = "Select ProductName, UnitPrice, UnitsInStock, ProductImage from dbo.Products where CategoryID = " + ddlItems.SelectedItem.Value; You are passing param "categoryId", therefore u need to bind dddl1.DataValueField = "categoryid" Pls. let me know your exact concern |
| ||
| Re: Master/Detail DropDownList and DataGrid Yes I added that on my code but still it doesnt work or show the details that falls under that category in the datagrid |
| ||
| Re: Master/Detail DropDownList and DataGrid Try doing this.. it should work Replace this code : ddlItems.DataSource = dsCategory; With ddlItems.DataSource = dsCategory; and also puut all your code under Page_Load like this protected void Page_Load(object sender, EventArgs e) and in your SelectedIndexChanged function change this DataSet dsItems = new DataSet(); daItems.SelectCommand.CommandText = "Select ProductName, UnitPrice, UnitsInStock, ProductImage from dbo.Products where CategoryID = " + [B]ddlItems.SelectedValue[/B]; |
| ||
| Re: Master/Detail DropDownList and DataGrid Thanx a lot man.... ur a star |
| ||
| Re: Master/Detail DropDownList and DataGrid hi above.... can u post ur entired code after making the necessry corrections pls....i need it urgently |
| ||
| Re: Master/Detail DropDownList and DataGrid My code is partial working cozI still have a problem coz when I select add to cart on my 1st datagrid it overwrite the existing record instead of adding to it but everything else is working But then again u need to understand how the code work hey if u dont let me know then I will explain /*Filling up the dropdownlist with each category. I used a procedure which select everything from Category which only have CategoryID and categoryDescription*/ |
| ||
| Re: Master/Detail DropDownList and DataGrid pls give me the complete code for it ..i tryed but not getting the output..pls help..iam pasting the code here but no output protected void Page_Load(object sender, EventArgs e)my database is something like this...i have two tables countryname(countryid identity(1,1),countryname) and statename(stateid identity(100,1),statename,countryid) so i have inserted 78 countries in country table in tat 73rd is india... n i have inserted states of india in statename table(28)..how to get india's states wen india in selected |
| All times are GMT -4. The time now is 4:20 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC