0
<ItemTemplate>
<asp:HyperLink ID="hlURL" runat="server" NavigateUrl="<%# Eval("LinkFilenameNoMenu")%>"
Text='<%# Eval("LinkFilenameNoMenu")%>'></asp:HyperLink>
</ItemTemplate>

using (SPWeb web = site.OpenWeb())
{
     SPList list = web.Lists["Documents"];
     SPQuery query = new SPQuery();
     query.Query = "<OrderBy><FieldRef Name=\"ID\" Ascending=\"False\" /></OrderBy>";
     SPListItemCollection listItemColl = list.GetItems(query);
     DataTable dtResut = listItemColl.GetDataTable();
     DataView dvReferral = dtResut.DefaultView;

     gvReferral.DataSource = dtResut;
     gvReferral.DataBind();
     ViewState["ReferralData"] = dvReferral.ToTable();
 }           

The above is my code but when I click on the link of the document on the GridView it is navigating to some other page. I want to open the document in the browser or get option to save it to desktop and view the document.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.