?
Solved

C# Anchor tag

Posted on 2004-08-06
3
Medium Priority
?
2,644 Views
Last Modified: 2011-10-03
Hi all

I am new to C# i am using repeater control to display data the code is as follow. I need to assign  customerid in the anchor tag can anyone help me.


<tr><td colspan=4><ASP:Repeater id="MyRepeater" runat="server">
      <HeaderTemplate>
         <table width=600 border=1 frame="void" bordercolordark="#FFFFFF" bordercolorlight="#cccccc" rules="rows">
            <tr class='barbg' align=left >
               <th class="titlehead">
                  &nbsp;Name
               </th>
               <th class="titlehead">
                  &nbsp;Telephone
               </th >
               <th class="titlehead">
                 &nbsp; Fax
               </th >
               <th class="titlehead">
                  &nbsp;Contact Name
               </th>
               <th class="titlehead">
                  &nbsp;Contacts
               </th>
             
            </tr>
      </HeaderTemplate>
            
            
      <ItemTemplate>
            
            <tr class='colhead' >
               <td width=150>
                  <%# DataBinder.Eval(Container.DataItem, "customername") %>
               </td>
               <td width=100>
                  <%# DataBinder.Eval(Container.DataItem,"phone") %>
               </td>
               <td width=100>
                  <%# DataBinder.Eval(Container.DataItem, "fax") %>
               </td>
               <td width=100>
                  <%# DataBinder.Eval(Container.DataItem, "Contactname") %>
               </td>
                <td width=100>
                 <a id="link1" runat="server" HRef="customercontact.aspx?custid="><%# DataBinder.Eval(Container.DataItem, "Contactname") %></a>
               </td>
            </tr>
           
      </ItemTemplate>
     
            
      <FooterTemplate>
      <tr class='colhead' >
               <td colspan='4'>&nbsp;</td>
                 
            </tr>
         </Table>
      </FooterTemplate>
   </ASP:Repeater></td></tr>
     
      
thanks
0
Comment
Question by:surya_madhavi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
nhewitt21 earned 150 total points
ID: 11734784
try replacing:
<a id="link1" runat="server" HRef="customercontact.aspx?custid="><%# DataBinder.Eval(Container.DataItem, "Contactname") %></a>

with:
<asp:Label id="label_lnk" text='<%#"<a id=\"link1\" runat=\"server\" href=\"customercontact.aspx?custid=" + (DataBinder.Eval(Container.DataItem,"Contactname").ToString()) + "\">" + (DataBinder.Eval(Container.DataItem,"Contactname").ToString())  + "</a>"%>'/>

That should do the trick.
0
 

Author Comment

by:surya_madhavi
ID: 11734898
Hi

thank you it worked.
0
 
LVL 3

Expert Comment

by:nhewitt21
ID: 11734966
No problem, glad it worked for you
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question