Datagrid with checkbox

S

Sam

Hi All,

I have a datagrid which uses checkbox template (below) and I want to disable
my check box when the datagrid is first loaded. And then when user clicks on
the edit link, the checkbox is enable. The problem that I'm having with the
code below is that when I click on the edit link, the checkbox does not seem
to be enable.Would someone help me?


Regards

Sam


<asp:TemplateColumn HeaderText="Extended Email FollowUp">
<HeaderStyle HorizontalAlign="Center"
BackColor="Gray"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
Program
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="cbl" Runat="server" EnableViewState="true"
checked='<%# Convert.ToBoolean(DataBinder.Eval(Container,
"DataItem.Active")) %>' enabled="False">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
 
N

nasirmajor

Sam said:
Hi All,

I have a datagrid which uses checkbox template (below) and I want to disable
my check box when the datagrid is first loaded. And then when user clicks on
the edit link, the checkbox is enable. The problem that I'm having with the
code below is that when I click on the edit link, the checkbox does not seem
to be enable.Would someone help me?


Regards

Sam


<asp:TemplateColumn HeaderText="Extended Email FollowUp">
<HeaderStyle HorizontalAlign="Center"
BackColor="Gray"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
Program
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="cbl" Runat="server" EnableViewState="true"
checked='<%# Convert.ToBoolean(DataBinder.Eval(Container,
"DataItem.Active")) %>' enabled="False">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>

try removing enableviewstate=false
or else solution can be like this
that in itemtemplate
make checkbox visible property false
and in edititemtemplate
make checkbox visible property true
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top