0

so far i able to create a custom property with with single control something like this:

string _property1; 
public string Property2 
{ 
     get 
     { 
         return _property2; 
     } 
     set 
     { 
         _property2 = value; 
     } 
} 

but i am looking to have little bit advance something like this:

a textbox with dropdownlist

any idea how would i do that or any link?

Thanks

1 Answer 1

0

http://blog.concurrency.com/sharepoint/create-a-custom-web-part-for-sharepoint-2010/

Please see the section on custom web part properties.

Short version:

  • Textbox - String/Int
  • DropDownList - enum
  • Checkbox - bool

Alternatively, if you are looking for more functionality, take a look at EditorParts. This link is for 2007, but it should work the same way. Notice that YOU control the markup that is written to the edit mode properties of the web part.

4
  • Tim, i read the blog before i post here, and the blog did not talk about having dropdownlist with textbox
    – Nick Kahn
    Sep 8, 2011 at 19:20
  • what i am looking is TextBox next to it is DropDownList so for an example, i will have a list of items to select from DDL and textbox to enter the value.
    – Nick Kahn
    Sep 8, 2011 at 19:25
  • Gotcha. I think you might be over thinking it then. Why can't you have two separate properties? An enum that defines the DDL values, and the string for the textbox value. Sep 9, 2011 at 3:11
  • Abu, I've updated my answer with an alternative approach. Sep 9, 2011 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.