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

Forums / Bugs & Issues / problems with categories in custom module

problems with categories in custom module

14 posts, 0 answered
  1. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    18 Jun 2008
    Link to this post
    I think I may have stumbled on a bug, but I'm not sure, here's the scenario.

    I've created a custom module that derives from the custom content control. I want to first present users with the categories, so on the default page for this section I've dropped a category control, setting it to the custom module provider. I don't want them to be dealing with the ugly guids, so I set the category to be Name instead of ID. I also renamed the querystring key from CntCatID (or whatever it was) to simply be category...

    This category page links to another content page which has a contentview control. I set the same thing, to use the category name and the querystring to be category instead of CntCatId...

    but now when I run the page, I see the correct categories and counts, and if I click a category, I do see the filtered results on a new page... however, when I click a link to see the full content, the url rendered appends the category as an ID instead of the name, and as a result I get the "Input string was not in a correct format" error.

    Am I doing something wrong or is this a bug? it should be generating the url appending ?category=name instead of ?category=some-long-guid-49g9ag-thing right?
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    18 Jun 2008
    Link to this post
    here's some more info:

    it appears that the problem is that it's generating the querystrings at all. the categories page works fine, linking to the categorymode of contentview, but the links to the singleitemmode of that view are being appending with querystrings for both category and cntpageid. if I click that link, I get the input string error. however if I copy and paste the link, removing all of the appended querystrings, it works perfectly.

    so it looks like the question is: how do I prevent these links from appending the unneeded query strings?
  3. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    19 Jun 2008
    Link to this post
    aha! I think I've got something... it looks like its rendering the querystring incorrectly... instead of doing this:

    site.com/category/title_of_content.aspx??CntPageID=1&category=a66a243d-4424-463d-856c-a40239a6a783

    it's doing this:
    site.com/category/title_of_content.aspx??CntPageID=1?category=a66a243d-4424-463d-856c-a40239a6a783

    if I type the correct link (with the &) into the address bar, it works! is this a bug?

    I would still rather be able to just completely disable the querystrings altogether because the singlecontent view doesnt need them

    so what should I do next?
  4. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    24 Jun 2008
    Link to this post
    well, I ended up hacking together a solution by overriding the GetItemUrl method of the contentview base. I'm sure this isn't the ideal solution but it's all I was able to figure out on my own:

    protected override string GetItemUrl(IContent contentItem, string singleItemUrl)  
    {  
        if (CurrentMode == DisplayModes.Category)  
            return string.Format("/knowledgebase/category/{0}.aspx", contentItem.Url);  
        else 
            return base.GetItemUrl(contentItem, singleItemUrl);  

    is there a better way to do this? thanks!
  5. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    25 Jun 2008
    Link to this post
    Hi SelArom,

    Unfortunately, we cannot provide you with a better (optimized) solution. Overriding the GetItemUrl method of the base class is the right way to achieve the required functionality. Please contact us if you experience any problems with your implementation.

    Best wishes,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    25 Jun 2008
    Link to this post
    hey i'm just surprised I did it right :) it does indeed work the way I need it to so thanks for confirming!
  7. UI Crew
    UI Crew avatar
    99 posts
    Registered:
    24 Sep 2012
    25 Jun 2008
    Link to this post
    Hi Telerik,

    I discovered this problem today same as SelArom by applying the recommended solution for filtering by categories in the Knowledgebase Article - http://www.sitefinity.com/support/knowledge-base/kb-article/b1154K-bace-b1154T-cmm.aspx

    There seems to be a real problem with the contruction of the url as it goes to the detail view.

    Unlike SelArom I was not using a custom content control I was using Content View with a generic content provider straight out of the box.

    I can confirm that the url gets constructed incorrectly when going to the detail view like http://www.domain.com/page/contenttitle.aspx?CntPageID=1?category=a66a243d-4424-463d-856c-a40239a6a783

    It should have an ampusan:

    http://www.domain.com/page/contenttitle.aspx?CntPageID=1&category=a66a243d-4424-463d-856c-a40239a6a783

    Can you confirm whether this is just us or a bug?

    Thanks

    Seth
  8. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    26 Jun 2008
    Link to this post
    i went ahead and submitted a bug report, I can't think of any reason why the query string would need more than one ? character, all other appended items should be appended with &
  9. Nikifor
    Nikifor avatar
    232 posts
    Registered:
    18 May 2013
    01 Jul 2008
    Link to this post
    Hello SelArom and Seth,

    We are apologizing for the delay in our response.

    It seems that the Content View control does not make a verification whether the query attribute is the first in the line (in your case it is CntPageID=1), and this is why the next attribute is applied with ? also.
    We spent some time on reproducing the reported problem, but at the end we did not manage to receive the CntPageID=1 attribute in the URL query. We followed explicitly Josh's instructions but we were receiving only the Category attribute in the URL query. We used the Content View control.

    In order to narrow down the number of possible factors, causing this problem, it would be really helpful if you can give us step by step instructions for reproducing the error using the Content View control.

    We appreciate your effort and understanding.

    Kind regards,
    Nikifor
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    01 Jul 2008
    Link to this post
    i'm not sure if this makes a difference, but I am using a custom control that inherits from contentview. the only thing I expanded originally was to change the name of the provider...

    but now as I switch it back (commenting out the getitemurl method above), it is also not appending the cntitemid querystring anymore! what gives?

    Although in my news module it is appending the cntitemid... our site isn't live yet unfortunately so I can't show you what's going on. are you still having the problem seth?
  11. UI Crew
    UI Crew avatar
    99 posts
    Registered:
    24 Sep 2012
    01 Jul 2008
    Link to this post
    Hi,

    Yes I am - all I am doing is using a standard ContentView on the page setting it to "Auto" and then putting my category guid in the Category ID field. Although I am not at work so will need to check it out tomorrow to confirm.

    Thanks

    Seth
  12. Nikifor
    Nikifor avatar
    232 posts
    Registered:
    18 May 2013
    04 Jul 2008
    Link to this post
    Hi Seth Cleaver,

    I am just following up on the ticket.

    Did you manage to collect the requested information for the configuration of the Content View control?

    Thank you for your assistance.

    Kind regards,
    Nikifor
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  13. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    10 Jul 2008
    Link to this post
    i submitted the module in a zip in the bug report ticket for your review. please let me know if there's anything further I can do to help you reproduce this issue.

    thank you!
  14. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    10 Jul 2008
    Link to this post

    Thank you SelArom, we'll need some time to review it. We'll get back to you as soon as we hava some results.

    Regards,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
14 posts, 0 answered