Error in Share point Download link button Event

Posted by Msudhan under SharePoint on 1/18/2012 | Points: 10 | Views : 1679 | Status : [Member] | Replies : 0
Hi i developed web part in C#,i added this web part into share point download link was working in development system but it not working in production server .
below one is error.

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12031
Line: 5
Char: 62099
Code: 0

page load:

lnkBtnResumeDownload.OnClientClick = "DownloadFunction()";
this.btnDelete.Attributes.Add("OnClick", "return confirm('Are you sure you want to delete the selected Engagement ?');");

link button click:

try
{
if (id > 0)
{
string strSql = string.Empty;
strSql = string.Format("SELECT Attachment, FileExtn FROM Engagements WHERE EngID = {0}", id);

DataSet ds = new DataSet();

ds = SQLHelper.ExecuteDataset(CONN_STRING, CommandType.Text, strSql);

if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
DataRow dr = ds.Tables[0].Rows[0];
if (!DBNull.Value.Equals(dr["Attachment"]) && !DBNull.Value.Equals(dr["FileExtn"]))
{
byte[] fileData = (byte[])dr["Attachment"];
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment; filename=" + "temp." + dr["FileExtn"].ToString());
BinaryWriter bw = new BinaryWriter(Response.OutputStream);
bw.Write(fileData);
bw.Close();
Response.ContentType = ReturnExtension(dr["FileExtn"].ToString());
Response.Flush();
Response.Close();
}
}
}
}
catch (Exception ex)
{
ErrorHandling.ErrorLog("Page : ManageEngagements.ascx.cs ; Method : DownloadAttachment ; Error : " + ex.Message);
lblDisplay.Text = "Error in loading data. ";
}


java script function:---

<script language="javascript" type="text/javascript">
function DownloadFunction() {
window.WebForm_OnSubmit = function()
{ return true; };
}


Thanks,
Madhu.




Responses

(No response found.)

Login to post response