HOWTO: Set the size of a child window opened from datagrid
Posted: 12/8/2005 11:12:08 AM
By: Comfortably Anonymous
Times Read: 2,197
0 Dislikes: 0
Topic: Programming: Web Applications

In my last post I discussed how to link to a URL and pass the record identifier from a DataGrid Hyperlink column.

Moving along a bit further with this, you can have the URL opened in a child window by setting the Target field in the DataGrid Property Builder.

However, on doing this, there is a drawback in some cases: The child browser window opens to the same size as the parent browser window, fully occluding the parent window. In my case, I'd rather have the child window open smaller than the parent window to make switching between the two easier. However, I could not find a way to configure a target window size with the DataGrid Property Builder, so I had to research another approach to handling this issue:

The answer is pretty easy:

Open the child window in Visual Studio in Design mode and switch to HTML view and add onload="resizeTo(,)" to the BODY tag of the document.

For example:

If you want it under programmatic control, you can 'punch in' a session variable in place of the Width and Height values and just populate the session variables with the desired size before populating the datagrid:

onload="resizeTo(

,

)"

Rating: (You must be logged in to vote)