473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

2.0: DataView definition problem

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/
Apr 22 '06 #1
0 1312

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
1
by: Arthur Dzhelali | last post by:
I according to MSDN dataview and dataset are thread safe for read operations, but we run into this scenario. I just would like to see some comments on it. Aplication written in VB.NET it is an...
2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
20
by: Mark | last post by:
Hi all, quick question , a DataView is memory resident "view" of data in a data table therefore once populated you can close the connection to the database. Garbage collection can then be used to...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
0
by: R.A.M. | last post by:
Hello, (sorry for my English...) Please help me with a problem of DataView definition for DataTable (DefaultView doesn't work). I have little experience. I have an asp:ListBox ID="DotNETWWW"...
0
by: R.A.M. | last post by:
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...
5
by: Earl | last post by:
Noting first that I'm coming from VS2003 and VB.Net ... Using an untyped dataset, I create a dataview. When I try to use the Item property, "Item" does not appear on the Intellisense dropdown and...
0
by: =?Utf-8?B?VGVycnk=?= | last post by:
I have noticed the following behavior, which I believe is 'wrong'. I have a BindingSource that I am using to populate a datagrid, and I am using a DataView as the BindingSource.DataSource,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.