You can download file easily by using above function. Note:
1. You need to pass fileName and filePath parameters
2. Here, I have used general content type “application/octet-stream”. Change it as per your requirement
3. Add reference for System.IO
I want to share example of bind dropdown in gridview. In Edit mode when you want to show your value in dropdown it will help you.
To add dropdown use following code for gridview.
<%# Eval("Title") %>
<%# Eval("FirstName") %>
<%# Eval("LastName") %>
<%# Eval("AddressLine1") %>
<%# Eval("City") %>
<%# Eval("PostalCode") %>
Now, add following code in cs file. We are using Edit event and BindDropDown function to achieve our goal. In Edit mode you can use other objects too like checkbox, radiobutton etc…