Hi there,
How do I add an item when I'm already on Form.aspx.cs?
cboOriginalBrand.Items.Add("*"); doesn't work anymore.
Hello Andrea,
Could you describe the exact scenario which you’re trying to implement?
Based on your explanation it seems that cboProductGroup is a WebDropDown control, is that correct?
And when a new item is selected you want to change the data source of a WebDataGrid control on your page.
Let me know if this is what you’re aiming to achieve.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://ko.infragistics.com/support
Hi Maya,
I'll take cboProductGroup as an example. That Drop Down has items like 3/4 Henly, etc. When I click on 3/4 Henly and click on "APPLY", on the Grid should appear Products which are in the 3/4 Henly Product Group category. Instead, it doesn't show the products.
I did not place DataSource on the Drop Downs already since I already programmed them on Form.aspx.cs and since the items on the Drop Downs are already showed because of calling them on Form.aspx.cs
Based on your code alone I cannot determine what control the cboProductGroup and cboBuyer represent and how they’re related to the WebDropDown. Could you elaborate on that?
Also I’m not sure what exactly what you’re trying to achieve with the WebDropDown.
When you select an item from the WebDropDown it’s text will be set in the input element of the drop down. Nothing else is expected to happen by default.
Could you explain in more details what you’re aiming to achieve?
I'm having a difficulty with displaying the results of the items on the Drop Down. I mean the list is already displayed but when I click on a certain item for example it should display just the items under that certain item. What happens is that it doesn't display anything.
Hi Maya, Also this: string strProductGroup = cboProductGroup.Text.Replace("*", "%");
This is the whole code:
protected void btnApply_Click(object sender, EventArgs e) {
string strProductGroup = cboProductGroup.Text.Replace("*", "%"); string strProductType = cboProductType.Text.Replace("*", "%"); string strGender = cboGender.Text.Replace("*", "%"); string strBatchNumber = txtBatchNo.Text; if (txtBatchNo.Text == "") { strBatchNumber = "*"; } strBatchNumber = strBatchNumber.Replace("*", "%"); string strDesigner = cboDesigner.Text.Replace("*", "%"); string strSource = cboSource.Text.ToUpper().Replace("*", "%"); string strBuyer = cboBuyer.Text.ToUpper().Replace("*", "%"); string strBorrower = cboBorrower.Text.Replace("*", "%"); string strOriginalBrand = cboOriginalBrand.Text.Replace("*", "%"); string strCategory = cboCategory.Text.Replace("*","");
string strSQL = "SELECT o.* FROM qry_Styles AS o " + " LEFT JOIN (" + "SELECT [Main Key],MAX([Borrower]) AS [Borrower] FROM [Library Log] WHERE [Date Borrowed] IS NOT NULL AND [Date Returned] IS NULL" + " GROUP BY [Main Key] " + ") As l" + " ON o.[Original Sample Number] = l.[Main Key] " + " WHERE o.[Original Sample Number] LIKE '" + txtOriginalSampleNo.Text.Trim().ToUpper() + "%'" + " AND ISNULL(o.[Product Group],'') LIKE '" + strProductGroup + "'" + " AND ISNULL(o.[Product Type],'') LIKE '" + strProductType + "'" + " AND ISNULL(o.[Gender],'') LIKE '" + strGender + "'" + " AND ISNULL(o.[Batch Number],'') LIKE '" + strBatchNumber + "'" + " AND ISNULL(o.[Designer],'') LIKE '" + strDesigner + "'" + " AND ISNULL(o.[Sample Type],'') LIKE '" + strSource + "'" + " AND ISNULL(o.[Buyer],'') LIKE '" + strBuyer + "'" + " AND ISNULL(l.[Borrower],'') LIKE '" + strBorrower + "'" + " AND ISNULL(o.[Original Brand], '') LIKE '" + strOriginalBrand + "'";
if (strCategory != "") strSQL = strSQL + " AND ISNULL(o.[Category],'') LIKE '" + strCategory + "'";
strSQL = strSQL + " ORDER BY o.[Original Sample Number]"; Session["SQL"] = strSQL; sdsOriginalSamples.SelectCommand = strSQL; grdOriginalSamples.DataBind(); }