I am querying an xml document in LINQ and would want to display the results in gridview to allow users to select from the list.
the query is as a result of user input.
Here's a copy of my xml.
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msd...
Is it possible to have checkboxes with a gridview that is dynamically generated from an xml file?
Here's the LINQ query that I am using to query the xml:
var hotels = from hotel in xmlDoc.Descendants("Table")
where hotel.Element("HOTEL_AREA").Value == ddllocation.SelectedItem.ToString()
&& Double.Parse(pplTextBox.Tex...
Thanks klabranche, but the table just generates 10 rows and I've not been able to get my head round inserting the data into the rows.
Here is the dynamic grid method that is been called in the page load method. Thanks once again
private void loadDynamicGrid()
{
#region Code for preparing the DataTable
//Create an insta...
I just started learning Visual Studio a couple of weeks ago and everything is way over my head. Can you please give me a copy of the code I'd use to format both a date column and a price column? I am also not seem to be getting the gridview to show the checkbox. I'm stuck pls help. I am using visual studio 2008 and would want to pull out...
I would please like to retrieve data from a xml file based on user input with date. I would like to compare the user input date with the date in the xml file and if its greater than the xml file date, it should retrieve it. my linq query looks like this thanks in advance.
XDocument xmlDoc = XDocument.Load(Server.MapPath("xml/data1.xml")...
I have a xml structure like this:
<Items>
<Configuration>
<ConfigurationSetting>Setting1</ConfigurationSetting>
<ConfigurationSetting>Setting2</ConfigurationSetting>
</Configuration>
<MetaData>
...
</MetaData>
<Group>
<GroupType>MyType1</GroupType>
<GroupType>MyType2</GroupType>
...
I have an HTML document stored in memory as an Linq-to-XML object tree. How can I serialize an XDocument as HTML, taking into account the idiosyncrasies of HTML?
For example, empty tags such as <br/> should be serialized as <br>, whereas an empty <div/> should be serialized as <div></div>.
HTML output is possible from an XSLT styleshe...
OK, I asked for how to return a Linq query results as XML, and I got the answer here.
But there's one little problem: the results do not get grouped logically within the XML. For example:
XElement xml = new XElement("States",
from s in MyStates
from cy in s.Counties
from c in cy.Cities
where s.Code == "NY"
orderby s.Code, cy...
I have a simple XML file:
<?xml version="1.0" encoding="utf-8"?>
<ConvenioValidacao>
<convenio ven_codigo="1" tipoValidacao="CPF"></convenio>
<convenio ven_codigo="1" tipoValidacao="MATRICULA"></convenio>
<convenio ven_codigo="3" tipoValidacao="CPF"></convenio>
<convenio ven_codigo="4" tipoValidacao="CPF"></convenio>
</C...
I was wondering if it is possible to include inner variables or delegates in linq statements?
I currently am using Linq to XML with XPath extensions and am using a where clause on an element that I cannot guarantee will exist.
Here is a sample of what I mean:
var result =
from record in xml.Root.XPathSelectElements("record")
w...
I have an XML which looks something like this
<?xml version="1.0" encoding="utf-8" ?>
<Applicant>
<NameValueGroup attribute="Name">
<NameValue desc="One" value="test1"/>
<NameValue desc="Two" value="test2"/>
<NameValue desc="Three" value="test3"/>
<NameValue desc="Four" value="test4"/>
</NameValueGroup>
<NameValueG...
In a previous question I asked about how to group XML elements logically, and I got the answer, which was to nest the Linq query.
Problem is, this has the effect of left-joining the nested queries. For example, let's say I want to list all the cities in the USA that begin with the letter "Y", grouped by State and County:
XElement xml ...
I have a XDocument with XElements such as this:
<PageContent>
<Text>My Text</Text>
<Image>image.jpg</Image>
</PageContent>
I want to find the Text element and update its value. I have some LINQ working but its returning the value rather than allowing me to update the XElement and XDocument in return.
...
Hey all,
I am using Linq to XML for some HTML output files. I need to place the infinity symbol (∞) in the code on output in some table cells. I am creating an XElement like this
var table = new XElement("table",
new XElement("tr",
new XElement("td", "∞")
)
);
var document...
This may be a beginner xml question, but how can I generate an xml document that looks like the following?
<root xmlns:ci="http://somewhere.com" xmlns:ca="http://somewhereelse.com">
<ci:field1>test</ci:field1>
<ca:field2>another test</ca:field2>
</root>
If I can get this to be written, I can get the rest of my problem to wo...
How can I get the connection.connection_string value from the following hibernate xml file using linq?
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<p...
Given a set
Paris
New York
London
New York
Paris
Paris
I'm trying to do a LINQ query that will return a grouping of the Paris, New York, and London with their respective counts.
I've been able to do a GroupBy that returns a group containing only the Paris/New York/London in each Grouping.
Sounds relatively simple, but I can't get it ...
According to W3C standards, if you have a nillable element with a nil value, you are supposed to format it like this:
<myNillableElement xsi:nil="true" />
But if you use this LinqToXml statement...
element.Add(
new XElement(ns + "myNillableElement", null);
...the resulting XML is...
<myNillableElement />
...which is invalid....
I am joining 3 xml logfiles with LINQ to XML by id, but when my logfiles become too big, LINQ to XML doesn't work anymore, so i have to use XmlReader.
But now I am asking myself how to do this?
Should i loop through every document for each id, or is there a more simple elegant solution?
Anybody?
...
I'm trying to start out with LinqtoXml.
I have added (I think) the right namespaces
XElement contactsFromFile = XElement.Load("App_Data/test.xml");
Doesn't work... I get a
"Could not find a part of the path 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\App_Data\test.xml'"
error...
Please help.
...