473,703 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Critique Request: CheckBoxColumn

I recently had the desire to create a CheckBoxColumn (similar to a
ButtonColumn) that I could add to a DataGrid. I believe the 2.0
framework already includes such a type; however, this is for an ASP.NET
1.1 project.

Could anybody please give me some feedback on my implementation?

<code>
using System;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Componen tModel;

namespace MyProject.Contr ols
{
/// <summary>
/// Summary description for CheckBoxColumn.
/// </summary>
public class CheckBoxColumn : DataGridColumn, INamingContaine r
{
private bool _checked; /// Determines whether CheckBox
/// in CheckBoxColumn is checked
private bool _enableviwestat e; /// Determines whether object
/// persists its ViewState
private string _id; /// The unique identifier for the
/// control

/// <summary>
/// Gets or sets a value that determines whether the
/// CheckBoxColumn is checked
/// </summary>
[DefaultValue(fa lse), Description("Ch eckBox_Checked" ),
Bindable(true)]
public bool Checked
{
get
{
return this._checked;
}
set
{
this._checked = value;
}
}

/// <summary>
/// Gets or sets a value indicating whether object persists its
/// ViewState
/// </summary>
[Description("Co ntrol_MaintainS tate"), DefaultValue(tr ue),
Category("Behav ior")]
public bool EnableViewState
{
get
{
return this._enableviw estate;
}
set
{
this._enableviw estate = value;
}
}

/// <summary>
/// Gets or sets the unique identifier of the CheckBoxColumn
/// </summary>
[MergablePropert y(false), ParenthesizePro pertyName(true) ,
Description("Co ntrol_ID")]
public string ID
{
get
{
return this._id;
}
set
{
this._id = value;
}
}

/// <summary>
/// Creates an instance of a CheckBoxColumn
/// </summary>
public CheckBoxColumn( )
{
}

/// <summary>
/// Implements base method to reset the specified cell to its
/// initial value
/// </summary>
/// <param name="cell">A System.Web.UI.W ebControls.Tabl eCell
/// that represents the cell to reset</param>
/// <param name="columnInd ex">Resets the specified cell to its
/// initial value</param>
/// <param name="itemType" >Resets the specified cell to its
/// initial value</param>
public override void InitializeCell( TableCell cell, int
columnIndex, ListItemType itemType)
{
base.Initialize Cell (cell, columnIndex, itemType);

if ((itemType != ListItemType.He ader) && (itemType !=
ListItemType.Fo oter))
{
CheckBox checkbox = new CheckBox();

checkbox.Checke d = this._checked;
checkbox.Enable ViewState = this._enableviw estate;
checkbox.ID = this._id;

cell.Controls.A dd(checkbox);
}
}
}
}
</code>

I had to manually replace tabs with spaces so I hope that turned out
alright.

Thank you in advance,

--
Sean
Feb 15 '06 #1
0 1079

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

Similar topics

1
1481
by: aacool | last post by:
Hi, I've been working on my blogspot blog and have replaced the default available templates with one based on css. I would appreciate tips and advice. I am considering alternate css stylesheets, but I'm not sure how many people actually change their stylesheet. I've tested the site out on IE & Firefox. The site is at:
19
2544
by: TC | last post by:
Are there any good sites or forums for a web critique? I went to alt.html.critique and it's pretty dead.
9
2281
by: bowsayge | last post by:
Inspired by fb, Bowsayge decided to write a decimal integer to binary string converter. Perhaps some of the experienced C programmers here can critique it. It allocates probably way too much memory, but it should certainly handle 64-bit cpus :) #include <stdio.h> #include <stdlib.h> char * to_binary (unsigned long value) {
188
7180
by: christopher diggins | last post by:
I have posted a C# critique at http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up the following issues : - unsafe code - attributes - garbage collection - non-deterministic destructors - Objects can't exist on the stack - Type / Reference Types
39
1927
by: Eric | last post by:
There is a VB.NET critique on the following page: http://www.vb7-critique.741.com/ for those who are interested. Feel free to take a look and share your thoughts. Cheers, Eric. Ps: for those on comp.programming, this may be off topic, but I've posted there because the critique was part of a discussion in that group.
0
787
by: Fao, Sean | last post by:
I recently had the desire to create a CheckBoxColumn (similar to a ButtonColumn) that I could add to a DataGrid. I believe the 2.0 framework already includes such a type; however, this is for an ASP.NET 1.1 project. Could anybody please give me some feedback on my implementation? <code> using System; using System.Web.UI;
2
1512
by: sajeeendranath | last post by:
.am using two checkboxcolumn in a datagridview and my problem is....i want to allow only one checkboxcolumn to be checked at a time(eg:- if we check first checkboxcolumn then the other one should remain unchecked and viceversa) thankz in advance
0
288
by: Johnny J. | last post by:
In the EditingControlShowing event I can a TextBox Editing control, but for some reason this event is not raised when you click on a CheckBoxColumn Cell. Is there any other way of hooking the CheckedChanged event of the CheckBoxColumns Checkbox control? Cheers, Johnny J.
2
1115
by: winston | last post by:
I wrote a Python program (103 lines, below) to download developer data from SourceForge for research about social networks. Please critique the code and let me know how to improve it. An example use of the program: promptpython download.py 1 240000 The above command downloads data for the projects with IDs between 1
0
8755
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8667
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8961
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6585
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5922
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2445
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2063
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.