Calling Pop up window and set the pop up window position at the center of the screen
If you need to pass the querystring to pop up page
You can do in this way:
1. Set the Function on onclick
2. Set the querystring parameters and call the popup function
3. Call the pop up page by passing querystring

function PopUp(targetPage, w, h) { var leftPos = 0; var topPos = 0; if (screen) { leftPos = (screen.width / 2) - 251; topPos = (screen.height / 2) - 162; var windowFeatures = 'height=' + h + ',width=' + w + ',left=' + leftPos + ',top =' + topPos + ',scrollbars=yes,resizable=yes,status=yes,toolbar=no,menubar=no,location=no'; window.open(targetPage, null, windowFeatures); } }
If you need to pass the querystring to pop up page
You can do in this way:
1. Set the Function on onclick
lnkUpdate.Attributes.Add("onclick", "javascript:SetPopUpParameters('" + lblTKNumber.Text + "')")
2. Set the querystring parameters and call the popup function
function SetPopUpParameters(TxionID) { var queryStringKeyArray = []; queryStringKeyArray[0] = 'TxionID'; var queryStringValueArray = []; queryStringValueArray[0] = TxionID; PopUpWithQueryString('Page.aspx', 600, 150, queryStringKeyArray, queryStringValueArray); }
3. Call the pop up page by passing querystring
function PopUpWithQueryString(targetPage, w, h, queryStringKeyArray, queryStringValueArray) { var queryString = ""; for (var i = 0; i < queryStringKeyArray.length; i++) { queryString = queryString.concat(queryStringKeyArray[i]); queryString = queryString.concat("="); queryString = queryString.concat(queryStringValueArray[i]); if (i != queryStringKeyArray.length - 1) { queryString = queryString.concat("&"); } } var leftPos = 0; var topPos = 0; if (screen) { leftPos = (screen.width / 2) - 251; topPos = (screen.height / 2) - 162; var windowFeatures = 'height=' + h + ',width=' + w + ',left=' + leftPos + ',top =' + topPos + ',scrollbars=yes,resizable=yes,status=yes,toolbar=no,menubar=no,location=no'; window.open(targetPage + "?" + queryString, null, windowFeatures); } }Works in following
0 comments:
Post a Comment