FilterCheckListEnableLoadOnDemand code behind

12 posts, 0 answers
  1. Dennis
    Dennis avatar
    13 posts
    Member since:
    Jul 2015

    Posted 03 Mar Link to this post

    HI 
    i have a grid which generates automatic columns. the reson is that my source (stored procedure ) returns me the name of an Fund and N additional date columns

    i like the set the FilterCheckListEnableLoadOnDemand  = true on column Fund_Code that the user will be able to select multiple Fund_Codes for his filter.

    Actual im doing it in grdMultiNAV_ColumnCreated event, but it doesn't work. 
    ************************
                    GridBoundColumn column = e.Column as GridBoundColumn;
                    column.FilterCheckListEnableLoadOnDemand = true;
                    column.AutoPostBackOnFilter = true;
    ************************
    and i do have set OnFilterCheckListItemsRequested="grdMultiNAV_FilterCheckListItemsRequested" on the grid with proper code behind 

    do i set FilterCheckListEnableLoadOnDemand = true; in the wrong event ? 

    thanks for your help 

    cheers
    Dennis
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 Mar Link to this post

    Hello Dennis,

    Can you please share your page markup as well as the related code behind so that we can further revise your scenario and provide the best solution for your case?

    Regards,
    Maria Ilieva
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dennis
    Dennis avatar
    13 posts
    Member since:
    Jul 2015

    Posted 09 Mar in reply to Maria Ilieva Link to this post

    Hi Maria

    this is the code :
    **********************************************
    <%@ Page Language="C#" AutoEventWireup="true" Inherits="BTDashboard.MultiNAVFundDashboard" Codebehind="MultiNAVFundDashboard.aspx.cs" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <style type="text/css">
    .auto-style1 {
    width: 4px;
    }
    div.RadGrid .rgHeader {
    white-space:nowrap;
    }
    </style>
    <form id="frmMultiNAV" runat="server">
    <telerik:RadAjaxManager ID="rAjaxMgr" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
    function pageLoad()
    {
    var grid = $find("<%= grdMultiNAV.ClientID %>");
    var columns = grid.get_masterTableView().get_columns();
    for (var i = 0; i < columns.length; i++)
    {
    columns[i].resizeToFit(false, true);
    }
    }
    function ShowEditForm(Fund_Code, NAVDate, rowIndex)
    {
    window.radopen("DQCDetail.aspx?Fund_Code=" + Fund_Code + "&NAVDate=" + NAVDate, "DQCDetails");
    return false;
    }
    </script>
    </telerik:RadCodeBlock>
    <table style="width: 300px;">
    <tr>
    <td>
    <nobr><asp:Label ID="lblConfigGroup" runat="server" Text="Select a Groupview: " Font-Bold="True" Font-Size="Large"></asp:Label></nobr>
    </td>
    <td>
    <telerik:RadComboBox ID="cbBoxConfigGroup" Runat="server" DataSourceID="sqlSrcMNV_Config" AutoPostBack="True" DataTextField="grp_Name" DataValueField="grp_ID"></telerik:RadComboBox>
    </td>
    <td>
    <nobr><asp:Label ID="lblDayShift" runat="server" Text="Select the shift: " Font-Bold="True" Font-Size="Large"></asp:Label></nobr>
    </td>
    <td>
    <telerik:RadDropDownList ID="cbDayShift" runat="server" SelectedText="5" SelectedValue="5" AutoPostBack="true" >
    <Items>
    <telerik:DropDownListItem runat="server" Selected="True" Text="5 days" Value="5" />
    <telerik:DropDownListItem runat="server" Text="10 days" Value="10" />
    <telerik:DropDownListItem runat="server" Text="15 days" Value="15" />
    <telerik:DropDownListItem runat="server" Text="20 days" Value="20" />
    </Items>
    </telerik:RadDropDownList>
    </td>
    </tr>
    </table>
    <asp:SqlDataSource ID="sqlSrcMNV_Config" runat="server" ConnectionString="<%$ ConnectionStrings:connBTDashboard %>" SelectCommand="SELECT * FROM [tbl_Conf_Group]"></asp:SqlDataSource>
    <div>
    <telerik:RadGrid ID="grdMultiNAV" runat="server" DataSourceID="sqlSrcDashboard" GroupPanelPosition="Top" OnItemDataBound="grdMultiNAV_ItemDataBound" CellSpacing="4" CellPadding="4" GridLines="Both" OnDetailTableDataBind="grdMultiNAV_DetailTableDataBind" Skin="Windows7" OnItemCreated="grdMultiNAV_ItemCreated" AllowSorting="true" AllowFilteringByColumn="true" OnColumnCreated="grdMultiNAV_ColumnCreated" OnInit="grdMultiNAV_Init" OnFilterCheckListItemsRequested="grdMultiNAV_FilterCheckListItemsRequested">
    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
    <MasterTableView DataSourceID="sqlSrcDashboard" DataKeyNames="Fund_Code">
    <DetailTables>
    <telerik:GridTableView runat="server" Name="grdDetail" Width="500" AllowFilteringByColumn="False" AllowSorting="False" AutoGenerateColumns="false">
    <Columns>
    <telerik:GridBoundColumn DataField="NAV_Date" HeaderText="NAV Date" DataType="System.DateTime" DataFormatString="{0:dd/MM/yyyy}"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="Fund_Name" DataType="System.String" HeaderText="Fund Name" ItemStyle-Width="300px"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="Fund_Code" DataType="System.String" HeaderText="Fund Code" ItemStyle-Width="100px"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="expected_NAV" HeaderText="NAV Expected" ItemStyle-Width="100px"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="imported_Fund" HeaderText="SCD Load" ItemStyle-Width="100px"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="Compliance" HeaderText="Compliance" ItemStyle-Width="100px"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="Risk_MSCI" HeaderText="Risk MSCI" ItemStyle-Width="100px"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="DVS_Check" HeaderText="DVS" ItemStyle-Width="100px"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="DQC_check" HeaderText="Data Quality Check" ItemStyle-Width="100px"></telerik:GridBoundColumn>
    <telerik:GridButtonColumn Text="DQC Details" CommandName="DQCDetail" ButtonType="FontIconButton" ConfirmDialogType="RadWindow" ItemStyle-Width="100px"></telerik:GridButtonColumn>
    <telerik:GridTemplateColumn UniqueName="DQCDetails" AllowFiltering="False" AllowSorting="False">
    <ItemTemplate>
    <asp:HyperLink ID="DQCDetailLink" runat="server">
    <asp:Image ID="Lupe_small" runat="server" ImageUrl="~/images/Lupe_small.png" /></asp:HyperLink>
    </ItemTemplate>
    </telerik:GridTemplateColumn>
    </Columns>
    </telerik:GridTableView>
    </DetailTables>
    </MasterTableView>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="sqlSrcDetail" runat="server" ConnectionString="<%$ ConnectionStrings:connBTDashboard %>" SelectCommand="sp_GetFundMultiNAV_Detail" SelectCommandType="StoredProcedure">
    <SelectParameters>
    <asp:ControlParameter ControlID="cbBoxConfigGroup" Name="Group" PropertyName="SelectedValue" Type="Int32" />
    <asp:Parameter Name="Fund_Code" Type="String" />
    </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sqlSrcDashboard" runat="server" ConnectionString="<%$ ConnectionStrings:connBTDashboard %>" SelectCommand="sp_GetFundMultiNAV" SelectCommandType="StoredProcedure">
    <SelectParameters>
    <asp:ControlParameter ControlID="cbDayShift" DefaultValue="5" Name="DayShift" PropertyName="SelectedValue" Type="Int32" />
    <asp:ControlParameter ControlID="cbBoxConfigGroup" DefaultValue="1" Name="Group" PropertyName="SelectedValue" Type="Int64" />
    </SelectParameters>
    </asp:SqlDataSource>
    <telerik:RadScriptManager ID="rScriptMgr" Runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxPanel ID="AjaxPanel" runat="server">
    <telerik:RadWindowManager ID="radWindowMgr" runat="server" EnableShadow="true">
    <Windows>
    <telerik:RadWindow ID="DQCDetails" runat="server" Title="DQC details" Height="900px" Width="800px" Left="150px"></telerik:RadWindow>
    </Windows>
    </telerik:RadWindowManager>
    </telerik:RadAjaxPanel>
    </div>
    </form>
    </body>
    </html>
    ***************************************************
    protected void grdMultiNAV_ItemCommand(object sender, GridCommandEventArgs e)
    {
    }
    protected void grdMultiNAV_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
    if (e.Column is GridBoundColumn && e.Column.UniqueName != "Fund_Name" && e.Column.UniqueName != "Fund_Code")
    {
    GridBoundColumn column = e.Column as GridBoundColumn;
    column.AllowFiltering = false;
    }
    else if (e.Column is GridBoundColumn && e.Column.UniqueName == "Fund_Name" || e.Column.UniqueName == "Fund_Code")
    {
    GridBoundColumn column = e.Column as GridBoundColumn;
    column.FilterCheckListEnableLoadOnDemand = true;
    column.AutoPostBackOnFilter = true;
    }
    }
    protected void grdMultiNAV_Init(object sender, EventArgs e)
    {
    GridFilterMenu menu = grdMultiNAV.FilterMenu;
    int i = 0;
    while (i < menu.Items.Count)
    {
    if (menu.Items[i].Text == "NoFilter" || menu.Items[i].Text == "Contains" || menu.Items[i].Text == "EqualTo")
    {
    i++;
    }
    else
    {
    menu.Items.RemoveAt(i);
    }
    }
    }
    protected void grdMultiNAV_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
    {
    Dashboard DSB = new Dashboard();
    DSB.getFilterList(sender, e);
    }
    protected void grdMultiNAV_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
    Dashboard DSB = new Dashboard();
    DSB.ColorCell(sender, e);


    if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "grdDetail")
    {
    GridTableView detailTable = (GridTableView)e.Item.OwnerTableView;
    //generate comment link
    GridDataItem grdItem = (GridDataItem)e.Item;
    HyperLink editLink = (HyperLink)e.Item.FindControl("DQCDetailLink");
    editLink.Attributes["href"] = "javascript:void(0);";
    editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}',{2});", grdItem["Fund_Code"].Text, grdItem["NAV_Date"].Text, e.Item.ItemIndex);

    }
    }
    protected void grdMultiNAV_ItemCreated(object sender, GridItemEventArgs e)
    {
    if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "grdDetail")
    {

    }
    }
    protected void grdMultiNAV_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
    {

    GridDataItem dataitem = (GridDataItem)e.DetailTableView.ParentItem;
    string FundCode = dataitem.GetDataKeyValue("Fund_Code").ToString();
    string ConfigGrp = cbBoxConfigGroup.SelectedValue;
    String ConnString = ConfigurationManager.ConnectionStrings["connBTDashboard"].ConnectionString;
    SqlCommand SQLCmd = new SqlCommand();
    SqlConnection conn = new SqlConnection(ConnString);
    SqlDataAdapter adapter = new SqlDataAdapter();
    DataTable DT = new DataTable();
    SQLCmd = new SqlCommand("exec sp_GetFundMultiNAV_Detail " + ConfigGrp.ToString() + ",'" + FundCode + "'", conn);
    //SQLCmd.Parameters.Add(new SqlParameter("@Group",ConfigGrp));
    //SQLCmd.Parameters.Add(new SqlParameter("@Fund_Code",FundCode));
    //SQLCmd.CommandType = CommandType.StoredProcedure;
    adapter.SelectCommand = SQLCmd;
    adapter.Fill(DT);
    e.DetailTableView.DataSource = DT;

    //grdMultiNAV.
    }

    ***************************
    that should be all .... just let me know if you need something else

    thanks a lot

    best regards
    Dennis
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 11 Mar Link to this post

    Hi Dennis,

    I revise the provided code and you are correctly setting the "FilterCheckListEnableLoadOnDemand " property in the ColumnCreated event but note that you should also set a  FilterType="Combined" for the main RadGrid control when FilterCheckListItemsRequested event is used for populating the ListBox.

    Try setting the FilterType and see how it goes.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  6. Dennis
    Dennis avatar
    13 posts
    Member since:
    Jul 2015

    Posted 16 Mar in reply to Maria Ilieva Link to this post

    Hi Maria

     

    thanks for the reply. I added the FilterType = "combined" but with no success. the animation of the button has changed(see attachment)  but there is no filter menu. the strange thins is that the event OnFilterCheckListItemsRequested="grdMultiNAV_FilterCheckListItemsRequested" is not fired. have you an idea why this event is not called ?

    thanks a lot

    cheers

    Dennis

     

     

  7. Richard
    Richard avatar
    3 posts
    Member since:
    Apr 2014

    Posted 17 Mar Link to this post

    I am having the same issue(using 2014 Q1 version). If you set FilterCheckListEnableLoadOnDemand = "true" in ColumnCreated Event, the filter menu is still empty and FilterCheckListItemsRequested event not being fired when click the Filter Imagebutton. However, if you try to create a static column in Web form and set the FilterCheckListEnableLoadOnDemand  to true(which shows mostly same for most online demo), it works. 

    The problem we both have is that grid column is generated dynamically so I have to set the FilterCheckListEnableLoadOnDemand  programmable in code behind(as recommend: ColumnCreated event), however most filter attribute of a GridBoundColumn works such as FilterDelay/CurrentFilterFunction but not for  FilterCheckListEnableLoadOnDemand.

    Please advise or provide a short demo. Thank you!

  8. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 21 Mar Link to this post

    Hello Dennis and Richard,

    Find my test applictaion attached that demonstrates the required functionality. Run t on your side and see if it works for you.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  9. Richard
    Richard avatar
    3 posts
    Member since:
    Apr 2014

    Posted 21 Mar in reply to Maria Ilieva Link to this post

    Hi Maria,

         Thank you for the provided example. However, it does not seem to work to me...In addition, I noticed you commented out the "//column.FilterCheckListEnableLoadOnDemand = true;" in Column_Created Event, why is that? I remembered that in order to make OnFilterCheckListItemsRequested Event work, it may need to satisfy both condition that one is to make FilterType either "CheckList" or "Combined"(which you used in the demo), another is to set "FilterCheckListEnableLoadOnDemand = true"...Anyway, whether I commented this or not in Column_Created Event, my OnFilterCheckListItemsRequested never fires, it only fires if you defined the specific column in aspx like 

    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name" FilterCheckListEnableLoadOnDemand="true" />,

    not when defined in code behind Event Column_Created Event like 

    if (e.Column.UniqueName.Contains("Name")){e.Column.FilterCheckListEnableLoadOnDemand = true;}

  10. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 24 Mar Link to this post

    Hello,

    Find my test movie below that presents how the FilterCheckListEnableLoadOnDemand property works properly when it is set on the server:
    http://screencast.com/t/9LRMgKVdq

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  11. Dennis
    Dennis avatar
    13 posts
    Member since:
    Jul 2015

    Posted 05 Apr Link to this post

    Hi All

     

    thanks for the reply ...im back from my vacation and I'll go check it shortly.

     

    thanks

     

    best regards

    Dennis

  12. Richard
    Richard avatar
    3 posts
    Member since:
    Apr 2014

    Posted 07 Apr in reply to Maria Ilieva Link to this post

    Hi Maria,

        Thank you for your tutorial in video, unfortunately it still does not work for me because my Grid is binding with dynamic data table which I have no idea how many columns or the name of the columns it may contain, in your demo you have columns defined in Page(.aspx), however, my grid would be more like below:

    <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"

    <MasterTableView Name="Main" CellPadding="0" CellSpacing="0" NoMasterRecordsText="" ></MasterTableView>

    </telerik:RadGrid>

    Like I said, if I defined columns in Page(.aspx), FilterCheckListEnableLoadOnDemand = "true" and  FilterCheckListEnableLoadOnDemand would work perfectly but if I don't define any columns, it won't work.

    Could you please try with a grid that has no columns defined(both master table and detail table) in Page and see?

    Thank you very much for your help!

    Best,

     

  13. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 Apr Link to this post

    Hello,

    You can see in the video that the columns for the MasterTable are autogenerated and they are not added manually in the markup. Only the DetailTable has declared columns.
    Can you please share what your exact hierarchy configuration is so that we can try to recreate it equally on our end and do further tests?

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017