Filter Visible False on Page Load

2 posts, 0 answers
  1. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 25 Apr 2011 Link to this post

    Hello ,
    Filter Visible False on Page Load.



    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Location.aspx.cs" Inherits="TBS_HelpDesk.Views.Assets.Location"
        MasterPageFile="~/Views/Shared/MasterPage.Master" %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
        <telerik:RadCodeBlock runat="server" ID="radCodeBlock">
            <script type="text/javascript">
                function onToolBarClientButtonClicking(sender, args) {
                    var grid = $find("<%=RadGrid1.ClientID %>");
                    debugger;
                    var comandName = args.get_item().get_commandName();
                    if (comandName == "Filter") {
                        if (grid.get_masterTableView().get_isFilterItemVisible()) {
                            grid.get_masterTableView().hideFilterItem();
                        }
                        else {
                            grid.get_masterTableView().showFilterItem();
                        }
                    }
                }
                function getOuterHTML(obj) {
                    if (typeof (obj.outerHTML) == "undefined") {
                        var divWrapper = document.createElement("div");
                        var copyOb = obj.cloneNode(true);
                        divWrapper.appendChild(copyOb);
                        return divWrapper.innerHTML
                    }
                    else
                        return obj.outerHTML;
                }
                function PrintRadGrid() {
                    var previewWnd = window.open('about:blank', '', '', false);
                    var sh = '<%= ClientScript.GetWebResourceUrl(RadGrid1.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",RadGrid1.Skin)) %>';
                    var shBase = '<%= ClientScript.GetWebResourceUrl(RadGrid1.GetType(),"Telerik.Web.UI.Skins.Grid.css") %>';
                    var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link>";
                    styleStr += "<link href = '" + shBase + "' rel='stylesheet' type='text/css'></link></head>";
                    var htmlcontent = styleStr + "<body>" + getOuterHTML($find('<%= RadGrid1.ClientID %>').get_element()) + "</body></html>";
                    previewWnd.document.open();
                    previewWnd.document.write(htmlcontent);
                    previewWnd.document.close();
                    previewWnd.print();
                    previewWnd.close(); // working

                }
            </script>
        </telerik:RadCodeBlock>
        <div style="width: 760px; height: 600px;">
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadGrid ID="RadGrid1" runat="server" Skin="Office2007" AllowAutomaticInserts="True"
                AllowAutomaticUpdates="True" GridLines="None" AutoCompleteType="Disabled" AllowFilteringByColumn="True"
                AllowPaging="True" AllowSorting="True" OnRowDataBound="RadGrid1_RowDataBound1"
                OnItemCommand="RadGrid1_ItemCommand">
                <ExportSettings>
                    <Pdf PageHeight="297mm" PageWidth="210mm" />
                </ExportSettings>
                <MasterTableView ShowHeadersWhenNoRecords="true" AutoGenerateColumns="False" CommandItemDisplay="Top"
                    EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true">
                    <CommandItemTemplate>
                        <telerik:RadToolBar ID="RadToolBar1" runat="server" OnClientButtonClicking="onToolBarClientButtonClicking">
                            <Items>
                                <telerik:RadToolBarButton Text="Cancel editing" CommandName="CancelAll" ImageUrl="images/Cancel.gif"
                                    Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'>
                                </telerik:RadToolBarButton>
                                <telerik:RadToolBarButton Text="Add new" CommandName="InitInsert" ImageUrl="../../images/AddRecord.gif"
                                    Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'>
                                </telerik:RadToolBarButton>
                                <telerik:RadToolBarButton Text="Filter" CommandName="Filter" ImageUrl="../../images/Filter 3.gif">
                                </telerik:RadToolBarButton>
                                <telerik:RadToolBarButton Text="Print" CommandName="Print" onclick="PrintRadGrid()">
                                </telerik:RadToolBarButton>
                                <telerik:RadToolBarButton Text="Refresh" CommandName="RebindGrid" ImageUrl="../../images/Refresh.gif">
                                </telerik:RadToolBarButton>
                            </Items>
                        </telerik:RadToolBar>
                    </CommandItemTemplate>
                    <PagerStyle BackColor="#D8EBFC" Mode="NextPrevNumericAndAdvanced" />
                    <HeaderStyle CssClass="dataheadcolor" />
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderStyle-Width="10px">
                            <HeaderStyle Width="10px"></HeaderStyle>
                        </telerik:GridEditCommandColumn>
                        <telerik:GridNumericColumn DataField="AddressID" HeaderText="Address ID" SortExpression="AddressID"
                            UniqueName="AddressID" FilterControlWidth="20px" HeaderStyle-Width="120px" ReadOnly="true">
                        </telerik:GridNumericColumn>
                        <telerik:GridBoundColumn DataField="Address_Location_Name" HeaderText="Address Name"
                            SortExpression="Address_Location_Name" UniqueName="Address_Location_Name" FilterControlWidth="40px"
                            HeaderStyle-Width="130px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address_Line1" HeaderText="Line1" SortExpression="Address_Line1"
                            UniqueName="Address_Line1" FilterControlWidth="40px" HeaderStyle-Width="80px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address_Line2" HeaderText="Line2" SortExpression="Address_Line2"
                            UniqueName="Address_Line2" FilterControlWidth="40px" HeaderStyle-Width="80px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address_City" HeaderText="City " SortExpression="Address_City"
                            UniqueName="Address_City" FilterControlWidth="40px" HeaderStyle-Width="90px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address_State" HeaderText="State" SortExpression="Address_State"
                            UniqueName="Address_State" FilterControlWidth="40px" HeaderStyle-Width="90px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address_Country" HeaderText="Country" SortExpression="Address_Country"
                            UniqueName="Address_Country" FilterControlWidth="40px" HeaderStyle-Width="90px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address_Postal_Code" HeaderText="Postal Code"
                            SortExpression="Address_Postal_Code" UniqueName="Address_Postal_Code" FilterControlWidth="40px"
                            HeaderStyle-Width="90px">
                        </telerik:GridBoundColumn>
                        <telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" HeaderStyle-Width="10px">
                            <HeaderStyle Width="10px"></HeaderStyle>
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings ColumnNumber="3" CaptionFormatString="Create">
                        <EditColumn UniqueName="EditCommandColumn1">
                        </EditColumn>
                        <FormTemplate>
                            <table cellspacing="2" cellpadding="1" width="100%" border="0">
                                <tr>
                                    <td>
                                        <asp:Label runat="server" Text="AddressID" ID="label1"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox Width="200px" ID="AddressID" AutoCompleteType="Disabled" runat="server"
                                            Text='<%# Bind("AddressID") %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Location Name
                                    </td>
                                    <td>
                                        <asp:TextBox Width="200px" ID="Address_Location_Name" AutoCompleteType="Disabled"
                                            runat="server" Text='<%# Bind("Address_Location_Name") %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Line1
                                    </td>
                                    <td>
                                        <asp:TextBox Width="200px" ID="Address_Line1" AutoCompleteType="Disabled" runat="server"
                                            Text='<%# Bind("Address_Line1") %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Line2
                                    </td>
                                    <td>
                                        <asp:TextBox Width="200px" ID="Address_Line2" AutoCompleteType="Disabled" runat="server"
                                            Text='<%# Bind("Address_Line2") %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        City
                                    </td>
                                    <td>
                                        <asp:TextBox Width="200px" ID="Address_City" AutoCompleteType="Disabled" runat="server"
                                            Text='<%# Bind("Address_City") %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        State
                                    </td>
                                    <td>
                                        <asp:TextBox Width="200px" ID="Address_State" AutoCompleteType="Disabled" runat="server"
                                            Text='<%# Bind("Address_State") %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Country
                                    </td>
                                    <td>
                                        <asp:TextBox Width="200px" ID="Address_Country" AutoCompleteType="Disabled" runat="server"
                                            Text='<%# Bind("Address_Country") %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Postal Code
                                    </td>
                                    <td>
                                        <asp:TextBox Width="200px" ID="Address_Postal_Code" AutoCompleteType="Disabled" runat="server"
                                            Text='<%# Bind("Address_Postal_Code") %>'></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Button ID="Button1" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                            CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                        </asp:Button>
                                        <asp:Button ID="Button2" runat="server" Text="Cancel" CausesValidation="false" CommandName="Cancel">
                                        </asp:Button>
                                    </td>
                                </tr>
                            </table>
                        </FormTemplate>
                        <PopUpSettings Modal="True"></PopUpSettings>
                    </EditFormSettings>
                </MasterTableView>
                <ClientSettings>
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />
                </ClientSettings>
            </telerik:RadGrid>
        </div>
    </asp:Content>


  2. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 25 Apr 2011 Link to this post

    Problem Resolved
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top