Click here to Skip to main content
15,899,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Now i want when i click on any item of repeater it will redirect to another page along with query string.. whose value comes from database like (name). Actually what i want to do when i click on any item i want to redirect to user detail-page along with its user information.

following is my code:
XML
<asp:Repeater ID="repeator1" runat="server">
    <HeaderTemplate>


    </HeaderTemplate>
    <ItemTemplate>

    <table>

    <tr>
    <td>
   <asp:Label ID="name" runat="server"  Text='<%#Eval("Name")%>'></asp:Label>
    </td>
    <tr>
   <td>
 <asp:Image Width="100" ID="Image1" ImageUrl='<%# Bind("Logo", "~/Images/{0}") %>' runat="server" />
   </td>
    </tr>
    </tr>
    </table>
    </ItemTemplate>

    </asp:Repeater>




code behind:

C#
protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"data source=#######;Integrated Security=true;initial catalog=#####");

        con.Open();
        SqlCommand cmd = new SqlCommand("select * from Allapps", con);
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(ds);
        repeator1.DataSource = ds;
        repeator1.DataBind();

}
Posted
Updated 23-Mar-14 0:04am
v2

may be you can try repeater itemcommand event and get data of selected item using command argument or may be by repeater's findcontrol method. then you can redirect to another page.
 
Share this answer
 
C#
RepDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
{

if (e.Item.ItemType.ToString().ToLower() == "item")
{
LinkButton l = (LinkButton)e.Item.FindControl("LinkButton1");
l.PostBackUrl = "yourpage.aspx?title='" + l.Text + "'";
}
}
 
Share this answer
 
Comments
Godwin Savarimuthu 11-Oct-17 10:42am    
how to receive the link button value another .aspx page

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