using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Prasad;
using System.Xml;
public partial class Default10 : System.Web.UI.Page
{
DataSet dset = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
DateTime dtNow= Calendar1.SelectedDate;
string toDayFormat = dtNow.ToString("u");
string[] EventStartDate = toDayFormat.Split(new Char[] { ' ' });
Prasad.Lists listService = new Prasad.Lists();
listService.UseDefaultCredentials=true;
listService.Url = "http://agmsm:9999/sites/mnet/venkat/_vti_bin/Lists.asmx";
string strListName = "Events";
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
System.Xml.XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
viewFields.InnerXml = "<FieldRef Name=\"ID\" /><FieldRef Name=\"Title\" /><FieldRef Name=\"EventDate\" /><FieldRef Name=\"Location\" />";
//string strDate=Calendar1.s
//2010-08-10T00:00:00Z
//8/11/2010 12:00:00 AM
query.InnerXml = "<OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy><Where><Eq><FieldRef Name='EventDate' /><Value Type='DateTime'>" + EventStartDate[0] + "</Value></Eq></Where>";
System.Xml.XmlNode nodeListItems = listService.GetListItems(strListName, null, query, viewFields, null, null, null);
//System.Xml.XmlNode nodeListItems = listService.GetListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, null);
DataSet ds = getData(nodeListItems);
DataTable dt = ds.Tables["row"];
GridView1.DataSource = dt;
GridView1.DataBind();
System.Xml.XmlElement batchElement = xmlDoc.CreateElement("Batch");
batchElement.SetAttribute("OnError", "Continue");
batchElement.SetAttribute("ListVersion", "1");
}
public DataSet getData(XmlNode xmlnodeinput)
{
if (xmlnodeinput != null)
{
XmlTextReader xtr = new XmlTextReader(xmlnodeinput.OuterXml, XmlNodeType.Element, null);
//dataset = new DataSet();
dset.ReadXml(xtr);
}
return dset;
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[2].Text = Convert.ToDateTime(e.Row.Cells[2].Text).ToShortDateString();
}
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Prasad;
using System.Xml;
public partial class Default10 : System.Web.UI.Page
{
DataSet dset = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
DateTime dtNow= Calendar1.SelectedDate;
string toDayFormat = dtNow.ToString("u");
string[] EventStartDate = toDayFormat.Split(new Char[] { ' ' });
Prasad.Lists listService = new Prasad.Lists();
listService.UseDefaultCredentials=true;
listService.Url = "http://agmsm:9999/sites/mnet/venkat/_vti_bin/Lists.asmx";
string strListName = "Events";
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
System.Xml.XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
viewFields.InnerXml = "<FieldRef Name=\"ID\" /><FieldRef Name=\"Title\" /><FieldRef Name=\"EventDate\" /><FieldRef Name=\"Location\" />";
//string strDate=Calendar1.s
//2010-08-10T00:00:00Z
//8/11/2010 12:00:00 AM
query.InnerXml = "<OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy><Where><Eq><FieldRef Name='EventDate' /><Value Type='DateTime'>" + EventStartDate[0] + "</Value></Eq></Where>";
System.Xml.XmlNode nodeListItems = listService.GetListItems(strListName, null, query, viewFields, null, null, null);
//System.Xml.XmlNode nodeListItems = listService.GetListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, null);
DataSet ds = getData(nodeListItems);
DataTable dt = ds.Tables["row"];
GridView1.DataSource = dt;
GridView1.DataBind();
System.Xml.XmlElement batchElement = xmlDoc.CreateElement("Batch");
batchElement.SetAttribute("OnError", "Continue");
batchElement.SetAttribute("ListVersion", "1");
}
public DataSet getData(XmlNode xmlnodeinput)
{
if (xmlnodeinput != null)
{
XmlTextReader xtr = new XmlTextReader(xmlnodeinput.OuterXml, XmlNodeType.Element, null);
//dataset = new DataSet();
dset.ReadXml(xtr);
}
return dset;
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[2].Text = Convert.ToDateTime(e.Row.Cells[2].Text).ToShortDateString();
}
}
}
No comments:
Post a Comment