or
| <PagerStyle Mode="NextPrevNumericAndAdvanced" ShowPagerText="True" AlwaysVisible="true" /> |
In Mozilla Firefox 3.5.2,
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> |
| <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> |