Click here to Skip to main content
15,885,955 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey all

in m girdview i add linkbutton downlaod when i run follwoing error occur

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Uploadfile'.


girdivew is

C#
 <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" 
        GridLines="None">
        <Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="Linkdwnld" runat="server"
CommandArgument='<%# Eval("Uploadfile") %>' CommandName="cmd">Download</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>


sql query is

C#
select dbo.Document.DocID as [Document ID],dbo.Document.DocName as [Document Name],
dbo.Document.Uploadfile as [Uploaded File],dbo.Document.UploadedBy as [Uploaded By],
dbo.DocType.DocType as [Document Type],dbo.Department.DepType as [Department Type]
from dbo.Document left join dbo.DocType on dbo.Document.DocTypeID=dbo.DocType.DocTypeID left join 
dbo.Department on dbo.Document.DepID=dbo.Department.DepID left  join dbo.Users on dbo.Document.DocID=dbo.Users.UserID


please help me about this
Posted
Updated 21-Apr-13 13:51pm
v2

1 solution

The error is from your Sql Query. You should never give a space in a column name. Try this:
SQL:
SQL
select dbo.Document.DocID as [DocumentID],dbo.Document.DocName as [DocumentName],
dbo.Document.Uploadfile as [UploadedFile],dbo.Document.UploadedBy as [UploadedBy],
dbo.DocType.DocType as [DocumentType],dbo.Department.DepType as [DepartmentType]
from dbo.Document left join dbo.DocType on dbo.Document.DocTypeID=dbo.DocType.DocTypeID left join 
dbo.Department on dbo.Document.DepID=dbo.Department.DepID left  join dbo.Users on dbo.Document.DocID=dbo.Users.UserID

HTML:
ASP.NET
<asp:gridview id="GridView1" runat="server" cellpadding="4" forecolor="#333333" >
        GridLines="None">
        <columns>
<asp:templatefield>
<itemtemplate>
<asp:linkbutton id="Linkdwnld" runat="server" CommandArgument='<%# Eval("UploadFile") %>' CommandName="cmd">Download</asp:linkbutton>
</itemtemplate>
</asp:templatefield>
</columns></asp:gridview>



--Amit
 
Share this answer
 
v3

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