1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / add new QueryString key

add new QueryString key

4 posts, 0 answered
  1. Alvaro
    Alvaro avatar
    5 posts
    Registered:
    13 Jul 2009
    10 Sep 2009
    Link to this post
    Hi,

    I want to create a new item in QueryString section on Panel Edit to filter my view.
    This item is a field in my module.
    How can I do that?

    Regards, Álvaro
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    10 Sep 2009
    Link to this post
    Hi Alvaro,

    Thank you for using our services.

    It depends on the view you have created for your module. Do you use client side or server side binding? What is the markup and logic of binding your view? Which control you use to show the items - RadGrid or GridView?
    Also do you want to filter the public control or the view in the backend. If you want to filter the public control you can pass the value of the metakey you have added to your module to FilterExpression property of the control you have. FilterExpression property is accessibe for all controls that inherits from ContentView class.

     Any additional information or some screenshots will be appreciated.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Alvaro
    Alvaro avatar
    5 posts
    Registered:
    13 Jul 2009
    10 Sep 2009
    Link to this post
    Hello,
    I have used this module:
    http://www.sitefinity.com/blogs/ivan/posts/09-03-1/sample_generic_content_based_module_products_module.aspx

    I have added new specifics fields and I have compiled again.
    I want something like this in Panel Edit:

    QueryString keys
    -ContentItemKey : CntItem
    -PageKey:CntPageID
    .
    .
    .
    -My_Field: CntMyField. <-- new one wich we will use to filter views.

    Thanks in advance
    Álvaro











  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    11 Sep 2009
    Link to this post
    Hello Alvaro,

    The QeryString key should be added to your Public view class.

    Sample code:

            [Category("QueryString Keys")] 
            [DefaultValue(null)] 
            public virtual string MyItemKey 
            { 
                get 
                { 
                    object KeyObj = ViewState["MyItemKey"]; 
                    if (KeyObj == null
                        return ProductsManager.MyItemKey; 
                    return (string)KeyObj; 
                } 
                set 
                { 
                    ViewState["MyItemKey"] = value; 
                } 
            } 

    As you can see if there is no value entered by the user we are returning  ProductsManager.MyItemKey; where MyItemKey is declared as public const string MyItemKey = "CntItemID";

    Then you need to implement custom logic in CreateChildControls method where you need to apply a Filter statement using ContentFilterBuilder.

    Another option is creating a new metakey for your content items and then use FilterExpression property of the ContentView based control.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered