473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Link from Repeater component

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(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");
SqlDataAdapter dad = new SqlDataAdapter("SELECT
U.REALNAME,E.ADDATE,ET.TYPEEST,O.PRICE,O.SQMETERS, E.ESTCITY FROM BLEK.USERS
U RIGHT JOIN BLEK.OFFERS O ON U.USERID=O.USERID LEFT JOIN BLEK.ESTATES E ON
O.ESTATEID=E.ESTATEID LEFT JOIN BLEK.Est_TYPE AS ET ON E.ESTTYPEID=ET.TYPEID
LEFT JOIN BLEK.TYPEOFFER AS OT ON E.TYPEOFFERID=OT.OFFERID LEFT JOIN
BLEK.TYPECONSTRUCTION AS TC ON E.TYPECONSTRID=TC.CONSTRID WHERE
E.ESTCITY=@CITY AND OT.TYPEOFFER=@TOFFER", conn);
conn.Open();
dad.SelectCommand.Parameters.Add(new SqlParameter("@CITY",
SqlDbType.VarChar,20));
dad.SelectCommand.Parameters["@CITY"].Value = Session["city"].ToString();
dad.SelectCommand.Parameters.Add(new SqlParameter("@TOFFER",
SqlDbType.VarChar,20));
dad.SelectCommand.Parameters["@TOFFER"].Value = Session["offer"].ToString();
DataSet ds = new DataSet();
dad.Fill(ds, "Users");
conn.Close();
MyRepeater.DataSource = ds.Tables["Users"].DefaultView;
MyRepeater.DataBind();
}

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="background-color:FFDEAD; COLOR:#c00000">
<td>
<%# DataBinder.Eval(Container.DataItem, "typeest") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "price", "EU {0}") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "sqmeters") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "estcity") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "addate" ) %>
<td>
<%# DataBinder.Eval(Container.DataItem, "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.
Nov 18 '05 #1
1 1678
Hi,
If I understand your question correctly this should work for you...

You have used <%# DataBinder.Eval(Container.DataItem, "typeest") %>
Use <asp:HyperLink> control instead such as:
<asp:HyperLink id="lnkGo" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "typeest") %>' NavigateUrl="url
here"></asp:HyperLink>

--
Regards,
Bipin Joshi
Consultant | Microsoft MVP | ASPInsider
The .NET Knowledge Base - www.dotnetbips.com
Looking for .NET Training in Mumbai?
Visit www.binaryintellect.com for details.
"Viktor Popov" <vi****@yahoo.com> wrote in message
news:#0**************@TK2MSFTNGP10.phx.gbl...
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(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");
SqlDataAdapter dad = new SqlDataAdapter("SELECT
U.REALNAME,E.ADDATE,ET.TYPEEST,O.PRICE,O.SQMETERS, E.ESTCITY FROM BLEK.USERS U RIGHT JOIN BLEK.OFFERS O ON U.USERID=O.USERID LEFT JOIN BLEK.ESTATES E ON O.ESTATEID=E.ESTATEID LEFT JOIN BLEK.Est_TYPE AS ET ON E.ESTTYPEID=ET.TYPEID LEFT JOIN BLEK.TYPEOFFER AS OT ON E.TYPEOFFERID=OT.OFFERID LEFT JOIN
BLEK.TYPECONSTRUCTION AS TC ON E.TYPECONSTRID=TC.CONSTRID WHERE
E.ESTCITY=@CITY AND OT.TYPEOFFER=@TOFFER", conn);
conn.Open();
dad.SelectCommand.Parameters.Add(new SqlParameter("@CITY",
SqlDbType.VarChar,20));
dad.SelectCommand.Parameters["@CITY"].Value = Session["city"].ToString();
dad.SelectCommand.Parameters.Add(new SqlParameter("@TOFFER",
SqlDbType.VarChar,20));
dad.SelectCommand.Parameters["@TOFFER"].Value = Session["offer"].ToString(); DataSet ds = new DataSet();
dad.Fill(ds, "Users");
conn.Close();
MyRepeater.DataSource = ds.Tables["Users"].DefaultView;
MyRepeater.DataBind();
}

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="background-color:FFDEAD; COLOR:#c00000">
<td>
<%# DataBinder.Eval(Container.DataItem, "typeest") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "price", "EU {0}") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "sqmeters") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "estcity") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "addate" ) %>
<td>
<%# DataBinder.Eval(Container.DataItem, "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.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: SeaPlusPlus | last post by:
I've got a problem... IE 6.0 twitches when I hover over a link then it won't twitch again for that group of links but will twitch the first time on the next group... and the next group... etc... ...
2
by: matt \(Ziba\) | last post by:
is there any way i can user a repeater with in my c# .NET application? apparently there is not one within c# does any one no of a repeater in any other .Net Language? or does any one know of...
0
by: Viktor Popov | last post by:
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...
1
by: Fraggle | last post by:
I have a repeater with controls added at run time. the <template> also contains a <asp:textbox that is made visible on some repeater elements. when I come to read the text info out it has...
2
by: Stan | last post by:
I cannot make the link buttons fire ItemCommand from repeater control. Here is the code: <asp:repeater id=rptLetters runat="server"> <itemtemplate> <asp:linkbutton id="lnkLetter"...
1
by: darrel | last post by:
I have a form that has a 'sub-form' in it that updates a separate table. I can easily add records to this table from within this page. To delete, though, I've been redirecting to a different...
3
by: Shimon Sim | last post by:
I put linkbutton in a repeater header. I attached event handler in makeup as onclick="btnSort_Click". Made btnSort_Click method public. It doesn't fire if I click on it. I tried to attach it in...
1
by: Fred Dag | last post by:
As far as I can work out when using the OnTextChanged event I cannot get the TextBox and Labels values when the event fires as they are populated by a <asp:repeater and so don't have values. If...
0
by: wassimdaccache | last post by:
Hello Experts; I have a wireless router TP-link I made security phrase for it. What i am trying to do is to configure a d-link access point as a repeater for the TP-link and always not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.