We help IT Professionals succeed at work.
Get Started

Sort Gridview Data

376 Views
Last Modified: 2012-05-12
Hi,

I am here yet again with tales of woe surrounding XML.... (by the end of this little task I should be perfect on XML...)

todays query is....

I currently have a gridview that is databound to an XML file which pulls through the information i want perfectly fine using the below code sample.

An afterthought of mine with this task was to merg the 6 XML files into one file and then render this XML file accordingly and again this works perfectly until I look at the times the records were created.  

What I would like to happen is for my dataset to be able to sort the XML records and render them in time order.

I have tried using the  AllowSorting="true" tag but when I build and run the page I get an error saying The  " GridView 'datagrid1' fired event Sorting which wasn't handled. "
Can anyone help by showing me what I need to do in order to sort the data or if there is another way of doing things...


Dim ds As New DataSet()
        If File.Exists("\\wintdc02\PUBLIC\TarehouseXML\" & machine.Text & year.Text & month.Text & day.Text & ".xml") Then
            ds.ReadXml("\\wintdc02\PUBLIC\TarehouseXML\" & machine.Text & year.Text & month.Text & day.Text & ".xml")
            datagrid1.DataSource = ds
            datagrid1.DataBind()
        Else
            Response.Write("The file you are looking for does not exist or has been moved")
        End If

Open in new window

Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 19 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE