hi,

im opening a child window by injecting code through gridview rowdatabound.
and also at the same time i wanted to center the child window through the function leftmargin(); but the function does not returning any values when object is triggered.


Code:
DirectCast(e.Row.FindControl("pb_editImage"), Image).Attributes.Add("onclick", "window.open('popup_window.aspx?id=" & e.Row.DataItem("id") & "','win_title','menubar=no,status=no,toolbar=no,scrollbars=no,width=540px,height=400px, left=leftmargin();').focus();")
Code:
<script type="text/javascript" >
function leftmargin(){
 var a ;
 a  = (screen.width  - width)/2; 

 return a;
}
</script>