更新按钮时如何使用在Gridview中上传图像 [英] How to Use upload a image in Gridview when on update button

查看:41
本文介绍了更新按钮时如何使用在Gridview中上传图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GridView中使用的Fileupload控件.如果我在外面接东西,则可以更改,但我想在内部使用此控件(GridView更新事件).请帮助我.

Fileupload control with use in GridView. If i take in outside then can be change but I want to use this control inside(GridView update event). Pls help me.

推荐答案

GridView On the Page

<asp:TemplateField HeaderText="File Attachment" sortExpression="strFileAttachment">
                <ItemTemplate>
                    <p>
                        <%#Eval("strFileAttachment")%>
                    </p>
                </ItemTemplate>

                <EditItemTemplate>
                    <asp:FileUpload ID="FileUploadFileAttachment"     runat="server" />                    
                </EditItemTemplate>

</asp:TemplateField>



背后的核心是



Core behind is

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)

{

FileUpload FileUpload1 = (FileUpload)GridView1.Rows[e.RowIndex].FindControl("FileUploadFileAttachment");

}

I think this may solve your problem.
Let me Know if it will work for you.


这篇关于更新按钮时如何使用在Gridview中上传图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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