locked
view uploded files RRS feed

  • Question

  • User639567535 posted

    hey

    i uploaded file in gridview and now i want to view these files i.e when any user click view button then this documnet view in broswer or open in other tab

    code

    <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" 
            GridLines="None" AutoGenerateColumns="false" EmptyDataText="no files uploaded">
         
            <asp:HyperLink  runat="server" ID="lnkButton" Text="View File" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>

           protected void FileUpload_Click(object sender, EventArgs e)
           {
               if (FileUploadControl.HasFile)
               {
                   string strPath = Request.PhysicalApplicationPath + "~/DocFiles/" + FileUploadControl.FileName;
                   FileUploadControl.SaveAs(strPath);
                   lnkButton.NavigateUrl = "~/DocFiles/" + FileUploadControl.FileName;
               }
           }
    
    

       but i find the error in link button

    "The name 'lnkButton' does not exist in the current context  " 

    where as i call the link button in  grdiview (gridvie  code above)

    any help plzzz


    Monday, September 23, 2013 4:17 AM

All replies