D
Darth Continent
First some background, I have an XML file which looks like the
following:
<KW>
<Subjects SubjectID="00100" SubjectDescription="ABORTION"/>
<Subjects SubjectID="00010" SubjectDescription="ABUSE * ADULT
* INVESTIGATION"/>
<Subjects SubjectID="06450" SubjectDescription="ABUSE * CHILD
ABUSE * COUNSELING"/>
</KW>
Using the statement, below, I can set the XPath of my XMLDataSource,
which in turn filters the output displayed in the DataGridView I have
bound to the data source, based upon the text in a textbox, txtSearch.
MyXMLDataSource.XPath = "//KW/Subjects[contains(@SubjectDescription,'"
+ txtSearch.Text.Trim() + "')]";
For example, if txtSearch.Text = 'ABUSE', the last 2 of the above 3
records' values for the SubjectDescription attribute are returned.
This works like a champ.
Now I'd like to enable sorting for the result set returned by the
XPath query, but when I attempt a sort I get the message, "The data
source does not support sorting".
Based upon the above, could someone please help me enable sorting? I
first thought I could just use the DataGridView's own Sort method,
since the data has been brought into the DataGridView, but I guess
since it's still bound to the XMLDataSource, there lies the roadblock.
Any suggestions would be greatly appreciated!!
following:
<KW>
<Subjects SubjectID="00100" SubjectDescription="ABORTION"/>
<Subjects SubjectID="00010" SubjectDescription="ABUSE * ADULT
* INVESTIGATION"/>
<Subjects SubjectID="06450" SubjectDescription="ABUSE * CHILD
ABUSE * COUNSELING"/>
</KW>
Using the statement, below, I can set the XPath of my XMLDataSource,
which in turn filters the output displayed in the DataGridView I have
bound to the data source, based upon the text in a textbox, txtSearch.
MyXMLDataSource.XPath = "//KW/Subjects[contains(@SubjectDescription,'"
+ txtSearch.Text.Trim() + "')]";
For example, if txtSearch.Text = 'ABUSE', the last 2 of the above 3
records' values for the SubjectDescription attribute are returned.
This works like a champ.
Now I'd like to enable sorting for the result set returned by the
XPath query, but when I attempt a sort I get the message, "The data
source does not support sorting".
Based upon the above, could someone please help me enable sorting? I
first thought I could just use the DataGridView's own Sort method,
since the data has been brought into the DataGridView, but I guess
since it's still bound to the XMLDataSource, there lies the roadblock.
Any suggestions would be greatly appreciated!!