ToolBox WepParts Control PropertyGridEditorPart

PropertyGridEditorPart Web Server Control

in ASP.NET environment,This article describes you how to work with PropertyGridEditorPart Web Control.The mechanism of PropertyGridEditorPart can provide an editor control that enables users to edit Custom properties on web Part controls and Custom properties on server controls.

The users can edit custom properties sets other than the EditorPart controls, such as the AppearanceEditorPart and BehaviorEditorPart controls, that edit only existing, By using the PropertyGridEditorPart control.

The Web Parts control set contains the following two features:

  • They are helper controls that enable end users to personalize controls on a Web Parts page.
  • They are visible only in certain display modes.

The following properties are respect to the related controls are as follows:

  • String - TextBox
  • Int, Float, Unit - TextBox
  • Boolean - CheckBox
  • Enum - DropDownList
  • DateTime - TextBox
Properties of PropertyGridEditorPart
  • Title property - allows the user to gets or sets the title for a layout control.
  • Display property -Describes the visiblity of the PropertyGridEditorPart control. The PropertyGridEditorPart control is always visible when the page is in edit mode,
Methods of LayoutEditorPart
  • ApplyChanges- Saves the values from a PropertyGridEditorPart control to the corresponding properties. return true when saving is succeed, otherwise false.
  • SyncChanges-Retrieves the property values from a WebPart control and assigns them to the associated PropertyGridEditorPart control.

the following code snippets demonstrates how to work with the PropertyGridEditorPart Control

in .aspx.cs page,

protected void Page_Load(object sender, EventArgs e)
  {
    btn1.Visible = false;
    txt1.Visible = false;
  }

  private static String editControlTitle;
  
  protected void btn1_Click(object sender, EventArgs e)
  {
    editControlTitle = Server.HtmlEncode(txt1.Text);
    pgep1.Title = editControlTitle;
  }

  protected void pgep1_Init(object sender, EventArgs e)
  {
    if (editControlTitle != null)
      pgep1.Title = editControlTitle;
  }  

  protected void pgep1_PreRender(object sender,
    EventArgs e)
  {
    btn1.Visible = true;
    txt1.Visible = true;
  }    

in .aspx page,

   
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenuCS" 
  Src="DisplayModeMenuCS.ascx" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.CS.Controls" 
  Assembly="UserInfoWebPartCS" %>
  
<html>
  <head id="Head1" runat="server">
    <title>
      User Information WebPart with EditorPart
    </title>
  </head>
  <body>
    <form id="form2" runat="server">
      <asp:webpartmanager id="wp1" runat="server"  />
      <uc1:DisplayModeMenuCS ID="DisplayModeMenu1" runat="server" />
      <asp:webpartzone id="zone1" runat="server" >
        <PartTitleStyle BorderWidth=1 
          Font-Names="Verdana, Arial"
          Font-Size="110%"
          BackColor="LightBlue" />
        <zonetemplate>
          <aspSample:UserInfoWebPart 
            runat="server"   
            id="userinfo" 
            title = "User Information WebPart"
            BackColor="Beige" />          
        </zonetemplate>
      </asp:webpartzone> 
      <div>
      <hr />
      <asp:Button ID="btn1" runat="server" 
        Text="Update EditorPart Title" 
        OnClick="btn1_Click" />
      <asp:TextBox ID="txt1" runat="server"></asp:TextBox>
      </div>
      <asp:EditorZone ID="EditorZone1" runat="server">
        <ZoneTemplate>
          <asp:PropertyGridEditorPart ID="pgep1" 
            runat="server" 
            Title="Edit Custom Properties"
            OnPreRender="pgep1_PreRender" 
            OnInit="pgep1_Init" />   
        </ZoneTemplate>
      </asp:EditorZone>
    </form>
  </body>
</html>    
 
Related Links

Posted by: Admin
Posted on: 9/17/2009 at 5:10 PM
Tags: , ,
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (16) | Post RSSRSS comment feed

Comments

