Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 29th, 2011, 06:29 PM
Registered User
 
Join Date: Oct 2011
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Question Getting SQL Alias Columns to Show Up in Dropdownlist

Code:
I'm trying to concatenate two table columns and have them display in a dropdown list, but the list shows as empty.  If I replace the "itemText" with "descr" below, then the dropdownlist gets filled.  It's not clear what I should have to the right of the SQL "AS" clause - itemText, @itemText, or [itemText] - but no matter what I put the SQL runs without error, but nothing displays in the list. 


In my dropdownlist datasource I have:

SelectCommand="SELECT [heading], [heading] + REPLICATE('.', 20 - LEN([heading])) + [descr] AS itemText FROM Testfile" 

For the sqldatasource I also Have:

    <SelectParameters>
      <asp:Parameter Name="itemText" Type="String" />
    </SelectParameters>

For the dropdownlist I have:
  <asp:DropDownList ID="DropDownList" runat="server" 
    DataSourceID="SqlDataSource" DataTextField="itemText" 
    DataValueField="ID_KEY" AutoPostBack="True" 
  </asp:DropDownList>

Last edited by BobRoberts; October 29th, 2011 at 06:37 PM..
 
Old November 1st, 2011, 04:06 PM
Registered User
 
Join Date: Oct 2011
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default It's Working Now

Not sure why, but I tried it again and it's working now.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to hash 2 columns of SQL table Mattt C# 2 July 17th, 2009 03:08 AM
Combo Box Show all bound columns Coby Excel VBA 2 October 22nd, 2007 02:24 PM
show columns with same ID in the same row yuvalk SQL Server 2005 4 February 2nd, 2007 07:46 PM
convert columns to rows in sql hoangmv0101 SQL Language 0 January 2nd, 2007 02:04 AM
total columns in sql query nlicata SQL Server ASP 1 August 4th, 2003 06:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.