Johny12345
asked on
asp.net jquery
Hi,
I have repeater and it contains data. I want to sort the repeater by dropbox using jquery. Is it possible? If yes then how can I do it? Any example would be appreciated.
Thanks
I have repeater and it contains data. I want to sort the repeater by dropbox using jquery. Is it possible? If yes then how can I do it? Any example would be appreciated.
Thanks
Yes it is possible - can you post the output of your repeater code (html), your "dropbox" and provide some information about where the data comes from and how you populate your repeater.
ASKER
thanks for reply. Here is the detail:
Repeater looks like this in firefox browser
code is like:
Please advise. You can suggest me if I have loaded xml file in wrong way.
Thanks
Repeater looks like this in firefox browser
<span id="rptEmployee_ctl00_lblTitle">
Employee 1
</span>
<br></br>
<span id="rptEmployee_ctl00_lblDescription">
Employee desc
<b></b>
description
</span>
<br></br>
<span id="rptEmployee_ctl00_lblSalary">
1000
</span>
code is like:
string file = Server.MapPath("App_Data\\Salary.xml");
XElement element = XElement.Load(file);
var employees = from employee in element.Descendants("Employee")
select new
{
Title = employee.Element("Name").Value,
Description = employee.Element("Description").Value,
Salary = employee.Element("Salary").Value,
};
rptEmployee.DataSource = employees;
rptEmployee.DataBind();
Please advise. You can suggest me if I have loaded xml file in wrong way.
Thanks
Ok but what do you want to sort on?
Can you give an example of how the data comes out by default and how you want the sort to work.
Can you give an example of how the data comes out by default and how you want the sort to work.
ASKER
sorry, I missed it. I have to sort salary.
ASKER
What do u mean by default? Do you want me to post more from browser output? The data is not in table structure.
ASKER
Please sir, help me. If you need more info the let me know.. thx
I still need to understand how your output looks - your post above shows 3 <span>'s all with different data. You say in your second last post you want to sort on salary - I am assuming that there are therefore other <span>'s that you have not shown?
Is each grouping of <span>'s inside a container? I am trying to visualise how your data looks on the screen and how you want to sort it?
Please post full output of your repeater before a sort and then describe how you want this to be sorted.
Is each grouping of <span>'s inside a container? I am trying to visualise how your data looks on the screen and how you want to sort it?
Please post full output of your repeater before a sort and then describe how you want this to be sorted.
ASKER
Ok, sir.
Here are then exact things,
How data looks:
https://www.dropbox.com/s/i1u7up1b4l0lrlk/00001.PNG?dl=0
How html in browser
https://www.dropbox.com/s/jfxxdqoq3j4y496/html.txt?dl=0
Thanks lot
Here are then exact things,
How data looks:
https://www.dropbox.com/s/i1u7up1b4l0lrlk/00001.PNG?dl=0
How html in browser
https://www.dropbox.com/s/jfxxdqoq3j4y496/html.txt?dl=0
Thanks lot
ASKER
Sir, do u think, it is possible? please advise me
Yes it is possible - I will post something back shortly.
Are you able to modify the html code - specifically are you able to add classes to some of the elements that are in the ouptut?
A solution is possible without this but much simpler if you can add classes to certain elements.
A solution is possible without this but much simpler if you can add classes to certain elements.
ASKER
Yes, of course. I can change html where needed.
ASKER
I am still waiting!!, Please help
Here is a sample on how to do this - some changes to your code needed to be made namely
1. A class added to the <label> that contains the price - this is not strictly necessary but does make the code a bit simpler.
2. Locating the table outside of the productListing <div>. If you want to be able to sort these items in browser then you need those items to be in their own container - not sharing it with another element that performs a different function.
A sample page is available here.
The source for this is attached.
t830.html
1. A class added to the <label> that contains the price - this is not strictly necessary but does make the code a bit simpler.
2. Locating the table outside of the productListing <div>. If you want to be able to sort these items in browser then you need those items to be in their own container - not sharing it with another element that performs a different function.
A sample page is available here.
The source for this is attached.
t830.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you sir, I appreciate.
You are most welcome.