Click here to Skip to main content
15,888,121 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having a repeater in which three columns are given. These columns are behaving like link button/hyperlink means they are redirecting to another page. When i reaches at the next page after clicking that repeater item i want to get the value of that repeater item's text. Like if i clicks on Name "Ram" then i wants to get the value "Ram". And I also wants a boundary outside my repeater which is not coming. How can i do this?

C#
<asp:Repeater ID="Repeater1" runat="server"  
        DataSourceID="SqlDataSource1" >
         <itemtemplate>
        <asp:LinkButton ID="LinkButton1" runat="server">
              <%# DataBinder.Eval(Container.DataItem,"sal") %>
             <a href="webForm2.aspx">
              <br>Emp_id: <%# DataBinder.Eval(Container.DataItem,"emp_id", "{0:d}") %></br></a>
                     
             User Name: <%# DataBinder.Eval(Container.DataItem, 
                      "name", "{0:d}") %>
           </itemtemplate>
           <separatortemplate>
              <hr>
              
           </hr></separatortemplate>




This link button is also redirecting to "webform2.aspx". If I am using query string then how will i get that value of repeater's item.


Please help me
Thanx in advance.
Posted
Updated 1-Feb-12 1:40am
v3

You are using ASP.NET. You should tag your question accordingly.

The way to pass values to another page is to put them on the query string, like webform2.aspx?val=ram. Of course, I hope you don't have a form called webform2.aspx, I hope it has a sensible, meaningful name.

You refer to the query string in your comments, so what is the issue ? Do you not know how it works ? It's a key/value system that you access via Request.QueryString["val"] ( in my example ).'

As for the boundary, set the repeater css to have a margin to give you the boundary you want.
 
Share this answer
 
v2
Hi Kanha

You could get the required value by passing parameters to your aspx page (i.e. webForm2.aspx).

E.g.

HTML
<a href="webForm2.aspx?LinkValue=<%# DataBinder.Eval(Container.DataItem,"sal") %>"></a>


Then on the PageLoad of webForm2 you can extract the value using
C#
string MyValue = Request["LinkValue"];


With regards to having a "boundary" outside your repeater, i'm not sure i understand what you require there....
 
Share this answer
 
Comments
Christian Graus 1-Feb-12 14:20pm    
The querystring is accessible by indexing the request object directly ? I did not know that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900