|
-
Apr 23rd, 2007, 02:58 AM
#1
Thread Starter
Addicted Member
how could i code this datalist?
create table mytable(fname varchar(20), lname varchar(20)
insert into mytable values('gir','gez')
insert into mytable values('girmai','gezae')
insert into mytable values('lemgir','aden')
insert into mytable values('nilelemgir','mekelle')
insert into mytable values('lemgirbay','axum')
insert into mytable values('abebe','addis')
<html>
<body>
<asp ataList id="cdcatalog"
runat="server">
<HeaderTemplate>
My CD Catalog
</HeaderTemplate>
<ItemTemplate>
<table><tr><td><%#Container.DataItem("fname")%></td><td>
<%#Container.DataItem("lname")%> </td></tr>
</table>
</ItemTemplate>
</datalist>
</body>
</html>
<code>
dim str as string="select * from mytable where fname='%"&txtfname.text&"%'"
dim con as sqlconnection=new sqlconnection("server=localhost;....)
dim cmd as sqldatareader
con.open()
cmd.datasource=cmd.executereader
datalist1.databind()
</code>
now if the input in txtfname is gir,
the output will be any row which has 'gir' in the "fname" column.
gir gez
girmai gezae
lemgir aden
nilelemgir mekelle
lemgirbay axum
by doing so i have got the above results as a table form,
but now i want to click any name if the first column then it searchs the same as the above code,
if i click in the output in "lemgir" then i will expect the following results:
lemgir aden
nilelemgir mekelle
lemgirbay axum
"lemgir" is found in (lemgir,nilelemgir,lemgirbay)
so how cloud i do such programing?
with a lot of thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|