ucvhost United States

Friday, February 05, 2010 1:04 PM

ucvhost

great stuff thanks for sharing

mutual &amp; federal United States

Sunday, April 18, 2010 4:54 PM

mutual &amp; federal

I was very impressed. Thank you dear. You are very good. The article was nice to read and full of meaning full of knowledge

Rapidshare United States

Tuesday, April 27, 2010 10:58 PM

Rapidshare

I\'m happy I found this blog, I couldnt discover any info on this subject matter prior to. I also run a site and if you want to ever serious in a little bit of guest writing for me if possible feel free to let me know, i\'m always look for people to check out my site. Please stop by and leave a comment sometime!

Svitlana.Net.Ua United States

Wednesday, June 16, 2010 5:12 PM

Svitlana.Net.Ua

I would like to thank you for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now.

няня United States

Saturday, June 19, 2010 11:51 AM

няня

I would like to thank you for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now.
http://svitlana.net.ua/staff/category/3/ гувернантка, http://svitlana.net.ua/staff/category/5/ повар, http://svitlana.net.ua/staff/category/6/ садовник, http://svitlana.net.ua/staff/category/10/ репетитор, http://svitlana.net.ua/staff/category/4 домработница, http://svitlana.net.ua/staff/category/8/ семейная пара, http://svitlana.net.ua/pages/2/ работа няней.

покер United States

Thursday, June 24, 2010 10:57 PM

покер

You have some honest ideas here. I done a research on the issue and discovered most peoples will agree with your blog.

Лучшие индивидуалки United States

Sunday, July 04, 2010 12:59 AM

Лучшие индивидуалки

Но, мы со всеми из них уже знакомы и поддерживаем дружеские отношения уже много лет, поэтому, никогда не возникает проблем с тем, что бы уединиться. Они тоже ищут места, где можно спрятаться, поэтому на всем протяжении отдыха мы практически не пересекаемся, только по особой надобности, но, такие надобности возникают не часто.

Магазин сантехники United States

Sunday, July 04, 2010 1:47 AM

Магазин сантехники

You made fantastic nice points here. I performed a search on the issue and discovered almost all peoples will agree with your blog.

Московские Индивидуалки United States

Wednesday, July 07, 2010 12:40 AM

Московские Индивидуалки

You got numerous positive points there. I made a search on the issue and found nearly all peoples will agree with your blog.

bad breath machine United States

Friday, July 09, 2010 6:36 AM

bad breath machine

Lousy breath of air isn t constantly what it looks  The moment meals just like garlic and onion are metabolized because of the liver  their odour is excreted in perspiration and through the lungs  instead than on the teeth  A lousy odour coming from an exhale with the nose is often a sign of a thing systemic  which affects the physique as

how to get rid of lice on furniture United States

Friday, July 09, 2010 3:00 PM

how to get rid of lice on furniture

Even however vital oils are  all pure   there may be some concern that a lot of use of them on little ones may possibly have a very negative impact on their development  Personally  I don t feel it would be considered a trouble in case you only employed the residence built supervisor lice strategy occasionally for locks lice  You could use typical

Новинки сантехники United States

Saturday, July 10, 2010 11:08 PM

Новинки сантехники

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts.Any way Ill be subscribing to your feed and I hope you post again soon

Проститутки United States

Sunday, July 11, 2010 10:55 PM

Проститутки

You gave nice ideas here. I done a research on the issue and learnt most peoples will agree with your blog. Certainly, these practices are unfair; but they say that most of their rules are only to apply to people who overdraw.

nfl jersey People's Republic of China

Friday, July 23, 2010 9:17 AM

nfl jersey

Thanks for the info!!

Timberland Boots sale United States

Thursday, July 29, 2010 11:55 AM

Timberland Boots sale

Through reading more good articles to improve our quality of life. Your blog make me feel comfortable. At the sametime,http://www.timberlandshoesonline.com I will introduce you to know about a comfortable shoes that makes your life better! you can choice what you like!

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading