如何在数据网格内存在的按钮单击上打开doc文件 [英] How to open a doc file on button click which is present inside a datagrid
问题描述
我有一个数据网格,我有一个数据网格中的列,按钮。如何在点击特定ID的按钮时打开简历作为doc文件。
< asp:Datagrid id =DG_JOBAPPDETAILrunat =serverWidth =600BorderColor =#3a6ea5AlternatingItemStyle-BackColor =whitecellspacing =0
OnEditcommand =EditOnClickcellpadding =0GridLines =BothAutogenerateColumns =False CssClass =Table_Background
AllowPaging =Falseonrowcommand =dg_RowCommandOnDataBinding =dg_DataBinding>
< HeaderStyle CssClass =DG_Header>< / HeaderStyle>
< columns> <% - < asp:EditCommandColumn ItemStyle-Width =20ButtonType =LinkButtonEditText =< IMG SRC = .. / images / Edit.jpg Border = 0 Width = 12 Height = 12>
ItemStyle-HorizontalAlign =CenterHeaderStyle-HorizontalAlign =Center> - %>
< asp:BoundColumn Visible =FalseDataField =ID HeaderText =IDReadOnly =True>
< asp:BoundColumn DataField =FIRST_NAMEHeaderText =FIRST_NAME>
< asp: BoundColumn DataField =LAST_NAMEHeaderText =LAST_NAME>
< asp:BoundColumn DataField =CL / REFHeaderText =CL / REFItemStyle-Width =35>
< asp:BoundColumn DataField =MOBILE_NOHeaderText =MOBILE_NO>
< asp:BoundColumn DataField =EMAIL_IDHeaderText =EMAIL_ID>
< asp:TemplateColumn HeaderText =Resume>
&l t; itemtemplate>
< asp:Button ID =ResumeWidth =60pxText =RESUMEOnClientClick =javascript.window.open('c:\ usersrs \ prasad \desktop\abc.txt'); runat =server/>
<% - < asp:Button OnClientClick =javascript.window.open('path_to_document'); /> - %>
< asp:TemplateColumn HeaderText =STATUS>
< itemtemplate>
< asp:DropDownList runat =serverEnabled =false>
< asp:ListItem>采访了
< asp:ListItem>拒绝
< asp:ListItem>入围
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
推荐答案
用户想要打开的文件必须是简单锚中的URL,或者如果你想要使用javascript,然后将URL传递给window.open而不是本地文件路径!类似
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
OnClientClick="window.open('myfiles/abc.txt');"
myfiles应该是你网站上的一个文件夹
myfiles should be a folder at your website
这篇关于如何在数据网格内存在的按钮单击上打开doc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!