thx... solved the problem with following code in ItemDataBound event.help...
protected override void OnItemDataBound(DataGridItemEventArgs e)
{
try
{
string myStr;
if((e.Item.ItemType != ListItemType.Header) &
(e.Item.ItemType != ListItemType.Footer))
{
myStr = Convert.ToString(DataBinder.Eval(e.Item.DataItem," RegisterVisit"));
if (myStr == String.Empty)
((CheckBox)e.Item.Cells[4].Controls[0]).Visible = false;
else
{
((CheckBox)e.Item.Cells[4].Controls[0]).Checked = Convert.ToBoolean(myStr);
}
}
}
catch(Exception E)
{
}
base.OnItemDataBound (e);
}
"Elton Wang" <> wrote in message news:<1e8a01c51cfa$5b413910$>...
> You can make any special data binding in
> datagrid_ItemDataBound event.
>
> HTH
>
> Elton WAng
>
>
> >-----Original Message-----
> >Hi!
> >
> >I'm having problem binding a checkbox to data from a
> DataSet.
> >
> >I've seen solutions like <%#DataBinder.Eval
> (Container.DataItem,
> >"ColumnToBind")%> but this code must be added in aspx
> file and I'm
> >generating the datagrid from code behind.
> >
> >How can i bind data from a dataset to a templatecolumn
> with ckeckbox
> >in code behind? I'm using C#
> >
> >/thanks
> >.
> >