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  |  

PortalWebHosting
  Ads  
 


  Sponsors  

Meet Our Sponsors

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


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! (Pro...  Database Help
Previous Previous
 
Next Next
New Post 10/1/2008 7:44 AM
User is offline Trevor Daniel
105 posts
www.dnnxhtml.co.uk
9th Ranked


Database Help 

Hello,

I am fairly new to custom development in DNN and was wondering if someone could help me out...

Basically, I have a database table and a stored procedure and i want to execute the stored procedure on page load and populate a dropdownlist.

I have it working i think but the strange thing is that the html for the dropdownlist doesn't look well formed when i do a "view source". Every item I have programatically added is missing the "</option>" tag...

The html code for the dropdownlist is as follows:

<asp:DropDownList ID="DropDownListBorough" runat="server">
</asp:DropDownList>

And the code i am using to populate the dropdownlist is as follows:

Dim sqlDataProvider As SqlDataProvider = CType(DataProvider.Instance(), SqlDataProvider)
Dim connectStr As String = sqlDataProvider.ConnectionString
Dim dbo As String = sqlDataProvider.DatabaseOwner
Dim oq As String = sqlDataProvider.ObjectQualifier
Dim PortalID As Integer = Me.PortalId
        
Dim dr As IDataReader = CType(SqlHelper.ExecuteReader(connectStr, dbo & oq & "TaxiRoute_GetAuthorityNames"), IDataReader)
                       
Do While dr.Read() 
DropDownListBorough.Items.Add(New ListItem(dr("Authority_Name"), dr("AuthorityID"))) 
Loop
dr.Close()

Can anyone give me some help?

Thanks

Trev

 
New Post 10/1/2008 8:32 AM
User is offline Brian Dukes
479 posts
www.engagesoftware.com
8th Ranked


Re: Database Help 
Modified By Brian Dukes  on 10/1/2008 10:33:36 AM)

It should be a lot easier to use the databinding syntax, rather than adding the items manually.  However, if you problem is just malformed HTML, it may be the control itself, rather than anything you're doing wrong.

Using dr As IDataReader = CType(SqlHelper.ExecuteReader(connectStr, dbo & oq & "TaxiRoute_GetAuthorityNames"), IDataReader)
                      
DropDownListBorough.DataSource = dr
DropDownListBorough.DataTextField = "Authority_Name"
DropDownListBorough.DataValueField = "AuthorityID"
DropDownListBorough.DataBind()
 
End Using

Hope it helps,


Brian Dukes
Engage Software
St. Louis, MO
314.966.4000

The leading provider of DotNetNuke support, training and custom module development.
 
New Post 10/2/2008 6:24 AM
User is offline Trevor Daniel
105 posts
www.dnnxhtml.co.uk
9th Ranked


Re: Database Help 

Thanks.

That worked a treat.

Trev

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! (Pro...  Database Help
 


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.

 


Mad Development: dotnetnuke design and development
We are an expert Dotnetnuke shop specializing in developing solutions that merge the requirements of design and branding, content management, ecommerce, search engine optimization and business logic.
www.MadDevelopment.com
telerik
telerik r.a.d.controls suite is the most innovative and comprehensive toolset for ASP.NET development, tailored for seamless integration with the DotNetNuke project. This integrated collection of controls allows professionals to build web-solutions with the UI richness and responsiveness of desktop applications.
dnn.telerik.com
CrystalTech
CrystalTech Web Hosting™ provides first-class service and support. Our value-packed ASP.NET plans offer DNN installation, SQL 2005 and up to 100 domain names starting at only $16.95 per month!
CrystalTech.com

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