I would to display text entered in a custom web part property onto a form.

This code is to display the custom web part property

     WebDisplayName("Enter some text")]
     public string CustomTextProp { get; set; }

This is the div to display what was entered in the code above

    <div style="margin-bottom:10px;">TEXT USER ENTERED IN WEB PART PROPERTIES</div>

My question is how to I get the text the user entered in the web part property to display in the div?

  • should it be showed after saving or right when tiping in? – Gwny Sep 12 '14 at 13:40
  • It should be showed after saving – Bobby Sep 12 '14 at 13:43
  • and where is this div located? – Gwny Sep 12 '14 at 13:45
  • UserItemDisplay.ascx – Bobby Sep 12 '14 at 13:49
  • is this a control you created? – Gwny Sep 12 '14 at 13:50

Maybe you should use a Label and in the onLoad method of your webpart you can access this label and write the value of the saved property to its Text.Field.

Or you could in the set-Method of the Property set the .Text of the Label to the value entered to the WebPart Property;

Tell me if you need more help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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