Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi coder my query is like this i have 10 user in my database i take the name of my user into a repeater where i take a link button and bind it with my database like this:

C#
<asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand">
<HeaderTemplate>
    <table>
        <td>
            Name
        </td>
</HeaderTemplate>
<ItemTemplate>
    <tr>
        <td>
            <asp:LinkButton ID="LinkButton1" OnClick="Amitesh_Click" runat="server" Text='<%#Eval("Name") %>' CommandArgument='<%#Eval("ID") %>'
                CommandName="bind" PostBackUrl="~/home/Amitesh"></asp:LinkButton>
        </td>
    </tr>
</ItemTemplate>
<FooterTemplate>
    </table>
</FooterTemplate>


now i take a gridview and show details of that users by clicking on different link button like this:
C#
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
    if (e.CommandName == "bind")
    {
        string ID = e.CommandArgument.ToString();
        cmd = new SqlCommand("select * from UserDetails where ID='" + ID + "'", con);
        con.Open();
        da = new SqlDataAdapter(cmd);
        da.Fill(dt);
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
}


I made some change is my web.config file to make url rewritting and on postback url on linkbutton i change the url when i click on link buttons.

Now in my present situation when i click on any on the ten links from my repeater it show the same url which i put in postbackurl of linkbutton What i want is to change the url of each link using url rewriting so that when every user click on any link it can view different url

how can i do that

Thanks in advance !!!
Posted
Comments
pradiprenushe 20-Aug-13 13:32pm    
Refer this
http://www.codeproject.com/Articles/77199/URL-Routing-with-ASP-NET-4-0
amitesh1989 26-Aug-13 5:06am    
Thanks for the reply i already view that link before in my case i want to bind link from database and when user click on any of the link ID should match and details of the user can be view with change in url

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