Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a gridview in which user info is listed and i have added a checkbox field.
depending on the checkbox value the textfield data is updated i.e. if i select the first checkbox the username against this checkbox of that row is listed in the textbox and when i select multiple checkboxes then all the username should display there.

Please tell me how to do that
thanks
Posted
Comments
mimtiyaz 5-Mar-13 3:14am    
It will be more precise when you add some code here..

1 solution

This should give you a rough idea of what to do.
This is code I have used with an access db to select specific data into text boxes related to the selected Datagridview row.

C#
private void DGReview_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            conn.Open();
            OleDbCommand cmd = new OleDbCommand();
            cmd = conn.CreateCommand();
            cmd.CommandText = @"SELECT * FROM [Table] WHERE [Variable] ='" +    DGReview.SelectedRows[0].Cells[0].Value.ToString() + "'";
            cmd.ExecuteNonQuery();
            DataTable dt = new DataTable();
            OleDbDataAdapter adapterA = new OleDbDataAdapter();
            adapterA.SelectCommand = cmd;
            adapterA.Fill(dt);
            Object a = dt.Rows[0]["Variable"];
            textbox.Text = Convert.ToString(a);            
            
            conn.Close();
        }



Where as the method is DG_Review_CellClick yours would probably be checkbox_CheckedChanged
 
Share this answer
 
v2

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