Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > .NET 2.0: DataView SIMPLE PROBLEM

Reply
Thread Tools

.NET 2.0: DataView SIMPLE PROBLEM

 
 
R.A.M.
Guest
Posts: n/a
 
      05-15-2006
Hello,
Please help me with a problem of DataView definition for DataTable
(DefaultView doesn't work). I have little experience. I present the
problem here second time, because I haven't got any answers.

I have an asp:ListBox ID="DotNETWWW" which I would like to fill with
data from XML file. It works fine but my data is not displayed in
ListBox properly - instead, I got a list of "System.Data.DataRowView"
string items. I'd rather have URLs I had read.
Here's the code:

const string DotNETFile = ...;
using (DataTable dt = new DataTable())
try
{
dt.Columns.Add("url",
System.Type.GetType("System.String"));
using (XmlTextReader reader = new
XmlTextReader(Request.PhysicalApplicationPath + "App_Data\\" +
DotNETFile + ".xml"))
{
reader.MoveToContent();
while (!reader.EOF)
if (!(reader.NodeType == XmlNodeType.Element
&& reader.Name == "link"))
reader.Read();
else
{
DataRow dr = dt.NewRow();
dr["url"] = reader.Value.Trim();
dt.Rows.Add(dr);
}
}
}
catch (Exception ex)
{
dt.Rows.Clear();
}
finally
{
DataView dv = new DataView(dt); // HERE PROBLEM
DotNETWWW.DataSource = dv;
DotNETWWW.DataBind();
}

I don't know how to define view to have URLs (I had read) displayed.
Unfortunately dt.DefaultView doesn't work (same result).

Thank you very much for your answers.
/RAM/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorted DataView, but unsorted datalist when bound to the dataview CodeMonkey ASP .Net 1 02-04-2011 10:55 AM
DataView.RowFilter problem Dave Hagerich ASP .Net 8 09-29-2005 08:47 PM
DataView.Rowfilter String Problem Paul Meller ASP .Net 0 01-15-2004 03:55 AM
HELP from Expert Needed!!! Problem using the find method in a DataView with multiple window forms miggy ASP .Net 2 11-15-2003 10:03 AM
Dataview in SQL Server Session State Problem jamie shuker ASP .Net 0 08-13-2003 10:46 AM



Advertisments