Click here to Skip to main content
15,902,189 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I'm trying to place select hyperlink, or button to get item details on another page. In DataGrid control it is very easy to do it, I have just add HyperLinkField, and add Url parameter details.aspx?id={0}.

I have tried with below code, but of course it is not working, as getting error:
"Input string was not in a correct format"

XML
<asp:HyperLink  id="HyperLink1" runat="server" navigateurl="details.aspx?id={0}"> Details</asp:HyperLink>


Thank you in advance for help to anyone.
Posted
Updated 10-Apr-11 17:40pm
v2

Alternative is, the <asp:gridview xmlns:asp="#unknown"> tag have the attribute setting AutoGenerateSelectButton=true and OnSelectedIndexChanged="selectedIndex_Changed", on the server side

C#
protected void selectedIndex_Changed(object sender, EventArgs  e)
        {

            int selectedIndex=((GridView )sender).SelectedIndex
        }



using the selectedIndex, you can get the id value and have redirect command.

or Send me your code.
 
Share this answer
 
Comments
m@dhu 11-Apr-11 0:32am    
I think OP is asking about DataList control.
<asp:HyperLink  id="HyperLink1" runat="server" navigateurl='details.aspx?id=<%# Eval("IDfield") %>'> Details</asp:HyperLink>
 
Share this answer
 
Thanks guys for replies. As I'm using vb.net, I will took last solution.
 
Share this answer
 

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