Pulling .NET Dynamic Data by First Letter only

Hi everyone,

I have a long list of dynamic data being generated on a jquery mobile site. I’d like to have this data be separated by alphabet list bars, much like the directory organization of a phone by first letter. (ex: jQuery Mobile: Demos and Documentation)

Another option would simply be to only call the data by first letter. For example, I select the letter “A”, and all the data that starts with “A” displays.

I am calling names via ASP.NET.vb repeated method with: <%# Eval(“Name”)%>

That code of course pulls all names. How can I narrow it down to specific letter starts? I am new to ASP and ASP.NET; therefore, I’m not quite sure where to start or what terminology to start researching. Any help would be greatly appreciated, thank you.

Where is the data coming from? In what type… plain old ado.net (DataTables, DataReader), web service, linq to *, file …

linq is great for this type of stuff.

select foo from bar where foo.Name.StartsWith(“A”);

SQL
“SELECT * FROM FOO WHERE NAME LIKE @p” with @p = ‘A%’

Thanks for your help pufa,

I am pulling content from a Microsoft SQL database.
It is just being read via a Repeater.
My current set up can be seen below:
What do you think?
I appreciate your help.


<div data-role="collapsible-set">
<asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<div data-role="collapsible" data-collapsed="true">
    <h3><%# Eval("Name")%></h3>
    <p>Room: <%# Eval("Room")%></p>
</div>
</ItemTemplate>
</asp:Repeater>
</div><!-- /collapsible set-->

Hi,
You must be using sql statement in your SqlDatasource1. If so or no, try using "SELECT Name, Room FROM [your table] WHERE NAME LIKE ‘A%’ ". Later, you can replace your SQL with dynamic value for ‘A’, ‘B’ etc. Do not fetch all the data from database and filter on client side.
Providing full source can be of much help.

Thanks
Raman Basu