i have a Handler.ashx in my project for showing save as dialog to my users.
also i have a repeater with a link buttons inside for click and showing the upper save as dialog at last.
i put my repeater inside an update panel!
the codes of ItemCommand Of that repeater is like below :
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
//The Below Line Does Not Work - Always Is Null
//NewAddedFiles currentItem = (NewAddedFiles)e.Item.DataItem;
HiddenField hfFilePath = (HiddenField)e.Item.FindControl("hfFilePath");
HiddenField hfFileName = (HiddenField)e.Item.FindControl("hfFileName");
HiddenField hfFileSize = (HiddenField)e.Item.FindControl("hfFileSize");
HiddenField hfFileCreationDate = (HiddenField)e.Item.FindControl("hfFileCreationDate");
switch (e.CommandName)
{
case "lbFile_Click":
{
if (Session["User_ID"] != null)
{
DataSet dsDownload = DataLayer.Download.Size_By_UserID_Today(int.Parse(HttpContext.Current.Session["User_ID"].ToString()), DateTime.Now);
if (dsDownload.Tables["Download"].Rows.Count > 0)
{
DataRow drDownload = dsDownload.Tables["Download"].Rows[0];
int SumOfFileSize4Today = int.Parse(drDownload["FileSizSum"].ToString());
if (SumOfFileSize4Today + int.Parse(hfFileSize.Value) <= 1073741824)//1 GB = 1024*1024*1024 bytes = 1073741824 bytes
//if (SumOfFileSize4Today + int.Parse(hfFileSize.Value) <= 100000)
{
DataLayer.Download.InsertRow(
int.Parse(HttpContext.Current.Session["User_ID"].ToString()),
DateTime.Now,
hfFilePath.Value,
hfFileName.Value,
hfFileSize.Value,
DateTime.Parse(hfFileCreationDate.Value)
);
Response.Redirect("~/HandlerForRepeater.ashx?path=" + hfFilePath.Value);
}
else
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "YouCanNotDownloadAnyMore_SizeOverload", "YouCanNotDownloadAnyMore_SizeOverload();", true);
}
}
else
{
if (int.Parse(hfFileSize.Value) <= 1073741824)
//if (int.Parse(hfFileSize.Value) <= 100000)
{
DataLayer.Download.InsertRow(
int.Parse(HttpContext.Current.Session["User_ID"].ToString()),
DateTime.Now,
hfFilePath.Value,
hfFileName.Value,
hfFileSize.Value,
DateTime.Parse(hfFileCreationDate.Value)
);
Response.Redirect("~/HandlerForRepeater.ashx?path=" + hfFilePath.Value);
}
else
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "YouCanNotDownloadAnyMore_SizeOverload", "YouCanNotDownloadAnyMore_SizeOverload();", true);
}
}
}
else
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "plzLoginFirst_ForDownload", "plzLoginFirst_ForDownload();", true);
}
break;
}
default:
{
break;
}
}
}
}
the important part of this code is :
Response.Redirect("~/HandlerForRepeater.ashx?path=" + hfFilePath.Value);
because of this line callback never ends and when save as dialog comes up , repeater area goes to thinkink mode and is disabled!
how can i fix this issue?
I am not completely familiar with UpdatePanels but I think you have pretty much answered this yourself when you say the ‘callback never ends and when save as dialog comes up, repeater area goes to thinking mode and is disabled’.
What is happening is you are not returning a page response to your request but instead making a request to the server from your page which is redirecting to your handler which I am guessing is responding with a file download. The page you requested from is now stale, if you want to carry on using this page you need to return it as the response instead.
Two options you could consider are: