root menu without submenu has the error "Input string was not in a correct format."

2 posts, 0 answers
  1. Shawn
    Shawn avatar
    1 posts
    Member since:
    Jul 2014

    Posted 05 Nov 2014 Link to this post

    I got that error when I am building a menu based on a sqlDataSource with the following SelectCommand:
    SelectCommand="SELECT '1' AS id, null as pid, 'A&SI' AS text, '' as url
    UNION ALL
    SELECT '2', null, 'P&P',''
    UNION ALL
    SELECT '3', null, 'T&E',''
    UNION ALL
    SELECT '4', null, 'FTR',''
    ">

    However, it works if I add two union statements like below to the end:
    SelectCommand="SELECT '1' AS id, null as pid, 'A&SI' AS text, '' as url
    UNION ALL
    SELECT '2', null, 'P&P',''
    UNION ALL
    SELECT '3', null, 'T&E',''
    UNION ALL
    SELECT '4', null, 'FTR',''
    UNION ALL
    SELECT '7', null, '',''
    UNION ALL
    SELECT '8', '7', '',''
    ">

    The selectcommand eventually will be replaced by a stored procedure and I do not want to fix the problem by manipulating the procedure using dirty tricks like this.

    Any ideas? Thanks!!
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 10 Nov 2014 Link to this post

    Hi,

    I am using the following select command in order to query only root items from the data table and it works fine at my side.
    //code behind
    DataTable data = GetData(new SqlCommand("SELECT * FROM ProductCategories WHERE ParentId IS NULL"));

    The data table ProductCategories is part of the Telerik.mdf data base.

    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top