473,322 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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.WebControls;
using System.ComponentModel;

namespace MyProject.Controls
{
/// <summary>
/// Summary description for CheckBoxColumn.
/// </summary>
public class CheckBoxColumn : DataGridColumn, INamingContainer
{
private bool _checked; /// Determines whether CheckBox
/// in CheckBoxColumn is checked
private bool _enableviwestate; /// 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(false), Description("CheckBox_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("Control_MaintainState"), DefaultValue(true),
Category("Behavior")]
public bool EnableViewState
{
get
{
return this._enableviwestate;
}
set
{
this._enableviwestate = value;
}
}

/// <summary>
/// Gets or sets the unique identifier of the CheckBoxColumn
/// </summary>
[MergableProperty(false), ParenthesizePropertyName(true),
Description("Control_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.WebControls.TableCell
/// that represents the cell to reset</param>
/// <param name="columnIndex">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.InitializeCell (cell, columnIndex, itemType);

if ((itemType != ListItemType.Header) && (itemType !=
ListItemType.Footer))
{
CheckBox checkbox = new CheckBox();

checkbox.Checked = this._checked;
checkbox.EnableViewState = this._enableviwestate;
checkbox.ID = this._id;

cell.Controls.Add(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 776

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

Similar topics

3
by: Saqib Ali | last post by:
Hello All, I m not sure if this is the right place to ask for a critique. If not please refer me to another group. Thanks. I would a criqtique of the following website:...
1
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,...
19
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
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...
188
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 -...
39
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...
0
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...
2
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...
0
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.