Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is my code for binding data in datagridview...........
C#
if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }

 string sqlqry = "SELECT ITEMCODE, BROKTYPE,BROKRATE,TRANRATE,TranType,uptostdt,MARTYPE,MARRATE,PARTYTYPE FROM PITBROK";

            SqlDataAdapter da = new SqlDataAdapter(sqlqry, con);
            DataSet ds1 = new DataSet();
            da.Fill(ds1, "PITBROK");

            //if (ds1.Tables[0].Rows.Count > 0)
            for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
            {
               
                dataGridView1.ColumnCount = 9;
                dataGridView1.Rows.Add();

                dataGridView1[0, i].Value = ds1.Tables[0].Rows[i][0].ToString();
               
                string b = ds1.Tables[0].Rows[i][1].ToString();

                if (b == "O")
                {

                    dataGridView1[1, i].Value = "Opening Sauda";
                }
                else if (b == "P")
                {

                    dataGridView1[1, i].Value = "Persentage Wise";
                }
                else if (b == "T")
                {

                    dataGridView1[1, i].Value = "Transation";
                }
                dataGridView1[2, i].Value = ds1.Tables[0].Rows[i][2].ToString();
                dataGridView1[3, i].Value = ds1.Tables[0].Rows[i][3].ToString();
                string l = ds1.Tables[0].Rows[i][4].ToString();


                if (l == "O")
                {

                    dataGridView1[4, i].Value = "Opening Sauda";
                }
                else if (l == "P")
                {

                    dataGridView1[4, i].Value = "Persentage Wise";
                }
                else if (l == "T")
                {

                    dataGridView1[4, i].Value = "Transation";
                }


                dataGridView1[5, i].Value = ds1.Tables[0].Rows[i][5].ToString();
                string m = ds1.Tables[0].Rows[i][6].ToString();
                if (m == "Q")
                {

                    dataGridView1[6, i].Value = "Qty Wise(perunit)";
                }
                else if (m == "V")
                {

                    dataGridView1[6, i].Value = "Value Wise(in%)";
                }
                else if (m == "I")
                {

                    dataGridView1[6, i].Value = "Import Rates";
                }
                else if (m == "C")
                {
                    dataGridView1[6, i].Value = "Client Wise Margine";
                }

                dataGridView1[7, i].Value = ds1.Tables[0].Rows[i][7].ToString();
                dataGridView1[8, i].Value = ds1.Tables[0].Rows[i][8].ToString();


            }

data shown in datagridview now i want to combo box in broktype at a time only in one cell as enter key is press (combo box contain item like item1 item b item c..and so on....)


what i have to do please help me ..........please please please please please please please please please please please please please please
my emailid lakhanp22@gmail.com
Posted
Updated 2-Dec-11 22:30pm
v3
Comments
uspatel 3-Dec-11 4:30am    
Pre tag added

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900