protected void Page_Load(object sender, EventArgs e)
{
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();
SPList li = web.Lists["JokeOfTheDay"];
SPQuery q = new SPQuery();
q.ViewFields = string.Concat(
"<FieldRef Name='Title' />",
"<FieldRef Name='jokename1' />",
"<FieldRef Name='jokename2' />",
q.ViewFieldsOnly = true); // Fetch only the data that we need
SPListItemCollection items = li.GetItems(q);
foreach (SPListItem item in items)
{
string ResultItemTitle = item["jokename1"].ToString();
if (ResultItemTitle == "123 testing")
Txttodayjoke1.TextMode = TextBoxMode.MultiLine;
Txttodayjoke1.Text = ResultItemTitle;
}
}
}
{
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();
SPList li = web.Lists["JokeOfTheDay"];
SPQuery q = new SPQuery();
q.ViewFields = string.Concat(
"<FieldRef Name='Title' />",
"<FieldRef Name='jokename1' />",
"<FieldRef Name='jokename2' />",
q.ViewFieldsOnly = true); // Fetch only the data that we need
SPListItemCollection items = li.GetItems(q);
foreach (SPListItem item in items)
{
string ResultItemTitle = item["jokename1"].ToString();
if (ResultItemTitle == "123 testing")
Txttodayjoke1.TextMode = TextBoxMode.MultiLine;
Txttodayjoke1.Text = ResultItemTitle;
}
}
}
No comments:
Post a Comment