How to filter rows

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<div style="color:Black;background-color:White; <pre>
Hi Friends,
[/code]

I would like to filter the rows and displays the details in the datagridview from the following xml file.

<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; utf-8<span style="color:Black; "<span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; Bills<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; schema <span style="color:Red; id<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Bills<span style="color:Black; " <span style="color:Red; xmlns<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; " xmlns:xs="http://www.w3.org/2001/XMLSchema<span style="color:Black; " <span style="color:Red; xmlns:msdata<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; urn:schemas-microsoft-com:xml-msdata<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Bills<span style="color:Black; " <span style="color:Red; msdata:IsDataSet<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; true<span style="color:Black; " <span style="color:Red; msdata:Locale<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; en-US<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; choice <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; " <span style="color:Red; maxOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; unbounded<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Bill<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Item<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; " <span style="color:Red; maxOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; unbounded<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; code<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:string<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; name<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:string<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Qty<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:string<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Rate<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:string<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; no<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:string<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; isTH<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:string<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; isNH<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:string<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; choice<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; schema<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Bill <span style="color:Red; no<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 001<span style="color:Black; " <span style="color:Red; isTH<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; true<span style="color:Black; " <span style="color:Red; isNH<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; true<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; code<span style="color:Blue; >001<span style="color:Blue; </<span style="color:#A31515; code<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >i10<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Qty<span style="color:Blue; >10<span style="color:Blue; </<span style="color:#A31515; Qty<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Rate<span style="color:Blue; >20<span style="color:Blue; </<span style="color:#A31515; Rate<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; code<span style="color:Blue; >002<span style="color:Blue; </<span style="color:#A31515; code<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >i20<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Qty<span style="color:Blue; >20<span style="color:Blue; </<span style="color:#A31515; Qty<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Rate<span style="color:Blue; >30<span style="color:Blue; </<span style="color:#A31515; Rate<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; code<span style="color:Blue; >003<span style="color:Blue; </<span style="color:#A31515; code<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >i30<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Qty<span style="color:Blue; >50<span style="color:Blue; </<span style="color:#A31515; Qty<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Rate<span style="color:Blue; >40<span style="color:Blue; </<span style="color:#A31515; Rate<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Bill<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Bill <span style="color:Red; no<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 002<span style="color:Black; " <span style="color:Red; isTH<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; false<span style="color:Black; " <span style="color:Red; isNH<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; false<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; code<span style="color:Blue; >011<span style="color:Blue; </<span style="color:#A31515; code<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >j10<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Qty<span style="color:Blue; >10<span style="color:Blue; </<span style="color:#A31515; Qty<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Rate<span style="color:Blue; >20<span style="color:Blue; </<span style="color:#A31515; Rate<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; code<span style="color:Blue; >012<span style="color:Blue; </<span style="color:#A31515; code<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >j20<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Qty<span style="color:Blue; >20<span style="color:Blue; </<span style="color:#A31515; Qty<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Rate<span style="color:Blue; >30<span style="color:Blue; </<span style="color:#A31515; Rate<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; code<span style="color:Blue; >013<span style="color:Blue; </<span style="color:#A31515; code<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >j30<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Qty<span style="color:Blue; >50<span style="color:Blue; </<span style="color:#A31515; Qty<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Rate<span style="color:Blue; >40<span style="color:Blue; </<span style="color:#A31515; Rate<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Item<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Bill<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Bills<span style="color:Blue; >
[/code]
<br/>
I used the following code to display the details

<div style="color:Black;background-color:White; <pre>
DataSet ds = <span style="color:Blue; new DataSet();
DataView dv = <span style="color:Blue; new DataView();
ds.Clear();
ds.ReadXml(Application.StartupPath + <span style="color:#A31515; "\DataBase\Primary\bill.xml", XmlReadMode.ReadSchema);
dv = ds.Tables[1].DefaultView;
dataGridView1.DataSource = dv;
[/code]
by using the above code i can display all the items in the datagridview. but i need to display only the items from one bill at a time
ie. from Bill no=001.
How can i achieve this? Looking forward to hear from you.
Regards,
Saji


View the full article
 
Back
Top