Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a webdatagrid in my page where aspx code of one field is as below

ASP.NET
<ig:TemplateDataField Key="TemplateField_0" Width="20%">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgNewDocument" runat="server" AlternateText="View" Width="16px" Height="9px" SkinID="ViewIcon"
                                                    CommandArgument=' <%#Eval("FileName") + "*" +Eval("DocumentCaption")%>' OnClick="imgNewDocument_Click" ToolTip="View documents"
                                                    />
                                        </ItemTemplate>
                                        <Header Text="View" />
                                    </ig:TemplateDataField>



I got an error as "DataBinding Method Such as Eval(),XPath(), and Bind() can Only be used in the Context of a databound Control."

How can I solve this issue.
Please help me to solve this.
Posted

1 solution

I tried the below code and it is working. Try using this code -

C#
<asp:linkbutton id="lnkView" runat="server" text="View" commandname="ViewRow" commandargument="<%#Eval("TourCode") + "*" + Eval("TourCode") %>" xmlns:asp="#unknown" />
 
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