Hi,
I'm trying to do the following:
I use a repeater control in ASP.NET/C# because I would like to show the
content of one DataSet which is filled from SELECT QUERY.
In DataSource I have the detailed information for all advertisements which
met the criteria of the QUERY.
With the Repeater I show only one part from this information. In other words
if I have in DataSet 12 columns, I show 6.
What I would like to do is to make the first column ,which the Repeater
shows, a HyperLink to the detailed information of the advertisement.
Repeater shows the following:
TypeEstate Price SquareMeters City
Date RealName
=============== =============== =============== =============== ==
house $333000 500 Sofia
23/08/03 Viktor Popov
apartment $450000 200 Plovdiv
24/07/04 Ilian Peev
...........
What I'm trying to do is to make the TypeEstate link to the detailed
info for the specific advertisement and to show this information in another
WebForm.
How could be accomplished that ?
This is the code which I use now:
C#:
========
private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
SqlConnection conn = new SqlConnection(" Data Source=BLEK;Ini tial
Catalog=Estate; User ID=blek; Password=bander as");
SqlDataAdapter dad = new SqlDataAdapter( "SELECT
U.REALNAME,E.AD DATE,ET.TYPEEST ,O.PRICE,O.SQME TERS,E.ESTCITY FROM BLEK.USERS
U RIGHT JOIN BLEK.OFFERS O ON U.USERID=O.USER ID LEFT JOIN BLEK.ESTATES E ON
O.ESTATEID=E.ES TATEID LEFT JOIN BLEK.Est_TYPE AS ET ON E.ESTTYPEID=ET. TYPEID
LEFT JOIN BLEK.TYPEOFFER AS OT ON E.TYPEOFFERID=O T.OFFERID LEFT JOIN
BLEK.TYPECONSTR UCTION AS TC ON E.TYPECONSTRID= TC.CONSTRID WHERE
E.ESTCITY=@CITY AND OT.TYPEOFFER=@T OFFER", conn);
conn.Open();
dad.SelectComma nd.Parameters.A dd(new SqlParameter("@ CITY",
SqlDbType.VarCh ar,20));
dad.SelectComma nd.Parameters["@CITY"].Value = Session["city"].ToString();
dad.SelectComma nd.Parameters.A dd(new SqlParameter("@ TOFFER",
SqlDbType.VarCh ar,20));
dad.SelectComma nd.Parameters["@TOFFER"].Value = Session["offer"].ToString();
DataSet ds = new DataSet();
dad.Fill(ds, "Users");
conn.Close();
MyRepeater.Data Source = ds.Tables["Users"].DefaultView;
MyRepeater.Data Bind();
}
HTML
===========
<asp:Repeater id="MyRepeater " runat="server">
<HeaderTemplate >
<table width="100%" style="font: 8pt verdana">
<tr style="FONT-WEIGHT: bold; COLOR: #ffffff; BACKGROUND-COLOR:
#c00000">
<th>
TypeEstate
</th>
<th>
Price
</th>
<th>
SquareMeters
</th>
<th>
City
</th>
<th>
Date
</th>
<th>
Sender
</th>
</tr>
</HeaderTemplate>
<ItemTemplate >
<tr style="backgrou nd-color:FFDEAD; COLOR:#c00000">
<td>
<%# DataBinder.Eval (Container.Data Item, "typeest") %>
</td>
<td>
<%# DataBinder.Eval (Container.Data Item, "price", "EU {0}") %>
</td>
<td>
<%# DataBinder.Eval (Container.Data Item, "sqmeters") %>
</td>
<td>
<%# DataBinder.Eval (Container.Data Item, "estcity") %>
</td>
<td>
<%# DataBinder.Eval (Container.Data Item, "addate" ) %>
<td>
<%# DataBinder.Eval (Container.Data Item, "realname" ) %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:Repeater>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.