Hi All,
I am using a radgird with static headers, modal popup edit mode and different userccontrols for insert and edit. Things are perfectly working in IE 8. But i am facing lot of strange issues when accessed in ie 6 and firefox 3.5 and above,
In IE 6,
Find below the script i have used to center the popup screen,
I am not sure which is causing this problem. Please help.
Regards,
Saravanan K
I am using a radgird with static headers, modal popup edit mode and different userccontrols for insert and edit. Things are perfectly working in IE 8. But i am facing lot of strange issues when accessed in ie 6 and firefox 3.5 and above,
In IE 6,
- The popup is not coming below the modal background and the page is unusable.
In Mozilla Firefox 3.5.2,
- The popup for edit mode works fine while using only the buttons with commandnames. (1 edit commandname button and 1 cancel commandname button). But when i close the popup using the close button in the top, and try to click the edit or Add buttons of the grid the popup is not appearing again.
- The popup for insert mode is even worser, it appears only for the first time, validations are working, but the insert commanname button and the cancel commandname buttons are not working.
I didnt tried in safari and other browsers. Please help me since it is an important requirement to make the application to be compatible with all these browsers.
Find below the code in item_command handler.
protected void grid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.EditCommandName) |
{ |
//Edit mode |
e.Item.OwnerTableView.EditFormSettings.UserControlName = "ModifyControl.ascx"; |
e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Height = System.Web.UI.WebControls.Unit.Pixel(400); |
e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Width = System.Web.UI.WebControls.Unit.Pixel(400); |
e.Item.OwnerTableView.EditFormSettings.PopUpSettings.ScrollBars = System.Web.UI.WebControls.ScrollBars.Vertical; |
e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Modal = true; |
} |
else if (e.CommandName == RadGrid.InitInsertCommandName) |
{ |
//Insert mode |
e.Item.OwnerTableView.EditFormSettings.UserControlName = "AddControl.ascx"; |
e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Height = System.Web.UI.WebControls.Unit.Pixel(400); |
e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Width = System.Web.UI.WebControls.Unit.Pixel(400); |
e.Item.OwnerTableView.EditFormSettings.PopUpSettings.ScrollBars = System.Web.UI.WebControls.ScrollBars.Vertical; |
e.Item.OwnerTableView.EditFormSettings.PopUpSettings.Modal = true; |
} |
} |
Find below the code of grid.
<telerik:RadGrid ID="grid1" runat="server" AllowFilteringByColumn="True" |
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" GridLines="None" |
OnNeedDataSource="grid1_NeedDataSource" Skin="Office2007" OnItemCommand="grid1_ItemCommand" |
OnInsertCommand="grid1_InsertCommand" EnableLinqExpressions="False" |
OnDeleteCommand="grid1_DeleteCommand" OnUpdateCommand="grid1_UpdateCommand" PagerStyle-AlwaysVisible="true"> |
<MasterTableView CommandItemDisplay="Top" EditMode="PopUp"> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</ExpandCollapseColumn> |
<Columns> |
<telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit" UniqueName="colEdit"> |
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="10%" /> |
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> |
</telerik:GridEditCommandColumn> |
<telerik:GridBoundColumn DataField="field1" HeaderText="Field1" UniqueName="col1"> |
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn HeaderText="Field2" UniqueName="col2" DataField="Field2"> |
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="Field3" HeaderText="Field3" UniqueName="col3" |
Visible="False"> |
</telerik:GridBoundColumn> |
<telerik:GridButtonColumn ButtonType="ImageButton" HeaderText="Remove" ImageUrl="~/Images/cancel.gif" |
UniqueName="colDelete" CommandName="Delete"> |
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="12%" /> |
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> |
</telerik:GridButtonColumn> |
</Columns> |
<EditFormSettings CaptionFormatString="Edit" InsertCaption="Add" |
EditFormType="WebUserControl"> |
<EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" ItemStyle-HorizontalAlign="Right"> |
<ItemStyle HorizontalAlign="Right" /> |
</EditColumn> |
</EditFormSettings> |
</MasterTableView> |
<ClientSettings> |
<ClientEvents OnPopUpShowing="PopUpCentered" /> |
<Scrolling AllowScroll="True" UseStaticHeaders="True" /> |
</ClientSettings> |
</telerik:RadGrid> |
Find below the script i have used to center the popup screen,
<script type="text/javascript"> |
function PopUpCentered(sender, eventArgs) { |
var popUp = eventArgs.get_popUp(); |
var popUppopUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px")); |
var popUppopUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px")); |
var windowHeight = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight); |
var windowWidth = (typeof window.innerWidth != 'undefined' ? window.innerWidth : document.body.offsetWidth); ; |
//alert(windowHeight + "##" + windowWidth); |
//if (popUppopUpHeight == "") popUppopUpHeight = 300; // if the height isn't set on the popup, default to 300px |
popUp.style.position = "fixed"; |
popUp.style.left = (Math.floor((windowWidth - popUppopUpWidth) / 2)).toString() + "px"; |
popUp.style.top = (Math.floor((windowHeight - popUppopUpHeight) / 2)).toString() + "px"; |
} |
</script> |
I am not sure which is causing this problem. Please help.
Regards,
Saravanan K