2011-11-08 4 views
0

私はaspxページaspx.csページ内のdocument.getElementById(progressPanel.ID)を設定する方法

をからクライアントIDを渡しています
function ShowProgressPanel(progresspanel) 
{ 
    var progressPanelId = document.getElementById(progressPanel.ID); 
    alert(progressPanelId); 
    if (progressPanelId != null) 
    { 

     var height = Math.min(document.documentElement.clientHeight, document.body.offsetHeight); 
     alert(height); 
     var width = Math.min(document.documentElement.clientWidth, document.body.offsetWidth); 
     var xPos = Math.round((width/2) - (progressPanelId.clientWidth/2)); 
     var yPos = Math.round((height/2) - (progressPanelId.clientHeight/2)); 
     setLocation(progressPanelId, { x: xPos, y: yPos }); 
    } 

    function setLocation(element, point) 
    { 
     Sys.UI.DomElement.setLocation(element, point.x, point.y); 
    } 
} 

の下パネルとJavaScriptの場所を設定するJavaScriptが持っています
var progressPanel = document.getElementById('<%=_progressPanel.ClientID %>'); 

ShowProgressPanel(progressPanel); 

私がaspx.csページから送信fine.whenのdiv tag.aboveコードをHTMLに設定されている作品はcontentplaceホルダー要素を示しており、高さが設定されていません。

string script = string.Format(@"ShowProgressPanel('{0}');", _progressPanel.ClientID); 
ScriptManager.RegisterStartupScript(this, typeof(Page), _progressPanel.ID, script, true); 

しかし、どちらの進捗パネルもcontetnplaceholderに配置されています。 aspx.csページでどうすればいいですか

答えて

0

要素とIDを混ぜています。

function ShowProgressPanel(progresspanelId) 
{ 
    var progressPanelElement = document.getElementById(progresspanelId); 

    setLocation(progressPanelElement , { x: xPos, y: yPos }); 
} 

function setLocation(element, point) 
{ 
    Sys.UI.DomElement.setLocation(element, point.x, point.y); 
} 
関連する問題