473,652 Members | 2,979 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(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.
Nov 18 '05 #1
1 1695
Hi,
If I understand your question correctly this should work for you...

You have used <%# DataBinder.Eval (Container.Data Item, "typeest") %>
Use <asp:HyperLin k> control instead such as:
<asp:HyperLin k id="lnkGo" runat="server" Text='<%#
DataBinder.Eval (Container.Data Item, "typeest") %>' NavigateUrl="ur l
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.c om> wrote in message
news:#0******** ******@TK2MSFTN GP10.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(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.

Nov 18 '05 #2

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

Similar topics

6
2210
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... Check out the web page in question... http://clientserver.home.comcast.net/research.html Firefox handles this code fine as does Opera, Mozilla, and Netscape 7.
2
1114
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 a company producing a repeater component. are ther any plans for microsoft to include a repeater in
0
1185
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 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...
1
2317
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 disapeared. The read is done on a button click. I can read the selected items from the other controls in the repeater, demo page here
2
12005
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" runat="server" commandname="Filter" CommandArgument='<%#
1
1468
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 'delete' page where it asks for confirmation before deleting. This works, but the problem is that I loose my postback information from the main page. Since this is just a small bit of a larger form, I don't want people to fill out half the form, get...
3
4146
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 ItemDataBound event but I think it is too late. What am I doing wrong? Thanks Shimon.
1
4890
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 I try to give the repeater values by removing if (!IsPostBack) {} from the
0
2056
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 working :(!!! while i am scanning in my access point (d-link) I see the tp-link and I am able to connect but when I scan using my wifi on my laptop I'm not seeing the D-link . Why ?
0
8367
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8279
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8703
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8589
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.