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

RadGrid in RadWindow

0 Answers 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Salman
Top achievements
Rank 1
Salman asked on 13 Oct 2012, 08:24 PM
Hi all member
I have a RadGrid in RadWindow .when RadWindow Is Maximum size can not write to grid in insert or edit mode
please help to me for solve this problem

main.aspx form is :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Main.aspx.cs" Inherits="Samfa.Main" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server" lang="fa" >
    <title title="gggg"></title>
     <link href="Styles/main.css" rel="stylesheet" type="text/css" />
      <link href="Styles/global.css" rel="stylesheet" type="text/css" />
    <link href="Styles/global.css" rel="stylesheet" type="text/css" />
    <link href="Styles/TelerikCustom.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.8.2.js" type="text/javascript"></script>
     <script src="Scripts/global.js" type="text/javascript"></script>
    <script src="Scripts/main.js" type="text/javascript"></script>
    <link href="TabStrip.Mys.css" rel="stylesheet" type="text/css" />
 <style>
        
  
  </style>
  
</head>
<body onresize="setdvcontentHeight()">
  <div id="form1" style="height:100%">
     
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
        </telerik:RadScriptManager>
  
    <div id="dvRibion">
        <telerik:RadRibbonBar  ID="RadRibbonBar1"  runat="server"  Width="100%" EnableQuickAccessToolbar="False" OnClientButtonClicked="openNewWindow" 
                        
                        style="max-width: 100%;" Skin="Web20"  
                        RenderInactiveContextualTabGroups="False" OnClientApplicationMenuItemClicked="onAppMenuItemClicked"  
            SelectedTabIndex="0" 
                        
           
  
           
             
                
            <Tabs>
  
            <telerik:RibbonBarTab ID="RibbonBarTab3" runat="server" Text="تجهیزات" Value="mnuContractSystem" Container="" Visible="true" 
                        ParentWebControl="RadRibbonBar1" CssClass="customClassName">
  
      
      
  
<telerik:RibbonBarGroup ID="RibbonBarGroup8" runat="server" Text="Base info" Container="" 
        ParentWebControl="RadRibbonBar1"><Items>
             
  
               
  
            <telerik:RibbonBarButton runat="server" Value="Base.aspx?BaseType=4" 
            ImageUrlLarge="~/Images/Size.png" Size="Large" 
            ImageRenderingMode="Dual" Text="Unit" QuickAccess="Disabled" 
            Container="" ParentWebControl="" Group="" Font-Names="Tahoma" Font-Size="8pt" 
            ID="RibbonBarButton9"></telerik:RibbonBarButton>
  
  
            
  
</Items>
</telerik:RibbonBarGroup>
  
</telerik:RibbonBarTab>
  
  
  
</Tabs>
  
                  
  
  
  
  
  
  
  
        </telerik:RadRibbonBar>
         
       
         <telerik:RadWindowManager ShowOnTopWhenMaximized="false" DestroyOnClose="true" PreserveClientState="false" ReloadOnShow="true" Localization-Close="بستن" Localization-Maximize="بزرگ شدن" Localization-Minimize="کوچک شدن"   MinHeight="410px" MinWidth="650px"
            OnClientActivate="OnClientActivate" OnClientClose="OnClientClose" 
        Behaviors="Close,Maximize,Minimize,Move,Resize" OnClientCommand="OnClientCommand" RestrictionZoneID="dvcontent"  
        ID="RadWindowManager1"  runat="server" EnableShadow="false" 
            Skin="Office2010Blue">
             <Localization Close="close" Maximize="maximum" Minimize="minimum"  />
    </telerik:RadWindowManager>
  
    </div>
    <div id="dvcontent" ondblclick="autohideribion();" >
        </div>
          
    <div id="taskbarm"  >
        <telerik:RadTabStrip OnClientTabSelected="OnClientTabSelected" EnableEmbeddedSkins="False" 
            ID="RadTabStrip1" Font-Names="Tahoma"
            ScrollChildren="True" ScrollButtonsPosition="Middle" Width="730px" Skin="Mys"
            Orientation="HorizontalBottom" runat="server"  
            SelectedIndex="0" Font-Bold="True" Font-Size="9pt" ForeColor="White">
            <Tabs>
                <telerik:RadTab Style="display: none;" Selected="True" />
            </Tabs>
        </telerik:RadTabStrip>
  
      
    </div>
     
