Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
LiFo #1
how to bind data to checkbox in datagrid
hi
i have a datagrid and one colume is a bool
if i use a normal asp:BoundColumn is shows as true or false
and i want it to show as a checkbox
but if i use a asp:TemplateColumn as this
<asp:TemplateColumn>
<HeaderTemplate>
<b>Aktiv</b>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox Runat="server" ID="checkbox" ></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
i only get a checkbox how do i bind the data to the checkbox
and i also want it to only bee able to check the box when it is in edit mode
LiFo Guest
-
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the... -
How to bind checkbox to one of the values of a datagrid
Hello All, I hope someone can enlighten me, all of the examples and posts Ihave read and sifted through doesn't pertain to what i wouldlike to do... -
Can we bind data to textbox in a headertemplate of a datagrid
Can we bind data to textbox in a headertemplate in a template column of a datagrid? If so please give some code snippets. Thank you -
Including a Data Bound CheckBox in an Editable DataGrid...
I found some good information On "Including a Data Bound CheckBox in an Editable DataGrid... " at this site... -
bind data to a textbox in a template column in WebForm DataGrid
Hi, I am trying to put a textbox in a template column both for displaying and editing. When I add the following line to the HTML code... -
Jos #2
Re: how to bind data to checkbox in datagrid
LiFo wrote:
For Visual Basic:> hi
> i have a datagrid and one colume is a bool
> if i use a normal asp:BoundColumn is shows as true or false
> and i want it to show as a checkbox
> but if i use a asp:TemplateColumn as this
> <asp:TemplateColumn>
> <HeaderTemplate>
> <b>Aktiv</b>
> </HeaderTemplate>
> <ItemTemplate>
> <asp:CheckBox Runat="server" ID="checkbox" ></asp:CheckBox>
> </ItemTemplate>
> </asp:TemplateColumn>
>
> i only get a checkbox how do i bind the data to the checkbox
> and i also want it to only bee able to check the box when it is in
> edit mode
<asp:CheckBox Runat="server" ID="checkbox1"
Checked='<%# DataBinder.Eval(Container.DataItem, "myField") %>' >
</asp:CheckBox>
I suggest using "Checkbox1" and not "Checkbox" for the ID, as Checkbox
can cause confusion between the type and the instance.
--
Jos Branders
Jos Guest
-
LiFo #3
Re: how to bind data to checkbox in datagrid
i am using c# and cant get it to work ???
"Jos" <josnospambranders@fastmail.fm> wrote in message
news:uJbJ4KPrDHA.3256@tk2msftngp13.phx.gbl...> LiFo wrote:>> > hi
> > i have a datagrid and one colume is a bool
> > if i use a normal asp:BoundColumn is shows as true or false
> > and i want it to show as a checkbox
> > but if i use a asp:TemplateColumn as this
> > <asp:TemplateColumn>
> > <HeaderTemplate>
> > <b>Aktiv</b>
> > </HeaderTemplate>
> > <ItemTemplate>
> > <asp:CheckBox Runat="server" ID="checkbox" ></asp:CheckBox>
> > </ItemTemplate>
> > </asp:TemplateColumn>
> >
> > i only get a checkbox how do i bind the data to the checkbox
> > and i also want it to only bee able to check the box when it is in
> > edit mode
> For Visual Basic:
> <asp:CheckBox Runat="server" ID="checkbox1"
> Checked='<%# DataBinder.Eval(Container.DataItem, "myField") %>' >
> </asp:CheckBox>
>
> I suggest using "Checkbox1" and not "Checkbox" for the ID, as Checkbox
> can cause confusion between the type and the instance.
>
> --
>
> Jos Branders
>
>
LiFo Guest
-
Jos #4
Re: how to bind data to checkbox in datagrid
LiFo wrote:
I checked and it's exactly the same in c#.> i am using c# and cant get it to work ???
Did you replace "myField" with the actual name of your field,
for instance "Activ"?
What is your error message?
--
Jos Branders
Jos Guest
-
LiFo #5
Re: how to bind data to checkbox in datagrid
thanks i have got it to work now
it was just a small typho
"Jos" <josnospambranders@fastmail.fm> wrote in message
news:%23dWXBwQrDHA.1408@TK2MSFTNGP11.phx.gbl...> LiFo wrote:>> > i am using c# and cant get it to work ???
> I checked and it's exactly the same in c#.
> Did you replace "myField" with the actual name of your field,
> for instance "Activ"?
>
> What is your error message?
>
> --
>
> Jos Branders
>
>
LiFo Guest



Reply With Quote

