B
Bill Burris
In the following piece of code from my control, the Sort doesn't work. The
foreach processes the data in the order that it appears in the XML file.
protected override void Render(HtmlTextWriter output)
{
_XmlPath = Page.Request.MapPath( @"content\" + _XmlFileName );
_ds.ReadXml( _XmlPath );
DataView dv = _ds.Tables[0].DefaultView;
dv.Sort = "PagePosition ASC";
foreach( DataRow r in dv.Table.Rows )
{
output.Write( "<hr width='100' color='maroon' SIZE='1'
align='middle'>" );
RenderBook( output, r );
}
output.Write( "<hr width='100' color='maroon' SIZE='1'
align='middle'>" );
}
If I put the following code on a WebForm, the data is sorted properly, but
only 14 rows are displayed, not the whole table.
private void Page_Load(object sender, System.EventArgs e)
{
string XmlPath = Page.Request.MapPath( @"content\csbooks.xml" );
DataSet ds = new DataSet();
ds.ReadXml( XmlPath );
DataView dv = ds.Tables[0].DefaultView;
dv.Sort = "PagePosition ASC";
Repeater1.DataSource = dv;
Repeater1.DataBind();
}
Any ideas for what is going wrong in these 2 pieces of code? In the first
piece of code the sort doesn't work. In the second piece of code only 14
rows are displayed by the Repeater, when there should be 27.
thanks
Bill
foreach processes the data in the order that it appears in the XML file.
protected override void Render(HtmlTextWriter output)
{
_XmlPath = Page.Request.MapPath( @"content\" + _XmlFileName );
_ds.ReadXml( _XmlPath );
DataView dv = _ds.Tables[0].DefaultView;
dv.Sort = "PagePosition ASC";
foreach( DataRow r in dv.Table.Rows )
{
output.Write( "<hr width='100' color='maroon' SIZE='1'
align='middle'>" );
RenderBook( output, r );
}
output.Write( "<hr width='100' color='maroon' SIZE='1'
align='middle'>" );
}
If I put the following code on a WebForm, the data is sorted properly, but
only 14 rows are displayed, not the whole table.
private void Page_Load(object sender, System.EventArgs e)
{
string XmlPath = Page.Request.MapPath( @"content\csbooks.xml" );
DataSet ds = new DataSet();
ds.ReadXml( XmlPath );
DataView dv = ds.Tables[0].DefaultView;
dv.Sort = "PagePosition ASC";
Repeater1.DataSource = dv;
Repeater1.DataBind();
}
Any ideas for what is going wrong in these 2 pieces of code? In the first
piece of code the sort doesn't work. In the second piece of code only 14
rows are displayed by the Repeater, when there should be 27.
thanks
Bill