Click here to Skip to main content
15,909,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datagrid i have bound columns, button inside a datagrid . how can i open a resume as doc file on click of the button for particular id.

<asp:Datagrid id="DG_JOBAPPDETAIL" runat="server" Width="600" BorderColor="#3a6ea5" AlternatingItemStyle-BackColor="white" cellspacing="0"
OnEditcommand="EditOnClick" cellpadding="0" GridLines="Both" AutogenerateColumns="False" CssClass="Table_Background"
AllowPaging="False" onrowcommand="dg_RowCommand" OnDataBinding="dg_DataBinding">
<HeaderStyle CssClass="DG_Header"></HeaderStyle>
<columns> <%--<asp:EditCommandColumn ItemStyle-Width="20" ButtonType="LinkButton" EditText="<IMG SRC=../images/Edit.jpg Border=0 Width=12 Height=12>"
ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">--%>
<asp:BoundColumn Visible="False" DataField="ID" HeaderText="ID" ReadOnly="True">
<asp:BoundColumn DataField="FIRST_NAME" HeaderText="FIRST_NAME">
<asp:BoundColumn DataField="LAST_NAME" HeaderText="LAST_NAME ">
<asp:BoundColumn DataField="CL/REF" HeaderText="CL/REF" ItemStyle-Width="35">
<asp:BoundColumn DataField="MOBILE_NO" HeaderText="MOBILE_NO">
<asp:BoundColumn DataField="EMAIL_ID" HeaderText="EMAIL_ID ">

<asp:TemplateColumn HeaderText="Resume">
<itemtemplate>
<asp:Button ID="Resume" Width="60px" Text="RESUME" OnClientClick="javascript.window.open('c:\users\prasad\desktop\abc.txt');" runat="server" />
<%-- <asp:Button OnClientClick="javascript.window.open('path_to_document');" />--%>


<asp:TemplateColumn HeaderText="STATUS">
<itemtemplate>
<asp:DropDownList runat="server" Enabled="false">
<asp:ListItem>Interviewed
<asp:ListItem>Rejected
<asp:ListItem>Shortlisted




Posted

1 solution

The file you want to be opened by the user must be a URL in a simple anchor or if you want to use javascript, then pass a URL to window.open NOT a local file path! Something like

HTML
OnClientClick="window.open('myfiles/abc.txt');"


myfiles should be a folder at your website
 
Share this answer
 

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