如何处理gridview中的链接按钮以使用更新面板? [英] How to handle link button within the gridview for using of update panel ?

查看:97
本文介绍了如何处理gridview中的链接按钮以使用更新面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在gridview中有一个gridview和一个链接按钮以及一个更新面板。



但是Link按钮用于下载使用后无法下载的文件更新面板。



更新面板内的链接按钮是否有任何代码回发



此外我还有一个加载错误...无法找到ID为'lnkDownload'的控件



为UpdatePanel'UpdatePanel1'中的触发器。



我尝试过:



I have a gridview and a link button within the gridview along with an update panel.

But the Link button is for download the file that not downloading after using update panel.

Is there any code postback for link button within update panel

Also i got an Error for loading... A control with ID 'lnkDownload' could not be found

for the trigger in UpdatePanel 'UpdatePanel1'.

What I have tried:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
 <contenttemplate>
<div style="margin-left: 140px; margin-top: 90px">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                    BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" 
                    CellPadding="4" AllowPaging="true" PageSize="50" 
                    OnRowCommand="GridView1_RowCommand" OnRowEditing="GridView1_RowEditing" 
                    OnRowCancelingEdit="GridView1_RowCancelingEdit" 
                    onrowdatabound="GridView1_RowDataBound1">
                    <columns>
                        <asp:TemplateField HeaderText="USER ID">
                            <itemtemplate>
                                <asp:Label ID="Label21" runat="server" Text='<%# Bind("userid") %>'>
                            
                        

<asp:TemplateField HeaderText="FILE DOWNLOAD">
                            <itemtemplate>
                                <asp:LinkButton ID="lnkDownload" ToolTip="Click here for download the file" runat="server" Text="Download File" CommandArgument='<%# Bind("FILEPATH") %>' CommandName="download" OnClick="lnkDownload_Click" ForeColor="Blue" Font-Underline="True">
                            
                        
<pre>
                    <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                    <HeaderStyle BackColor="#008B8B" Font-Bold="True" ForeColor="#CCCCFF" />
                    <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                    <RowStyle BackColor="White" ForeColor="#003399" />
                    <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                


 
    
                <triggers>
  <asp:AsyncPostBackTrigger ControlID="lnkDownload" EventName="lnkDownload_Click" />

推荐答案

我建​​议放弃完全异步回发并通过在target =_ blank的链接上打开一个新窗口并将文件路径作为HREF来下载文件。
I would suggest forgoing the async postback altogether and downloading the file by opening a new window on a link with target="_blank" and the path to the file as the HREF.


这篇关于如何处理gridview中的链接按钮以使用更新面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