Toolpart

Posted: October 23, 2009 in Toolpart

I have already created a post oncreating a toolpart.

There is a more simpler way to provide a toolpart and to read values from it.

You just need to do two things

  • Create a property of the required type.
  • access that property same as a normal variable.

For Example in the below code I am getting a string variable and displaying that in the label in the webpart.

public partial class CFReport : System.Web.UI.UserControl
{
         public string UserName
        {
              get { return userName; }
              set { userName = value; }
        }
        protected void Page_Load(object sender, EventArgs e)

       {
             this.lblName.Text = this.UserName;
       }
}

Here UserName will be a property that will appear in the toolpart and here the value that is entered will be displayed in the label.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s