?
Solved

How to pass Id in Repeater control

Posted on 2010-01-12
6
Medium Priority
?
264 Views
Last Modified: 2012-06-21
the following is the code Im using and is not working.
I would like to know how to pass a variable as a URL string.
below
       <ItemTemplate>
            <tr bgcolor="White" width="620px" style="height: 0.3px">
                <td width="16px" height="0.3px" align="Left" visible="true">
                    <asp:Label ID="lblEventID" Visible="false" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EVENTID") %>'></asp:Label>
                </td>
                <td width="175px" height="0.3px" align="left">
                    <asp:HyperLink ID="HyperItemDate" runat="server" NavigateUrl='<%# ("EditEventpage.aspx? wid=" & lblEventID)%>'
                        Text='<%#DataBinder.Eval(Container.DataItem, "DATEOFEVENT")%>' Font-Size="Medium"
                        Height="1"></asp:HyperLink>
                </td>

In this case I ahve a labek 'lblEventID" which I would like to pass. This control label is in the first <TD> and was defined. I'd like to pass it bu t I get error saying 'lblEventID' was not defined.
0
Comment
Question by:zachvaldez
[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
  • 3
  • 2
6 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 1200 total points
ID: 26297282
0
 
LVL 21

Expert Comment

by:silemone
ID: 26297532
this link shows how to use internalid

what this does is: basically you put an id on another object which houses the item...


http://www.aspcode.net/Deleting-files-checkboxes-in-repeater-howto-part-5.aspx

i used this and it definitely works...
0
 

Author Comment

by:zachvaldez
ID: 26297680
I did'nt get this part.

"chkBoxDelete.Attributes.Add("internalid", row["id"].ToString()); "
IN my case, I have a label.
What is the attribute for? and is row[Id] in my case teh eventid?  thanks
0
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.

 
LVL 21

Expert Comment

by:silemone
ID: 26297974
yes, use your label instead...

what this will due when its ran and concerted to html is something like this:

<span id='interalIdRealValue'><label...

it basically wraps a span around the row so you can get to it easily...
0
 
LVL 21

Expert Comment

by:silemone
ID: 26298020
attribute means you're adding an attribute..normally you would use it to add javascript events...

such onclick

or styles...

normally: it would  make this happen:

<asp:label id='lbl' runat='server' />
if i do this in code-behind:  lbl.Attributes.Add('onclick', 'doThis();')

it changes the above to:  <asp:label id='lbl' runat='server' onclick='doThis();' />
this is because natively, the asp tags do not support javascript events or styles..so you have to add it this way...

the way .Attributes working when using internalid is that it actually generates a span with an Id
0
 

Author Comment

by:zachvaldez
ID: 26300184
guru_sami's link works!
actually, in capsule,here's the code provided in the link which I modified...

<ItemTemplate>
        <li>
        <asp:HyperLink
            id="lnkFile"
            Text='<%#Eval("FileName")%>'
            NavigateUrl='<%#Eval("Id", "~/FileHandlerLarge.ashx?id={0}")%>'>>>THIS IS THE KEY!!! Thanks guru
            Runat="server" />
        </li>
        </ItemTemplate>
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 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