Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, can you please help me to solve this problem. I am trying to pass the id of a row in a gridview to another page, but I am having this error, could you please help me. The concept is that when I click to view the details of a particular row, it should redirect to another page, by having the id of the row that I will use to fetch the data in database. Here is the code. Thank you

XML
<asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButtonView" runat="server" PostBackUrl='<%# "~/Web_Pages/Details?PropertyId="+ Bind("PropertyId") %>'>View</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
Posted

Try like below...
<asp:LinkButton ID="LinkButtonView" runat="server" PostBackUrl="~/Web_Pages/Details?PropertyId=" + '<%# Bind("PropertyId") %>'>View</asp:LinkButton>

Adjust the quotes if necessary.
 
Share this answer
 
if Tadit solution doesn't works, try this..
ASP.NET
<asp:linkbutton id="LinkButtonView" runat="server" postbackurl=" <%# Eval("PropertyId", "~/Web_Pages/Details?PropertyId={0}") %>"  >View</asp:linkbutton>
 
Share this answer
 
v2
Comments
Member 10215709 23-Dec-13 7:26am    
Thank you.
Replace Bind("PropertyId") with <%# Bind("PropertyId") %> and check...

Hope, your problem will be Resolved..
 
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