prabha haran

prabha haran

  • NA
  • 81
  • 32.2k

how to display records in grid based on dropdown selection

Mar 14 2017 2:26 AM
i have a drop down as order id on selecting i have to load in a grid based on order id and on second selection i have show both a records with previous selection in windows application
 
 
if (dt.Tables[0].Rows.Count > 0)
{
foreach (var listBoxItem in lstboxorder.Items)
{
// use the currently iterated list box item
for (int j = 0; j < dt.Tables[0].Rows.Count; j++)
{
string qry2 = "select SalesId from Tbl_Sales where InvoiceId=" + iid + "";
DataSet dss11 = objdataaccess.GetDataSet(qry2);
gvTemp.Visible = false;
var iids = dss11.Tables[0].Rows[0]["SalesId"].ToString();
//string str2 = "select * from Tbl_Sales where InvoiceId= " + str + "";
//var iid = ds.Tables[0].Rows[0][0].ToString();
invoicebal.InvoiceId = Convert.ToInt32(iid);
//invoicebal.SalesId = Convert.ToInt32(iids);
invoicebal.customerid = Convert.ToInt32(cbCustomerName.SelectedValue);
DataSet dtt = invoiceDAL.GetProductDetails(invoicebal);
dgvInvoice.DataSource = dtt.Tables[0];
//var index = dgvInvoice.Rows.Add();
//dgvInvoice.Rows[index].Cells["Product Name"].Value = dtt.Tables[0].Rows[i][0].ToString();
//dgvInvoice.Rows[index].Cells["Unit"].Value = dtt.Tables[0].Rows[i]["unit"].ToString();
//dgvInvoice.Rows[index].Cells["Quantity"].Value = dtt.Tables[0].Rows[i]["quantity"].ToString();
//dgvInvoice.Rows[index].Cells["Price"].Value = dtt.Tables[0].Rows[i]["price"].ToString();
////dgvInvoice.Rows[index].Cells["No Of Tins"].Value = dt.Tables[0].Rows[i]["FreePieces"].ToString();
//dgvInvoice.Rows[index].Cells["Amount"].Value = dtt.Tables[0].Rows[i]["Amount"].ToString();
//decimal a = Convert.ToDecimal(dtt.Tables[0].Rows[i]["price"].ToString());
//decimal b = Convert.ToDecimal(dtt.Tables[0].Rows[i]["quantity"].ToString());
//decimal c = a * b;
//dgvInvoice.Rows[index].Cells["Amount"].Value = Convert.ToString(c);

Answers (2)