Yes "Today" is a property that i want to put a value to.
A) It´s a string cuz I want to have ToShortDateString();, but that might work in DateTime as well?
B) Here is some code from the "TipOfTheDayUserControl.ascx.cs".. It´s not the greates code i know, but i´m still kinda novice to SharePoint and C#..
public partial class TipOfTheDayUserControl : UserControl
{
public TipOfTheDay WebPart { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
SPWeb oWeb = SPContext.Current.Web;
_lblTipOfTheDay.Text = this.WebPart.String;
if (!Page.IsPostBack)
{
if (oWeb.Lists.TryGetList("TODList") == null)
{
CreateList();
}
string curDate = DateTime.Now.ToShortDateString();
if (curDate != this.WebPart.Today || _lblTipOfTheDay.Text == "")
{
_lblTipOfTheDay.Text = GetTOD();
}
}
string today = DateTime.Now.ToShortDateString();
this.WebPart.Today = today;
this.WebPart.CurrentText = _lblTipOfTheDay.Text;
}
}
C) This is a visual webpart, and to create properties in a visual webpart you need to create the properties in webpart.cs file, in my case "TipOfTheDay.cs". And then make an instance of that file in your "WebpartUserControl.ascx.cs", in my case "TipOfTheDayUserControl.ascx.cs" to get access to them. That´s what i have learned..
D) They are in the same WebPart yes, but it´s not the same file.
Hope this did make it clearer! =)