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  |  

The best choice for your web site host, email hosting, and domain registration.
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
r2i.ntegrated
 


  Sponsors  

Meet Our Sponsors

SmarterTools
The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
 


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
159 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.

 


DotNetNuke Marketplace - Modules & Skins
The DotNetNuke Marketplace is the official e-commerce gateway for the DNN ecosystem. It's the place to buy and sell DotNetNuke modules, DotNetNuke skins, and other DNN offerings.
DotNetNuke Marketplace
ExactTarget Email Marketing Software and Solutions
ExactTarget delivers on-demand email software solutions for permission-based email marketing. ExactTarget offers solutions that meet the needs of all industry verticals and all size organizations, including SMB, corporate divisions, not-for-profits, large retail/direct marketers, agencies and enterprises.
ExactTarget.com
Sunset Hill Solutions - Consulting and Development
We offer general DNN consulting services - including custom module development and commercial module integration/setup.
www.sunsethill.ca

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