473,503 Members | 11,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid with checkbox

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>
Jul 7 '06 #1
1 1389

Sam wrote:
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

Jul 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2143
by: Just D | last post by:
Hi All, Does anybody know how to write the following code? I have a database table with a few columns including: ID , "Task" , ForceRun . I need to show the DataGrid on the ASPX page with...
4
1508
by: Jim Heavey | last post by:
Hello, I am starting to learn how to use the Datagrid and I have a couple of questions. My datagrid as a checkbox in it. It looks like the following in the datagrid... <asp:TemplateColumn...
2
3107
by: Sebi | last post by:
Hello all is it possible to add a checkbox in a DataGrid for Boolean Data? Thanks in advance
0
2388
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
4
1836
by: Mike | last post by:
Hi, Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject? Thanks Mike
7
2257
by: Lars Netzel | last post by:
If I put a checkbox in a datagrid (ASP.NET) and set the Autopostback to true I can catch OnChange event on checkbox but how do I then catch what DataGridItemIndex is? Can I use some Event in the...
2
2444
by: Mortar | last post by:
i have a datagrid with 2 columns. the 1st column contains an id which will be used by the database for the selected checkbox records. the 2nd column is a template column containing a server...
1
4213
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
3
3133
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
7
2492
by: rn5a | last post by:
The first column of a DataGrid has a CheckBox for all the rows. I want that when users check a CheckBox, the BackColor of that entire row in the DataGrid should change to a different color. To...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.