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  |  

telerik -- supercharge your DNN websites
  Ads  
r2i.ntegrated
 


  Sponsors  

Meet Our Sponsors

OnyakTech
CrystalTech Web Hosting™
Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
SteadyRain
DataSprings - Great Ideas. Always Flowing.
 


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.

 


AfterImage Internet Consulting and SEO Services
AfterImage provides search engine optimization (SEO), Internet consulting and hosting services for the Windows platform (IIS, ASP, SQL Server).
www.afterimage.nl/
Alki Homes - Seattle, WA
Exemplary service for your Seattle Real Estate needs. It's what you deserve from your Realtor®!
www.alkihomes.com
Swanzey Internet Group LLC
DotNetNuke design, development, e-Commerce, hosting, maintenance, and training. Exclusively DotNetNuke.
www.swanzey.com

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