I need to callback Javascript function in my code, but not firing. I am providing details what I am doing?.
I have input button in the page that calling javascript function. There I am loading another ProfilePic.aspx page. ProfilePic.aspx has FileUpload, OK and cancle button
<input type=button value="Change Image" onclick="javascript:SelectUserImage()" />
Javascript functions are
<script type="text/javascript"> function SelectUserImageCallback(ret) { var imgId = 'ctl00_PlaceHolderMain_prof_imgUser'; var clearId = 'ctl00_PlaceHolderMain_prof_hidImageURL'; if (ret) { if (ret == '__RESET__') { document.getElementById(imgId).src = '\u002f_layouts\u002fimages\u002fno_pic.gif'; document.getElementById('ctl00_PlaceHolderMain_prof_hidImageURL').value = ''; document.getElementById(clearId).style.display = 'none'; } else { document.getElementById(imgId).onload = 'imgResizeMax(\'ctl00_PlaceHolderMain_prof_imgUser\', 100);imgResizeTbl(\'ctl00_PlaceHolderMain_prof_imgUser\');'; document.getElementById(imgId).src = ret; document.getElementById('ctl00_PlaceHolderMain_prof_hidImageURL').value = ret; setTimeout('imgResizeMax(\'ctl00_PlaceHolderMain_prof_imgUser\', 100);imgResizeTbl(\'ctl00_PlaceHolderMain_prof_imgUser\');', 1); setTimeout('imgResizeMax(\'ctl00_PlaceHolderMain_prof_imgUser\', 100);imgResizeTbl(\'ctl00_PlaceHolderMain_prof_imgUser\');', 100); document.getElementById(clearId).style.display = ''; } } } function SelectUserImage() { var href = '\u002f_layouts\u002fProfilePic.aspx';
}var features = 'resizable: yes; status: no; scroll: no; help: no; center: yes; dialogWidth: 460px; dialogHeight: 140px; width:460;height:240;menubar:no;directories:no;location:no;'; commonShowModalDialog(href, features, SelectUserImageCallback, null);
In the ProfilePic.aspx page once user click OK buttong. I am upload his pic with some logic then I am closing window with javascript
protected void btnOK_Click(Object sender, EventArgs e) {
try
{
// My logic Here
Debug.WriteLine("Shared Pictures Save Ends: " + DateTime.Now);
Response.Write ("<script language =javascript>close();</script>");
Response.End();
}
catch (Exception exception)
{
LogMessage(exception.Message, EventLogEntryType.Error);
if (exception.Message.ToLower().Contains("blocked"))
errorDisplay.Text = "* This type of file has been blocked by the administrator, please try a different file.";
else
{
errorDisplay.Text = exception.Message;
}
}
}
My Question:
I am able to close the window but, What ever I need to call callback function `SelectUserImageCallback' not firing. I need to call this method after OK button part execution done.