PDA

View Full Version : عمل نکردن لینک دانلود در صفحه دوم گریدویو



project80888
یک شنبه 05 آبان 1392, 14:45 عصر
سلام دوستان من توی یه userControl یه گریدویو گذاشتم و Paging اون فعال کردم
مشکل اینجاس که لینک دانلود در صفحه دوم به بعد کار نمی کنه در صورتی که در صفحه اول کار می کنه


private void DownloadLink(string url, string ContentType)
{
string fullFileName = Server.MapPath(url);
System.IO.FileInfo toDownload = new System.IO.FileInfo(fullFileName);
if (toDownload.Exists)
{
Response.Clear();
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + toDownload.Name);
Response.AppendHeader("Content-Length", toDownload.Length.ToString());
// Response.TransmitFile(fullFileName);
Response.WriteFile(fullFileName);
Response.End();
// ApplicationInstance.CompleteRequest();

}
}





protected void _gvUpload_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
int index = int.Parse(e.CommandArgument.ToString());
GridViewRow row = _gvUpload.Rows[index];

Label lbl_FID = (Label)row.FindControl("lbl_FID");
Label lbl_F_Active = (Label)row.FindControl("lbl_F_Active");
Label lbl_DownladLinkAddress = (Label)row.FindControl("lbl_DownladLinkAddress");
Label lbl_ContentType = (Label)row.FindControl("lbl_ContentType");

if (e.CommandName == "DownloadLink")
{

DownloadLink(lbl_DownladLinkAddress.Text, lbl_ContentType.Text);

}



}
catch (Exception ex)
{

Label8.Text = ex.Message;
}



}

project80888
یک شنبه 05 آبان 1392, 14:47 عصر
از update panel هم استفاده نمی کنم×