locked
Remove Category RRS feed

  • Question

  • Hi,

     

    In our environment, we have a huge long list of categories. We do not want the user to see this list, because it will only confuse them, and they won't even know what to choose to begin with. Is there a way to hide this from the form?

     

    James

    Monday, April 11, 2011 9:04 AM

Answers

  • E.O,

    Thats not exactly what I was looking for but its a great answer! Opens up more options for us now, thanks a lot!

     

    Also, just to reply to my own question in case someone needs this, I've totally removed the category from the portal by going to the CreateRequest.cs under WebParts project and commenting out the below.

     

    /*categoryDropDownList = new DropDownList();

    categoryDropDownList.ID = "categoryDropDownList";

    categoryDropDownList.CssClass = Constants.grayText;

    categoryDropDownList.SelectedIndex = 0;

    r2c3.Controls.Add(categoryDropDownList);*/

     

    After that, again under WebParts project, open up WebPartsResources.resx, look for Category under the Name table, and delete the values under Value table.

     

    • Marked as answer by James Yeoh Tuesday, April 19, 2011 2:39 AM
    • Unmarked as answer by James Yeoh Tuesday, April 19, 2011 11:27 AM
    • Marked as answer by James Yeoh Friday, April 22, 2011 2:50 AM
    Wednesday, April 13, 2011 2:48 PM
  • James,

    It seems like you removed the category dropdown but didnt fix the summary page. Summary page tries to display the selected category. So comment out these lines in GetThirWizardStep()

                // append the selected category
                strBuilder.Append(Utils.GetClosingHtmlElement(HtmlTextWriterTag.P));
                if (this.categoryDropDownList.SelectedItem == null)
                {
                    SCTrace.Trace(SCTrace.TRACE_LEVEL_INFO, SCTrace.TF_COMPONENT,
                            "No category could be set while creating the request portal because no category was selected. Seems like all categories have been deleted or user did not select any.");
                }
                else
                {
                    strBuilder.Append(HtmlTextWriter.SpaceChar);
                    strBuilder.Append(this.categoryDropDownList.SelectedItem.Text.Trim());
                }

    you should also remove all references to categoryDropDownList if you are not using the control. You would have to remove it from SetDataItemValues(IDataItem dataItem, bool isChangeRequest) also otherwise create request will throw an exception on submit.

     


    Paresh
    • Marked as answer by James Yeoh Friday, April 22, 2011 2:50 AM
    Tuesday, April 19, 2011 6:53 PM
    Answerer

All replies

  • Hi James,

    Again you can do this by filter out the categories in portal source code. Please refer this post about SM portal source code. If you need help me where to do this in the code let me know.


    Paresh
    Wednesday, April 13, 2011 1:30 AM
    Answerer
  • Hi Paresh,

    Thanks. I was actually wondering where in the code it is at. Now that you've told me its possible, I know I wont be looking for something that doesn't exist. When I get a solution I'll post this here to help others that might be in need.

     

    James 

    Wednesday, April 13, 2011 4:09 AM
  • In the CreateRequest.cs (Webparts) you can remove (comment out) the following line to hide the second level (subcategories) from the classification in the portal. If that is what you were looking for. I have just done it myself and it seems to work fine, but no garantees.

    // AddChildCategoriesToDropDownList(category.ChildCategories, level + 1);

    Kind Regards,

    Ezequiel Osorio

     

     


    E.O
    Wednesday, April 13, 2011 1:05 PM
  • E.O,

    Thats not exactly what I was looking for but its a great answer! Opens up more options for us now, thanks a lot!

     

    Also, just to reply to my own question in case someone needs this, I've totally removed the category from the portal by going to the CreateRequest.cs under WebParts project and commenting out the below.

     

    /*categoryDropDownList = new DropDownList();

    categoryDropDownList.ID = "categoryDropDownList";

    categoryDropDownList.CssClass = Constants.grayText;

    categoryDropDownList.SelectedIndex = 0;

    r2c3.Controls.Add(categoryDropDownList);*/

     

    After that, again under WebParts project, open up WebPartsResources.resx, look for Category under the Name table, and delete the values under Value table.

     

    • Marked as answer by James Yeoh Tuesday, April 19, 2011 2:39 AM
    • Unmarked as answer by James Yeoh Tuesday, April 19, 2011 11:27 AM
    • Marked as answer by James Yeoh Friday, April 22, 2011 2:50 AM
    Wednesday, April 13, 2011 2:48 PM
  • James seems like you were able to remove the categories if yes can you please mark the question as answered. So that others can refer to it if they need it.

    Thanks

    Paresh


    Paresh
    Tuesday, April 19, 2011 12:56 AM
    Answerer
  • I'm unmarking this as answered. I just found out that with that method I'm able to remove the category, however when I click Next to go toward the third step which is the summary page, the screen just gives an error. I don't know whats wrong, anyone have any idea?
    Tuesday, April 19, 2011 11:29 AM
  • James,

    It seems like you removed the category dropdown but didnt fix the summary page. Summary page tries to display the selected category. So comment out these lines in GetThirWizardStep()

                // append the selected category
                strBuilder.Append(Utils.GetClosingHtmlElement(HtmlTextWriterTag.P));
                if (this.categoryDropDownList.SelectedItem == null)
                {
                    SCTrace.Trace(SCTrace.TRACE_LEVEL_INFO, SCTrace.TF_COMPONENT,
                            "No category could be set while creating the request portal because no category was selected. Seems like all categories have been deleted or user did not select any.");
                }
                else
                {
                    strBuilder.Append(HtmlTextWriter.SpaceChar);
                    strBuilder.Append(this.categoryDropDownList.SelectedItem.Text.Trim());
                }

    you should also remove all references to categoryDropDownList if you are not using the control. You would have to remove it from SetDataItemValues(IDataItem dataItem, bool isChangeRequest) also otherwise create request will throw an exception on submit.

     


    Paresh
    • Marked as answer by James Yeoh Friday, April 22, 2011 2:50 AM
    Tuesday, April 19, 2011 6:53 PM
    Answerer
  • Thanks Paresh, that did it!

    For anyone looking for a step by step guide for the solutions mentioned in this thread, refer to this link.

    http://memoexp.wordpress.com/2011/04/25/modify-scsm-portal-categories/

    Friday, April 22, 2011 2:49 AM