Click here to Skip to main content
15,070,233 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i have a gridview and there is two field.

1. document path which is visible false
2. title of document and it is link button.


so, if i have 5 documents title so when i click on particular title it`s path automatically take and open file from some folders like Admin/document/xx.pdf .. Here xx.pdf is title come from selected link button and that file i want to open in same window.

Thankss...
Mitesh
Posted
Updated 19-Apr-12 23:52pm
v2
Comments
Praveen Meghwal 20-Apr-12 5:38am
   
Please make your question more clear and if possible post code snippets.

1 solution

Hi,
Set the Command Name for Link Button as "OpenDoc".

I assume that the document path you are saving in ItemTemplate of the gridview as a label with id "lblDocPath".

On GridView Command Event add this below code.

C#
//GridView Command Event
  
   if(e.CommandName=="OpenDoc")
   {
       Label docPath = (Label)((sender as LinkButton).Parent.FindControl("lblDocPath"));
       System.Diagnostics.Process.Start(docPath.Text);
   }



hope it works
   
Comments
sjelen 20-Apr-12 7:02am
   
"System.Diagnostics.Process.Start(docPath.Text);" on server side?

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