locked
QueryableFilterUserControl MetaTable null RRS feed

  • Question

  • User1840112551 posted

    I'm trying to get the backend table attached to the dropdown filter on the default List.aspx page. The following code is running in the OnDataBinding event of the dynamic control. I'm getting a null value. What am I doing wrong?

                    
    QueryableFilterUserControl fuc = (sender as DynamicFilter).FilterTemplate as QueryableFilterUserControl;
        if (fuc.FilterControl is DropDownList)
        {
            DropDownList list = fuc.FilterControl as DropDownList;
            list.Items.Add(new ListItem("XXX"));//works fine
                        
            MetaTable x = fuc.FindMetaTable();
            if (x != null)
            {
                list.Items.Add(new ListItem(x.Name));//does not work
            }
        }
    
    Friday, February 3, 2012 9:55 AM

Answers

  • User-330204900 posted

    you can get the table name simply by accessing the Column and the parent table

    Column.ParentTable
    

    hope that helps

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 4, 2012 9:25 AM

All replies

  • User-330204900 posted

    Sorry Greatbear, not really sure what you are trying to achive?

    Friday, February 3, 2012 11:16 AM
  • User1840112551 posted

    Well basically trying to filter out the dropdown list values based on some conditions. To do that I need to know, dynamically, what table is the dropdownlist expressing. Then clear the items of that list generated by framework, and adding customized values to that list. I found a workaround, although not very elegant. On the pre_render of the associated label of the dropdown, I check the name of the label, which gives me the table name associated with the dropdown list :p

    Friday, February 3, 2012 12:55 PM
  • User-330204900 posted

    you can get the table name simply by accessing the Column and the parent table

    Column.ParentTable
    

    hope that helps

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 4, 2012 9:25 AM