</div>
   
    <script>
        $(document).ready(setdvcontentHeight());
    </script>
        
      <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            // <![CDATA[
  
            var manager = null;
            var tabStrip = null;
  
            function pageLoad() {
                //get a reference to the needed controls - 
                manager = $find("<%=RadWindowManager1.ClientID %>");
                tabStrip = $find("<%=RadTabStrip1.ClientID %>");
                
  
                  
            }
  
            //opening the window
            function openNewWindow(sender, args) {
                             // var item = args.get_item();
                var itemUrl = args.get_button()._value;//  item.get_value();
                 
                var ribbonbar = $find("RadRibbonBar1");
                var button0 = ribbonbar.findButtonByValue(itemUrl);
                var itemText = itemText = button0.get_text();
  
                 
                var imgurl= args.get_button()._imageUrlLarge;
                if (itemUrl) {
  
                    var newtab = $telerik.toTabStrip(tabStrip).findTabByValue(itemUrl);
                    if (newtab != null) {
                        return;
                    }
                    var windowURL = itemUrl;
                    var oWnd = radopen(itemUrl, null);
                    oWnd.set_title(itemText);
  
                    $telerik.toWindow(oWnd).set_autoSize(true);
                    $telerik.toWindow(oWnd).set_visibleStatusbar(false);
                    $telerik.toWindow(oWnd).set_iconUrl(imgurl);
                    oWnd.center();
                    tabStrip.trackChanges();
                    //create a new tab
                    var tab = new Telerik.Web.UI.RadTab();
                    //set the text of the tab
                    tab.set_text(itemText);
                    tab.set_value(itemUrl);
   
                    oWnd.correspondingTab = tab;
      
                    //add the tab to the tabstrip
                    tabStrip.get_tabs().add(tab);
                    tabStrip.repaint();
                    tab.correspondingWnd = oWnd;
//                    tab.set_imageUrl(item.get_imageUrl());
                    tabStrip.commitChanges();
  
                    //Select this tab
                    tab.select();
                }
            }
  
            function OnClientCommand(sender, args) {
                //because we don't want to show the minimized RadWindow, we hide it after minimizing
                //and raise the _Maximized flag (used in OnClientTabSelected)
                if (args.get_commandName() == "Minimize") {
                    if (sender.isMaximized()) {
                        sender._Maximized = true;
                    }
  
                    sender.hide();
                    //raise the _toMinimize flag (used in OnClientActivate)
                    sender._toMinimize = true;
                    var tab = sender.correspondingTab;
                    if (tab) {
                        tab.set_selected(false);
                    }
                }
            }
  
            function OnClientTabSelected(sender, args) {
                //get a reference to the corresponding window
                var win = args.get_tab().correspondingWnd;
  
                if (!win) return;
  
                if (!win.isVisible()) {
                    win.show();
                    win.restore();
                    //if the window was maximized before client minimizes it, we need to restore
                    //its maximized state
                    if (win._Maximized) {
                        win.maximize();
                        win._Maximized = null;
                    }
  
                }
  
                //ensure that the currently active RadWindow will have the highest z-Index.
                var popupElem = win.get_popupElement();
                var oldZindex = parseInt(popupElem.style.zIndex);
                var styleZIndex = win.get_stylezindex();
                var newZIndex = (styleZIndex) ? styleZIndex : Telerik.Web.UI.RadWindowUtils.get_newZindex(oldZindex);
                popupElem.style.zIndex = "" + newZIndex;
                win.setActive(true);
  
  
  
            }
  
            function OnClientActivate(sender, args) {
                var tab = sender.correspondingTab;
                if (tab && !sender._toMinimize) {
                    tab.set_selected(true);
                }
                sender._toMinimize = false;
            }
            function OnClientClose(oWnd) {
  
                //remove the corresponding tab from the tabstrip
                var tab = oWnd.correspondingTab;
                if (tab) {
                    tabStrip.trackChanges();
                    tabStrip.get_tabs().remove(tab);
                    tabStrip.commitChanges();
                }
  
            }
  
             
            // ]]>
  
            function onAppMenuItemClicked(sender, args) {
                switch (args.get_item()._text.toString().toLowerCase()) {
                    case "عدم نمایش":
                        showtaskbarm();
                        hideRibion();
                        setdvcontentHeight();
  
                        break;
                    case "ورود مجدد":
                        window.location = "login.aspx";
                        break;
                    case "تغییر کلمه عبور":
                        alert(' به شما مجوز تغییر کلمه عبور داده نشده است');
                        break;
  
                }
  
            }
  
            $("#taskbarm").click(function () {
                $telerik.toWindowManager(manager).cascade();
            });
             
        </script>
    </telerik:RadCodeBlock>
