Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

DotNetNuke Marketplace
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
WebHostForAsp.net
 


  Sponsors  

Meet Our Sponsors

telerik
ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Bind SQL datasource to DropDownList
Previous Previous
 
Next Next
New Post 5/11/2008 2:47 AM
Resolved
User is offline aR
12 posts
10th Ranked


Bind SQL datasource to DropDownList 

Hi All,

I am trying to bind data from SQL Server 2005 database to a DropDownList.

But for some reason, instead of displaying the data, the DropDownList displays "System.Data.Common.DataRecordInternal".

Here is the code that I use. I tried the same code to bind the data to GridView and it worked.

Protected

 

mySqlString.Append(

dropdown_Make.DataSource = DataProvider.Instance().ExecuteSQL(mySqlString.ToString())

dropdown_Make.DataBind()

 

Sub btn_Load_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Load.ClickDim mySqlString As New StringBuilder()"SELECT testColumn FROM testTable")End Sub

 

Screenshot is also available:

http://img233.imageshack.us/my.php?image=erroryz6.jpg

Thanks for the help.

 
New Post 5/11/2008 6:21 AM
User is offline Scott Stokes
108 posts
www.adverageous.com
9th Ranked


Re: Bind SQL datasource to DropDownList 

Did you set the column names for DataTextField and DataValueField on the Dropdownlist?

Such as:

<

asp:DropDownList ID="ddAddAdminFolders" runat="server" DataTextField="DefaultTitle" DataValueField="FolderID"></asp:DropDownList>

 
New Post 5/11/2008 7:14 AM
User is offline Paul Scarlett
183 posts
www.tressleworks.ca
9th Ranked






Re: Bind SQL datasource to DropDownList 
Modified By Paul Scarlett  on 5/11/2008 10:15:52 AM)

Just as an alternative, you may want to consider the module SQLGridSelectedView .. this module allows the user to define dropdown selection to filter primary selects ... very powerful.  A free version exists that provides this functionality -- see www.tressleworks.ca      I have aslo found this module to be a great way to prove SQL commands while creating custom modules. 

Paul.

 

 
New Post 5/12/2008 6:25 AM
User is offline aR
12 posts
10th Ranked


Re: Bind SQL datasource to DropDownList 

 Scott Stokes wrote

Did you set the column names for DataTextField and DataValueField on the Dropdownlist?

Such as:

 

asp:DropDownList ID="ddAddAdminFolders" runat="server" DataTextField="DefaultTitle" DataValueField="FolderID">asp:DropDownList>

No.

Btw, what does 'DefaultTitle' and 'FolderID' refer to?

Any other ideas?

<

 
New Post 5/12/2008 6:43 AM
User is offline aR
12 posts
10th Ranked


Re: Bind SQL datasource to DropDownList 

Please ignore my previous post.

Resolved.

Thanks to Scott for pointing out the problem :).

It is indeed DataTextField="testColumn" that was missing.

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Bind SQL datasource to DropDownList
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


$7.16/mo - Powerful DotNetNuke Hosting
Powerful DotNetNuke Hosting starting at under $8/mo with FREE SQL 2005, FREE Installation and expert support.
www.re-invent.com
ASP.NET Web Hosting for $3.95
3 Month FREE ASP.NET Hosting! FREE Setup! DNN Support! FREE Domain Name! FREE Components! Host multiple websites on 1 plan! 30 Days Money Back Guarantee!
www.dailyrazor.com
Cestus Websites
DotNetNuke websites en services in Nederland. Cestus Websites levert websites, projectmanagent, skins, modules, training en gespecialiseerde hosting op basis van het CMS DotNetNuke.
www.dotnetnuke-websites.nl

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP