This is a migrated thread and some comments may be shown as answers.

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

1 Answer 22 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 05 Nov 2014, 10:02 PM
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!!

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 10 Nov 2014, 04:23 PM
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.

 
Tags
Menu
Asked by
Shawn
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or