Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2003, 04:02 PM
Authorized User
 
Join Date: Oct 2003
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default CheckBoxList filled from SQL..

Hi again all,
I've once more found a problem I need some helping with!
This time it's how to populate a CheckBoxList from an SQL query
I have gotten as far as to make one plain old HTML checkbox at the time with:
************************CODE FROM ASPX.VB**************
GBV.SqlCon()
Dim SQ As Data.SqlClient.SqlDataReader
Dim SQLCommand As New System.Data.SqlClient.SqlCommand("set dateformat dmy", GBV.SqlCon)
Dim strmeGroup1, strmeGroup2, strmeGroup3, strmeGroup4, strmeGroup5 As String
Try
    SQLCommand.CommandText = ("select meGroup1, meGroup2, meGroup3, meGroup4, meGroup5 from MEMBERS where meMobilnr = '" & strUMobileNR & "'")
    SQ = SQLCommand.ExecuteReader()
    Do While SQ.Read = True
        strmeGroup1 = SQ("meGroup1")
Response.Write("<INPUT type=""checkbox"" id=""cbxGroup1"" value=""" & SQ("meGroup1") & """>" & SQ("meGroup1") & "<br>")
    Loop
Catch ex As Exception
    Response.Write(ex.Message)
End Try
SQ.Close()
************************************************** *******
But I would need to have the power of asp:CheckBoxList at my will (to manipulate the checked once later in the code)!

Like always... Help is gold to a newbee!

All help is Good help!
Regards
Michael
__________________
------------------------
All help is Good help!
Regards
Michael
 
Old October 11th, 2003, 04:53 PM
Authorized User
 
Join Date: Oct 2003
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think I have found the solution! I'll post back as soon as I get it working 100%

All help is Good help!
Regards
Michael
 
Old October 11th, 2003, 05:11 PM
Authorized User
 
Join Date: Oct 2003
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

************************From test.aspx.vb****************
 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dbComm As Data.SqlClient.SqlDataAdapter
Dim SQL As String
Dim ds As New DataSet
SQL = ("SELECT Level4, PostNumber from AREA where PostNumber = '" & strmeGroup1 & "'")
dbComm = New System.Data.SqlClient.SqlDataAdapter(SQL, GBV.SqlCon)
dbComm.Fill(ds, "Level4")
myGroups.DataSource = ds.Tables("Level4").DefaultView
myGroups.SelectedIndex = 0
myGroups.DataBind()
End Sub

****************From test.aspx*************************
<FORM RUNAT="server" method="post">
<asp:checkboxList id="myGroups" runat="server"
DataTextField = "Level4"
DataValueField = "PostNumber"
font-name="Arial"
font-size="10"
backcolor="lightgreen"
width="250"
DataValueSelected = 1 />
</FORM>
************************************************** **
This worked like a charm..
A thanks to http://www.tconsult.com/aspnet/ado/checkbox.aspx

All help is Good help!
Regards
Michael





Similar Threads
Thread Thread Starter Forum Replies Last Post
create a dialog with a filled listbox PameXXX Visual C++ 0 July 13th, 2007 11:01 AM
Message Box (Show if form not filled out) misskaos Classic ASP Basics 38 October 10th, 2006 02:05 PM
remove rows to Sheet2 (cells in columnA filled RED alienscript Excel VBA 1 December 2nd, 2003 12:53 PM
move rows to top with cells in columnA filled RED alienscript Excel VBA 2 December 2nd, 2003 12:51 PM
Counting Users returning to a page they filled out bicho Classic ASP Basics 1 July 6th, 2003 03:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.