Erwin Pombett
asked on
i've display a dataTable in a repeater, how can filter the display?
i 'd like to be able to filter depending the header that was pressed on
a table displayed after a repeater?
the repeater repeats the table rows.
i think there must be a solution somewhere, i need the link.
a table displayed after a repeater?
the repeater repeats the table rows.
i think there must be a solution somewhere, i need the link.
ASKER
hi joex911,
do you like porshe cars?
here 's the way i'm handling the datatable and repeater.
html
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
<TABLE>
<TR>
<TD class="td_ca_ecolog_6">lev el min</TD>
<TD class="td_ca_ecolog_7">vol ume</TD>
</TR>
</TABLE>
<asp:Panel id="panelEcologsZoneWrappe r" class="cu_ecologZoneWrappe r" runat="server">
<table id="sub_account_zone" border="1px" >
<asp:Repeater ID="repEcolog" Runat="server" OnItemDataBound="treatItem " >
<ItemTemplate>
<tr style="over:red;color:grey ;" onmouseover="this.classNam e='over'" onmouseout="this.className =''">
<td class="td_ca_ecolog_5">&nb sp;<%# DataBinder.Eval(Container. DataItem, "depth_min") %></td>
<td class="td_ca_ecolog_6">&nb sp;<%# DataBinder.Eval(Container. DataItem, "volume") %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</asp:Panel>
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
code behind:
....
repEcolog.DataSource = controller_.FetchEcologLis t();
repEcolog.DataBind();
....
i have a table for headers because i want them fix, when i scroll the values.
my controller return the dataTable right to the repeater, but i could get it to a local dataTable of the page
(would it make it faster instead of recreating a method in controller?)
what i need to know is where to launch the filter, with javascript on the header
something out of the repeater ?
i need to reorder increasing or decreasing, i want my header links as toogle buttons, once click filter increasing,
once clicked again filter decreasing.
note: you can see that i have a treatItem method, it's empty it's doing anything.
do you like porshe cars?
here 's the way i'm handling the datatable and repeater.
html
--------------------------
<TABLE>
<TR>
<TD class="td_ca_ecolog_6">lev
<TD class="td_ca_ecolog_7">vol
</TR>
</TABLE>
<asp:Panel id="panelEcologsZoneWrappe
<table id="sub_account_zone" border="1px" >
<asp:Repeater ID="repEcolog" Runat="server" OnItemDataBound="treatItem
<ItemTemplate>
<tr style="over:red;color:grey
<td class="td_ca_ecolog_5">&nb
<td class="td_ca_ecolog_6">&nb
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</asp:Panel>
--------------------------
code behind:
....
repEcolog.DataSource = controller_.FetchEcologLis
repEcolog.DataBind();
....
i have a table for headers because i want them fix, when i scroll the values.
my controller return the dataTable right to the repeater, but i could get it to a local dataTable of the page
(would it make it faster instead of recreating a method in controller?)
what i need to know is where to launch the filter, with javascript on the header
something out of the repeater ?
i need to reorder increasing or decreasing, i want my header links as toogle buttons, once click filter increasing,
once clicked again filter decreasing.
note: you can see that i have a treatItem method, it's empty it's doing anything.
Ok, so what you want to do is sort the table in ascending or descending order, not filter the results? I think that for this it be easier if you use a DataGrid control (.NET 1.1) or a GridView control (.NET 2.0), they provide the means to add the sorting functionality to your data.
http://dotnetjunkies.com/Article/B7C5AB3C-4D2E-4800-A071-6F40D57699C3.dcik
http://aspnet.4guysfromrolla.com/articles/052202-1.aspx
http://dotnetjunkies.com/Article/B7C5AB3C-4D2E-4800-A071-6F40D57699C3.dcik
http://aspnet.4guysfromrolla.com/articles/052202-1.aspx
ASKER
i'm gonna try with dataGrid as i'm using .NET 1.1
hem! anywas, is there a possibility to do ti via my poor repeater?
hem! anywas, is there a possibility to do ti via my poor repeater?
You could do it with the repeater, maybe use a asp:hyperlink for the headers off each column, then on the click event apply a sort to your datatable, also you need to keep track in a session variable if it should be ascending (ASC) or descending (DESC):
if(session["SortDir"].ToString() == "ASC")
DataTable.Sort = "Column DESC";
else
DataTable.Sort = "Column ASC";
ASKER
shure, i found that
dtTemp.DefaultView.Sort = "weight DESC";
would sort my table on my weight column,
but how to fire the event to be able to sort this in code behind?
i can not add event to the hyperlink, only javascript.
dtTemp.DefaultView.Sort = "weight DESC";
would sort my table on my weight column,
but how to fire the event to be able to sort this in code behind?
i can not add event to the hyperlink, only javascript.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks a lot ,
i succeed with your help.
i succeed with your help.
myDataTable.DefaultView.Ro
http://msdn2.microsoft.com/en-us/library/system.data.dataview.rowfilter(vs.71).aspx