如何在网格视图处于编辑模式时上传文件。 [英] How to upload a file in gridview when it is in EDIT mode.
问题描述
如何从Gridview上传PDF文件,当它在Editmode中时。
======================== =======================================
亲爱的朋友们,
我正在使用ASP.NET Gridview。我正在使用Modal Popup扩展程序编辑记录...它的工作正常。
但我想添加文件上传控件,所以我可以上传(REPLACE)另一个PDF文件处于编辑模式时。
这是我的设计&代码。
设计模式下的FileUpload控件。
------------------ -----------------
How to Upload a PDF file From Gridview, when it is in Editmode.
===============================================================
Dear Frnds,
Am working on ASP.NET Gridview. am editing a record using Modal Popup extender...its working fine.
but i want to add File upload control also, so i can upload(REPLACE) another PDF file when it is in edit mode.
This is my Design & code.
FileUpload control in design mode.
-----------------------------------
<asp:FileUpload ID="FileUpload_Edit" runat="server" />
==== =================================
和这是我的代码。
=====================================
and this is my Code.
protected void btnUpdate_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("UPDATE AddUsers SET FirstName='" + txtfname.Text + "',LastName='" + txtlname.Text + "',EmpNo='" + txtEmpNo.Text + "',Sponsor='" + txtSponsor.Text + "',ManagerName='" + txtManagerName.Text + "', Dept='" + txtDepartment.Text + "',Location='" + txtLocation.Text + "',OffTelNo='" + txtOffTelNo.Text + "',MobileNo='" + txtMobileNo.Text + "',IssuedDate='" + txtIssueDate.Text + "',ExpiryDate='" + txtExpiryDate.Text + "' Where Id=@Id", con);
Collapse | Copy Code
cmd.Parameters.AddWithValue("@FirstName", txtfname.Text);
cmd.Parameters.AddWithValue("@LastName", txtlname.Text);
cmd.Parameters.AddWithValue("@EmpNo", txtEmpNo.Text);
cmd.Parameters.AddWithValue("@Sponsor", txtSponsor.Text);
cmd.Parameters.AddWithValue("@ManagerName", txtManagerName.Text);
cmd.Parameters.AddWithValue("@Dept", txtDepartment.Text);
cmd.Parameters.AddWithValue("@Location", txtLocation.Text);
cmd.Parameters.AddWithValue("@OffTelNo", txtOffTelNo.Text);
cmd.Parameters.AddWithValue("@MobileNo", txtMobileNo.Text);
cmd.Parameters.AddWithValue("@IssuedDate", txtIssueDate.Text);
cmd.Parameters.AddWithValue("@ExpiryDate", txtExpiryDate.Text);
cmd.Parameters.AddWithValue("@Id", Convert.ToInt32(lblID.Text));
cmd.ExecuteNonQuery();
con.Close();
ScriptManager.RegisterStartupScript(this, this.GetType(), "RunCode", "javascript:alert('Updated successfully');", true);
BindGV();
}
请帮帮我。
谢谢。
Please help me.
THANKS.
推荐答案
请参阅类似主题的链接:
gridview中的文件上传 [ ^ ]
GridView和FileUpload控件以及EditItemTemplate [ ^ ]
文件上传控件在GridView中不起作用 [ ^ ]
使用GridView控件使用文件上载控件 [ ^ ]
- Amit
Refer the links for similar threads:
file upload in gridview[^]
GridView and FileUpload control and EditItemTemplate[^]
File Upload Control is not working in GridView[^]
Use File Upload Control With GridView Control[^]
--Amit
这篇关于如何在网格视图处于编辑模式时上传文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!