</body>
</html>


and Base.aspx is :
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Base.aspx.cs" Inherits="Samfa.Base" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
  
    <table align="center" cellpadding="0" cellspacing="0" dir="rtl" 
           style="width: 100%">
             
        <tr>
            <td>
                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                    <AjaxSettings>
                          
                        <telerik:AjaxSetting AjaxControlID="dgdBase">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="dgdBase" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                    <ClientEvents OnRequestStart="RequestStart" />
                </telerik:RadAjaxManager>
                </td>
        </tr>
        <tr>
            <td align="center">
              
                <telerik:RadGrid ID="dgdBase" runat="server"  
                                 AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
                                 AutoGenerateHierarchy="True" CellSpacing="0" GridLines="None" 
                                 MasterTableView-Dir="RTL" 
                                 ShowStatusBar="True" Skin="Outlook" Width="100%" 
                                 onneeddatasource="dgdBase_NeedDataSource" 
                    oninsertcommand="dgdBase_InsertCommand" 
                    ondeletecommand="dgdBase_DeleteCommand" 
                    onupdatecommand="dgdBase_UpdateCommand" >
                   
                    <ExportSettings FileName="SamfaGridExport">
                    </ExportSettings>
                    <ClientSettings EnableRowHoverStyle="true">
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="True"  />
                     
                    </ClientSettings>
                     
                    <MasterTableView CommandItemDisplay="Top" Dir="RTL" EditMode="EditForms" 
                                     Font-Names="Tahoma" HierarchyLoadMode="Client" 
                                    >
                        <PagerStyle AlwaysVisible="True" Font-Names="Tahoma" Font-Size="9pt" 
                                    Mode="NumericPages"  PageButtonCount="15" 
                                   PageSizeLabelText="9pt" 
                                    />
                        <CommandItemTemplate>
                            <table>
                                <tr>
  
                                    <td align="center" valign="top">
                                        <telerik:RadButton ID="btnSave" runat="server" CommandName="UpdateEdited" 
                                                           Font-Names="tahoma" Font-Size="8.5pt" Text="ذخیره" Skin="Hay" 
                                                           Visible="<%# dgdBase.EditIndexes.Count > 0 %>" Width="80px">
                                            <Icon SecondaryIconBottom="3" SecondaryIconHeight="25px" SecondaryIconLeft="0" 
                                                  SecondaryIconRight="0" SecondaryIconTop="5" 
                                                  SecondaryIconUrl="Images/Ok.png"
                                                  SecondaryIconWidth="25px" />
                                        </telerik:RadButton>
                                    </td>
                                    <td align="center" valign="top">
                                        <telerik:RadButton ID="btnNew" runat="server" CommandName="InitInsert" 
                                                           Font-Names="tahoma" Font-Size="8.5pt" Text="New" skin="Hay"
                                                           Visible="<%# !(dgdBase.EditIndexes.Count > 0 || dgdBase.MasterTableView.IsItemInserted) %>" Width="80px">
                                            <Icon SecondaryIconBottom="3" SecondaryIconHeight="25px" SecondaryIconLeft="0" 
                                                  SecondaryIconRight="0" SecondaryIconTop="5" 
                                                  SecondaryIconUrl="Images/add.png"
                                                  SecondaryIconWidth="25px" />
                                        </telerik:RadButton>
                                    </td>
                                    <td align="center" valign="top">
  
                                        <telerik:RadButton ID="btnEdit" runat="server" CommandName="EditSelected" 
                                                           Font-Names="tahoma" Font-Size="8.5pt"  Text="Edit"  Skin="Hay"
                                                           Visible="<%# !(dgdBase.EditIndexes.Count > 0 || dgdBase.MasterTableView.IsItemInserted) %>"  Width="80px">
                                            <Icon SecondaryIconBottom="3" SecondaryIconHeight="25px" SecondaryIconLeft="0" 
                                                  SecondaryIconRight="0" SecondaryIconTop="5" 
                                                  SecondaryIconUrl="Images/edit.png"
                                                  SecondaryIconWidth="25px" />
                                        </telerik:RadButton>
                                    </td>
                                    <td align="center" valign="top">
                                        <telerik:RadButton ID="btnSaveNewItem" runat="server" 
                                                           CommandName="PerformInsert" Font-Names="tahoma" Font-Size="8.5pt" Skin="Hay" 
                                                           Text="Save" 
                                                           Visible="<%# dgdBase.MasterTableView.IsItemInserted %>" Width="100px">
                                            <Icon SecondaryIconBottom="3" SecondaryIconHeight="25px" SecondaryIconLeft="0" 
                                                  SecondaryIconRight="0" SecondaryIconTop="5" 
                                                  SecondaryIconUrl="Images/Ok.png"
                                                  SecondaryIconWidth="25px" />
                                        </telerik:RadButton>
                                    </td>
                                    <td align="center" valign="top">
                                        <telerik:RadButton ID="btnCancel" runat="server" CausesValidation="false" 
                                                           CommandName="CancelAll" Font-Names="tahoma" Font-Size="8.5pt" skiin="Hay"
                                                           Text="Cancel" 
                                                           Visible="<%# dgdBase.EditIndexes.Count > 0 || dgdBase.MasterTableView.IsItemInserted %>" 
                                                           Width="80px">
  
                                            <Icon SecondaryIconBottom="3" SecondaryIconHeight="25px" SecondaryIconLeft="0" 
                                                  SecondaryIconRight="0" SecondaryIconTop="5" 
                                                  SecondaryIconUrl="Images/cancel.png"
                                                  SecondaryIconWidth="25px" />
                                        </telerik:RadButton>
                                    </td>
                                    <td align="center" valign="top">
                                        <telerik:RadButton ID="btnDelete" runat="server" CommandName="DeleteSelected" 
                                                           Font-Names="tahoma" Font-Size="8.5pt"  Text="Delete" Skin="Hay"   Visible="<%# !(dgdBase.EditIndexes.Count > 0 || dgdBase.MasterTableView.IsItemInserted) %>"  
                                                           Width="80px">
  
                                            <Icon SecondaryIconBottom="3" SecondaryIconHeight="25px" SecondaryIconLeft="0" 
                                                  SecondaryIconRight="0" SecondaryIconTop="5" 
                                                  SecondaryIconUrl="Images/delete.png"
                                                  SecondaryIconWidth="25px" />
                                        </telerik:RadButton>
                                    </td>
  
                                    <%--  <td align="center"  valign="top">
                                    <telerik:RadButton ID="btnExportEx" runat="server" CausesValidation="false" Skin="Hay" 
                                    Font-Names="tahoma" Font-Size="8.5pt" 
                                    Text="تبدیل به Excel" Width="110px">
                                    <Icon SecondaryIconBottom="3" SecondaryIconHeight="25px" SecondaryIconLeft="0" 
                                    SecondaryIconRight="0" SecondaryIconTop="5" 
                                    SecondaryIconUrl="Images/excel.png"
                                    SecondaryIconWidth="25px" />
                                    </telerik:RadButton>
                                         
                                    </td>--%>
                                    <td align="left" style="width: 100%;" valign="top">
                                        <table>
                                            <tr>
                                                <td style="font-family:Tahoma">
                                                    <span style="font:Tahoma">Search : </span>
                                                </td>
                                                <td>
                                                    <telerik:RadTextBox ID="txtSearch" ClientIDMode="Static"    Font-Names="tahoma" runat="server">
                                                    </telerik:RadTextBox>
                                                </td>
                                                <td>
                                                      
                                                    <asp:ImageButton ID="img" ImageUrl="Images/Search.png" Height="16px" OnClick="btnSearch_Click" runat="server" />
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                
                            </table>
                        </CommandItemTemplate>
                        <CommandItemSettings ExportToPdfText="Export to PDF"  
                                             ShowExportToExcelButton="True" ShowExportToPdfButton="True" />
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" 
                                            Visible="True">
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" 
                                              Visible="True">
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridTemplateColumn DataField="strName" 
                                                        FilterControlAltText="Filter strName column" 
                                                        GroupByExpression="strName Group By strName" HeaderText="Subject" 
                                                        SortExpression="strName" UniqueName="strName">
                                <EditItemTemplate>
                                    <telerik:RadTextBox ID="strNameTextBox" runat="server" Font-Names="Tahoma" 
                                                        Skin="Office2010Blue" Text='<%# Bind("strName") %>'>
                                    </telerik:RadTextBox>
                                      
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="strNameLabel" runat="server" Text='<%# Eval("strName") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="iNumber" 
                                                     FilterControlAltText="Filter iNumber column" ForceExtractValue="Always" 
                                                     ReadOnly="True" UniqueName="iNumber" Visible="False">
                            </telerik:GridBoundColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn ButtonType="PushButton" CancelText="Cancel" InsertText="Save" 
                                        UniqueName="EditCommandColumn1" UpdateText="Save" Visible="false">
                            </EditColumn>
                            <FormMainTableStyle Font-Names="tahoma" Font-Size="9pt" />
                            <FormTableStyle Font-Names="tahoma" Font-Size="9pt" />
                            <FormTableStyle Font-Names="tahoma" Font-Size="9pt" />
                            <FormMainTableStyle Font-Names="tahoma" Font-Size="9pt" />
                        </EditFormSettings>
                        <EditItemStyle Font-Names="Tahoma" />
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                    <FilterMenu OnClientShowing="MenuShowing">
                        <WebServiceSettings>
                            <ODataSettings InitialContainerName="">
                            </ODataSettings>
                        </WebServiceSettings>
                    </FilterMenu>
                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                        <WebServiceSettings>
                            <ODataSettings InitialContainerName="">
                            </ODataSettings>
                        </WebServiceSettings>
                    </HeaderContextMenu>
                </telerik:RadGrid>
             
                 
            </td>
        </tr>
    </table>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      <script>
          function GetRadWindow() {
              var oWindow = null;
              if (window.radWindow) oWindow = window.radWindow;
              else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
              return oWindow;
          }
          function setsize(sender, eventArgs) {
              
              GetRadWindow().set_autoSize(true);
          }
//            function ApplyGreaterThanFilter() {
//                var masterTable = $find("<%= dgdBase.ClientID %>").get_masterTableView();
//                var val = document.getElementById('txtSearch');
//                masterTable.filter("strName", val.value, Telerik.Web.UI.GridFilterFunction.Contains);
//                document.getElementById('txtSearch').value = val;
//                $('#img').click(ApplyGreaterThanFilter);
//            }
  
//            $('#img').click(ApplyGreaterThanFilter);
             
             
        </script>
          
<style type="text/css">  
    HTML  
    {  
        overflow-x: hidden;  
    }  
</style>
  
    </telerik:RadCodeBlock>
  
</asp:Content>


 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Salman
Top achievements
Rank 1
Share this question
or