title: Read and diplay XML file using repeater-asp.net c#
body: <p>I need your help please.
  I have this xml file which I need to read and diplay it a table using a repeater. The header columns of the table should be a button which if clicked should sort the contents of the column.</p>
  
  <p>The data is displayed ok, but the problem is with the sort, when I click one of the buttons the page just posts back a a blank page. </p>
  
  <p>what am I doing wrong? Please correct me.
  thanx </p>
  
  <p>this is the code of the aspx</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="ex3.Default2" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;style type="text/css"&gt;
          .style1
          {
              width: 100%;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
  
  
             &lt;asp:Repeater ID="Repeater1" runat="server" 
        &gt;
      &lt;HeaderTemplate&gt;
  
  
          &lt;table&gt;
              &lt;tr&gt;
  
                  &lt;th&gt;   &lt;asp:Button ID="btnEvent"  runat="server" Text="event" OnClick="btnEvent_Click" width="100%" EnableViewState="True"  CausesValidation="True" /&gt;
                  &lt;/th&gt;
                  &lt;th&gt;   &lt;asp:Button ID="btnDate" runat="server" Text="date" OnClick="btnDate_Click" width="100%" EnableViewState="True"  CausesValidation="True" /&gt;
                  &lt;/th&gt;
  
              &lt;/tr&gt;
      &lt;/HeaderTemplate&gt;
  
      &lt;ItemTemplate&gt;
          &lt;tr&gt;
  
  
              &lt;td&gt;
              &lt;asp:Label ID="lbl1" runat="server" Text='&lt;%# DataBinder.Eval(Container.DataItem, "title") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;asp:Label ID="lbl2" runat="server" Text='&lt;%# DataBinder.Eval(Container.DataItem, "pubDate") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
  
  
              &lt;/tr&gt;
             &lt;/ItemTemplate&gt;
  
  
  
      &lt;FooterTemplate&gt;
          &lt;/table&gt;
      &lt;/FooterTemplate&gt;
  &lt;/asp:Repeater&gt;
  
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the code of the c#:</p>
  
  <pre><code> public partial class Default2 : System.Web.UI.Page
      {
          DataSet ds;
          protected void Page_Load(object sender, EventArgs e)
          {
              if (!IsPostBack)
              {
                  ds = new DataSet();
                  ds.ReadXml(@"http://www1.biu.ac.il/rss-event-eng.php");
                  Repeater1.DataSource = ds;
                  Repeater1.DataMember = ds.Tables[2].TableName;
                  Repeater1.DataBind();
                  form1.Controls.Add(Repeater1);
              }
          }
          protected void btnEvent_Click(object sender, EventArgs e)
          {
  
              DataSet ds = new DataSet();
              ds.ReadXml(@"http://www1.biu.ac.il/rss-event-eng.php");
              DataView dv = ds.Tables[2].DefaultView;
              dv.Sort = "title ASC";
              Repeater1.DataSource = dv;
              Repeater1.DataBind();
  
  
          }
  
  
          protected void btnDate_Click(object sender, EventArgs e)
          {
              DataSet ds = new DataSet();
              ds.ReadXml(@"http://www1.biu.ac.il/rss-event-eng.php");
              DataView dv = ds.Tables[2].DefaultView;
              dv.Sort = "pubDate ASC";
              Repeater1.DataSource = dv;
              Repeater1.DataBind();
  
  
          }
      }
  </code></pre>