Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a grid view with check box control. Grid View bind with Stored procedure.
SP contain one "bit" type column. I want to update check box according to Bit data type. If column value true then check box should marked as checked. Otherwise unchecked. Please tell me how to do. I'm new to ASP.Net
Posted
Comments
Nandakishore G N 11-Nov-13 8:17am    
use gridview rowdatabound event and it works. search in google there are many examples
mn.sathish 17-Nov-13 2:23am    
Thanks for your valuable solution. . . ,

if you are binding the datagridview with datatable then change the column type of that column to "CheckBox" and on changing datasource it should automatically change check box value's
 
Share this answer
 
Comments
mn.sathish 11-Nov-13 7:50am    
Hi! Harsh Oswal.
Plz share one example if you can.
Thanks for your help.
agent_kruger 11-Nov-13 7:52am    
srry to ask but is our database SQL or Access
mn.sathish 11-Nov-13 7:53am    
SQL
DataTable Dt = new DataTable();
                Dt.Columns.Add("Id");
                Dt.Columns.Add("Name");
                Dt.Columns.Add("Check",typeof(bool));
                Dt.Rows.Add("1", "Harsh", true);

                dataGridView1.DataSource = Dt;
 
Share this answer
 
Comments
mn.sathish 11-Nov-13 8:08am    
Sorry to ask...., I'v used following code.
using (SqlConnection _SQLCon = new SqlConnection(DBConStr))
{
DataSet ds = new DataSet();
_SQLCon.Open();
using (SqlCommand _SQLCmd = new SqlCommand("Fetch_Role_Module_Details", _SQLCon))
{
_SQLCmd.CommandType = CommandType.StoredProcedure;
_SQLCmd.Parameters.Add("@RoleName", SqlDbType.NVarChar).Value = Role;
_SQLCmd.ExecuteNonQuery();
SqlDataAdapter _SQLAda = new SqlDataAdapter(_SQLCmd);
_SQLAda.Fill(ds);
gridview.DataSource = ds.Tables[0];
gridview.DataBind();
}
}

So How can i change it?
agent_kruger 11-Nov-13 8:10am    
give your SQL Query also
mn.sathish 11-Nov-13 13:01pm    
plz give me ur mail id. I'll send my coding
agent_kruger 12-Nov-13 5:33am    
santarkantos123@gmail.com
mn.sathish 13-Nov-13 1:06am    
I'v sent my coding. Plz check it.

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