Post a Comment. Home Asp. How to download a file from Gridview using Link button in Asp. Net , C. Net , Gridview , VB. Here ID is primary key. Add a new webform to project. Drag and drop the Gridview Data Control from Toolbox. Bindgridview ;. ConnectionStrings[ "con" ]. ToString ;. Open ;. ExecuteReader ;. DataBind ;. ReadAllBytes filepath ;. ClearHeaders ;. Also one GridView control to display uploaded all the files and Label control to display message. Designer file look like as shown below.
Step 2: Create a folder with name "FileUpload" in root directory of application. Step 4: Below is the code to upload a file on button click event without checking file size and file types extension. We will simply upload a file.
Once file is uploaded, gridview will be displaying all the files with file name and size in bytes as shown below. For example, in your browser's debugging tools, what is the actual response from the server? PradeepK: How is that line of JavaScript associated with that link button? How are you preventing post back? How is that HTML page executing your server-side code? It's not clear from the code in your question what you're actually doing.
Show 10 more comments. Active Oldest Votes. You're looking for Response. TransmitFile filePath ; Response. Improve this answer. Bozhidar Stoyneff Bozhidar Stoyneff 3, 1 1 gold badge 13 13 silver badges 24 24 bronze badges. Hi Bozhidar, Thanks for the code. But I the problem is related to the JS window. Add a comment. Sign up or log in Sign up using Google. Sign up using Facebook. Ask a question. Quick access. Search related threads. Remove From My Forums. Answered by:. Archived Forums.
Getting Started with ASP. NET question on a topic that's not covered by one of the other more specific forums - ask it here. Sign in to vote.
0コメント