Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6610673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:52:14+00:00 2026-05-25T19:52:14+00:00

I have a Dev Express ASPxComboBox: <dx:ASPxComboBox runat=server ID=DropDownListTemplates DataSourceID=SqlDataSourceTemplates ValueField=template_id TextField=name ValueType=System.Int32 Enabled=false

  • 0

I have a Dev Express ASPxComboBox:

<dx:ASPxComboBox runat="server" ID="DropDownListTemplates"
    DataSourceID="SqlDataSourceTemplates" ValueField="template_id" TextField="name" 
    ValueType="System.Int32" Enabled="false" Width="100%" SelectedIndex='<%# 
    Eval("subs_template") %>'/>

Which throws a “Specified cast is not valid error” at runtime. It’s something to do with the

SelectedIndex='<%# Eval("subs_template") %>'

Expression, however, subs_template is guaranteed to be a number:

<asp:SqlDataSource ID="SqlDataSourceClientDetail" runat="server"
        ConnectionString="<%$ code: AutoNat.ConnectionManager.AutoNatConnectionString %>"
        SelectCommand="SELECT *, isnull(subs_template_id, 0) subs_template FROM [person] p WHERE [person_id]=@person_id">
        <SelectParameters>
            <asp:SessionParameter Name="person_id" SessionField="personID" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>

    <asp:SqlDataSource ID="SqlDataSourceTemplates" runat="server" ConnectionString="<%$ code: AutoNat.ConnectionManager.AutoNatConnectionString %>"
       SelectCommand="SELECT * FROM 
                      (SELECT t.template_id, name FROM subs_template t UNION SELECT 0, 'Custom...') s 
                      ORDER BY template_id">
     </asp:SqlDataSource>

Why does this keep failing?

I have tried

SelectedIndex='<%# 0 %>'

Which works fine!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:52:15+00:00Added an answer on May 25, 2026 at 7:52 pm

    Have you tried casting it o an integer like this? Convert.ToInt32(Eval("subs_template"))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with a Dev Express component, namely AspxComboBox. My context is
I have a WPF Dev Express DxGrid that is bound to an ObservableCollection in
I am running VS2010 Ultimate, I used to have VS Web Dev 2010 Express
I have a Dev-express Tree Structure with Drag and Drop capability. After Drag and
I only have SSMS 2008 Express on my dev machine. What tools are there
I have a dev express report. I want to search for all controls on
Hello developers I am using VS 2010 .I have a dev express grid in
I have to copy a db from a remote server to my local dev
I have a Node.js Express app that I'm hosting on Nodejitsu. I'm already using
I have the occasional need to run SQL Server on my notebook computer. 90%

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.