Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
    
Tim, i read the blog before i post here, and the blog did not talk about having dropdownlist with textbox –  Abu Hamzah Sep 8 '11 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. –  Abu Hamzah Sep 8 '11 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. –  Tim Gabrhel Sep 9 '11 at 3:11
    
Abu, I've updated my answer with an alternative approach. –  Tim Gabrhel Sep 9 '11 at 14:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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