?
Solved

How to pass Id in Repeater control

Posted on 2010-01-12
6
Medium Priority
?
274 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
  • 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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

599 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