Solved

C# Anchor tag

Posted on 2004-08-06
3
2,636 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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
nhewitt21 earned 50 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now