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  |  

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


  Ads  
Iron Speed Designer is a software development tool for building database, reporting, and forms applications for .NET without hand-coding.
 


  Sponsors  

Meet Our Sponsors

.: CounterSoft :.
telerik
ExactTarget email software solutions
Merak Mail Server
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
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.

 


SSL Enabled and Amazingly FAST...
SSL enable your DNN web site with SSLRedirect, compress your DNN web site HTTP data flow by up to 75%-90% with HttpCompressionAgent, and monitor your DNN web site's performance with WebKeepAlive...
www.sanibellogic.com
Ultra Media Gallery & Video Gallery
The most popular photo gallery and video gallery module. with Flash interface.
www.bizmodules.net
WDK Solutions
Quality modules for the DotNetNuke community. Check out our 'wild' modules!
wdkns.com

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