Saturday, April 28, 2007

I came across this (in an asp.net page) last week:

protected void Page_Load(object sender, EventArgs e) {

    System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.YesNo;

    System.Windows.Forms.DialogResult result;

 

    result = System.Windows.Forms.MessageBox.Show("Test Message", "Test Caption", buttons);

}

 

kick it on DotNetKicks.com   Saturday, April 28, 2007 5:32:48 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [2]  | 
 Friday, April 27, 2007

I can't tell you how many times I have struggled with where to store a data item in a Check Box control. I typically need to do this when dynamically generating a series of check boxes on a page that correspond to a data item. I have used the tool tip which works ok but exposes your data to the use when the hover over the control. I have seen others manipulate part of the control ID to contain a data item but this seems problematic. Then it came to me:

using System;

 

namespace Utility {

 

    public class CheckBox: System.Web.UI.WebControls.CheckBox {

 

        public CheckBox() { }

 

        public object Data {

            get { return ViewState["Data"]; }

            set { ViewState["Data"] = value; }

        }

    }

}

Download a sample solution.

kick it on DotNetKicks.com   Friday, April 27, 2007 8:59:45 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 

I am guessing that like most other blogs, people come across my piece of cyber space through a search engine. Just validating this theory.

Also thinking that I will try to post more frequently now that I have a really unique name!

 

-Andy

kick it on DotNetKicks.com   Friday, April 27, 2007 1:07:46 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [2]  |