c# - SharePoint 2013 WebPart not passing Custom Properties -
developing webpart in sharepoint 2013 , having issue custom properties. custom properties input boxes show , appears normal on frontend. however, when put value in either box , hit 'apply' values coming setter null.
here ascx.cs file. getevents , getnews calls other classes. use string coming in custom properties , pass them function pull custom lists. (they pull when hard code lists properly) commented out default values because seemed work not change because of aforementioned issue setter.
using system; using system.componentmodel; using system.web.ui.webcontrols.webparts; using system.collections.generic; using system.collections; using system.web.ui.webcontrols; using system.web.ui; namespace listget.visualwebpart1 { [toolboxitemattribute(false)] public partial class visualwebpart1 : webpart { //const string _eventdefaultlist = "events"; //const string _newsdefaultlist = "news"; private string _eventslist; private string _newslist; [webdisplayname("eventslist")] [webdescription("name of events list")] [webbrowsable(true)] [personalizable(personalizationscope.shared)] //[defaultvalue(_eventdefaultlist)] public string eventslist { { return _eventslist; } set { _eventslist = value; } } [webdisplayname("newslist")] [webdescription("name of news list")] [webbrowsable(true)] [personalizable(personalizationscope.shared)] //[defaultvalue("news")] public string newslist { { return this._newslist; } set { this._newslist = value; } } public visualwebpart1() { } protected override void oninit(eventargs e) { base.oninit(e); initializecontrol(); } protected void page_load(object sender, eventargs e) { } protected list<calendaritem> geteventitems() { eventslist events = new eventslist(); return events.getevents(this.eventslist); } protected list<calendaritem> getnewsitems() { newslist news = new newslist(); return news.getnews(this.newslist); } }
}
after several hours of beating head against desk, co-worker looked @ , noticed set sandbox solution. let lesson everyone, check first.
Comments
Post a Comment