Checkbox column in a grid view...
-
Hi everyone, Im using c# asp.net 2.0. In a dataset im having one column value as either 0 or 1,if the row value is 1 means the checkbox should be checked and its 0 means the checkbox should be unchecked in the gridview,im having the checkbox column as a template column.im having one checkbox column.How should i achieve this.. regards Kanna..
-
Hi everyone, Im using c# asp.net 2.0. In a dataset im having one column value as either 0 or 1,if the row value is 1 means the checkbox should be checked and its 0 means the checkbox should be unchecked in the gridview,im having the checkbox column as a template column.im having one checkbox column.How should i achieve this.. regards Kanna..
Put one more label in this checkbox column. the DataField of this label should be mapped to the actual field from database. In Item_DataBound() event of GridView, you can check whether the value is 0 or 1. then, find the checked box control and check or uncheck based on the value.. Eg: Item_DataBound Event
Label lbl = (Label)e.FindControl("lblValue"); CheckedBox chk = (CheckedBox)e.FindControl("chkCheckedBox"); chk = (lbl.Text == "1") ?? true:false;
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
Hi everyone, Im using c# asp.net 2.0. In a dataset im having one column value as either 0 or 1,if the row value is 1 means the checkbox should be checked and its 0 means the checkbox should be unchecked in the gridview,im having the checkbox column as a template column.im having one checkbox column.How should i achieve this.. regards Kanna..