Hello,
My project is: 2 Panels with images, where one moves inside the other. I get the position of the second panel and make an image in the hard drive with them overlapping.
If I use a simple Web Form there is no problem, all works just fine. MY PROBLEM is when I've tried to put this page into a MasterPage.
My structure of pages is:
MasterPage (MasterPage.master)
|-- Master Page (B31.master)
|-- B3NovoModelo.aspx (Contentpage)
Attached to the aspx I have the B3NovoModelo.js that has:
function contentPageLoad() {
alert("page load");
// call the savePanelPosition when the panel is moved
$find('DragP1').add_move(savePanelPosition);
alert("FOUND THE COMPONENT");
var elem = $get("<%=HiddenField1.ClientID%>");
if (elem.value != "0") {
var temp = new Array();
temp = elem.value.split(';');
// set the position of the panel manually with the retrieve value
$find('<%=DragPanelExtender1.BehaviorID%>').set_location(new Sys.UI.Point(parseInt(temp[0]), parseInt(temp[1])));
alert("page load_2");
}
}
function savePanelPosition() {
alert("save panel position");
var elem = $find('DragP1').get_element();
var loc = $common.getLocation(elem);
var elem1 = $get("<%=HiddenField1.ClientID%>");
// store the value in the hidden field
xW = document.getElementById("ctl00_ctl00_ASPxRoundPanel1_CPHPaginas_ContentPlaceHolder1_Panel1").style.width;
xW = xW.replace(/px/, "");
xY = document.getElementById("ctl00_ctl00_ASPxRoundPanel1_CPHPaginas_ContentPlaceHolder1_Panel1").style.height;
xY = xY.replace(/px/, "");
if (loc.x > xW) { loc.x = xW; }
if (loc.y > xY) { loc.y = xY; }
$find('<%=DragPanelExtender1.BehaviorID%>').set_location(new Sys.UI.Point(parseInt(loc.x), parseInt(loc.y)));
elem1.value = loc.x + ';' + loc.y;
document.getElementById('ctl00_ctl00_ASPxRoundPanel1_CPHPaginas_ContentPlaceHolder1_txtW').value = loc.x;
document.getElementById('ctl00_ctl00_ASPxRoundPanel1_CPHPaginas_ContentPlaceHolder1_txtH').value = loc.y;
alert("save panel position 2");
}
function OnClientResizeText(sender, eventArgs) {
var e = sender.get_element();
document.getElementById("ctl00_ctl00_ASPxRoundPanel1_CPHPaginas_ContentPlaceHolder1_Image1").style.width = e.clientWidth + "px";
document.getElementById("ctl00_ctl00_ASPxRoundPanel1_CPHPaginas_ContentPlaceHolder1_Image1").style.height = e.clientHeight + "px";
document.getElementById('ctl00_ctl00_ASPxRoundPanel1_CPHPaginas_ContentPlaceHolder1_imgW').value = e.clientWidth;
document.getElementById('ctl00_ctl00_ASPxRoundPanel1_CPHPaginas_ContentPlaceHolder1_imgH').value = e.clientHeight;
}
On B3NovoModelo.aspx Page_Load() I have
ClientScript.RegisterStartupScript(GetType(), "myScript", "<script language=JavaScript>contentPageLoad();</script>");
that calls the contentPageLoad() function.
it gives the alert("page load");
but when get to the $find('DragP1').add_move(savePanelPosition); stops. I know because does not gives the alert("save panel position"); of savePanelPosition() function.
As I said above if this is in an webform without MasterPages work fine, the $find knows the DragPanelExtender BehaviorID with no problem.
Need help, please
Filipe