This is a migrated thread and some comments may be shown as answers.

Center RadGrid PopUp Window

3 Answers 237 Views
Grid
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 10 Aug 2011, 07:22 PM
Is there a way to center the RadGrid Edit Popup Window in the browser window? I have found a way to center it in the RadGrid, but I would prefer it to be in the center of the whole web page. 

Thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Aug 2011, 05:06 AM
Hello William,

Try using the following code snippet and CSS to center the RadGrid Edit Popup window in the browser window.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item.IsInEditMode)
    {
       GridEditFormItem editForm = (GridEditFormItem)e.Item;
       editForm.EditFormCell.CssClass = "class1";
    
}
CSS:
<style type="text/css">
 .class1 
 
  position:absolute;
  top:300px
  left:300px;     
 
</style>

Thanks,
Shinu.
0
William
Top achievements
Rank 1
answered on 11 Aug 2011, 02:04 PM
It centered the popup window horizontally, but vertically its at the bottom of the page. Since it's using an absolute position, won't the position be different depending on screen resolution?
0
Shinu
Top achievements
Rank 2
answered on 12 Aug 2011, 05:54 AM
Hello William,

Try the following code snippet to center the RadGrid PopUp Window for any screen resolution.
CSS:
<style type="text/css">
.class1
{
   position: absolute;
   top: 50%;
   left: 50%;
   width: 500px;
   height: 500px;
   margin-top: -250px;
   margin-left: -250px;
}
</style>
For further information you can check the following article
Absolute Center

Thanks,
Shinu.
Tags
Grid
Asked by
William
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
William
Top achievements
Rank 1
Share this question
or