Results 1 to 3 of 3

Thread: [RESOLVED] ASP dynamically generates checkboxes...

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Resolved [RESOLVED] ASP dynamically generates checkboxes...

    ...so what should ASP.NET equivalent do?

    This is my asp code:
    Code:
    <%
    Sub Show_Document_Type_Selection (typ)
    	Dim oConn
    	Dim oRS
    	Dim strSQL	
    
    	strSQL = "SELECT toplvl_ik, des FROM toplvl ORDER BY des;"	
    	Set oConn = Server.CreateObject("ADODB.Connection")
    	oConn.Open ConnString
    	Set oRS = oConn.Execute (strSQL)	
    	While Not oRS.EOF 
    		%>
    		<INPUT TYPE="checkbox" NAME="toplvl" VALUE="<%=oRS("toplvl_ik")%>" <%If InStr(CStr(toplvl), oRS("toplvl_ik")) Then Response.Write " CHECKED" End If%>>&nbsp;<B><%=oRS("des")%></B>
    		<%If oRS("des") = "Savings Summary" Then
    			Response.Write "<BR>"
    		End If%>
    		&nbsp;		
    		<%
    		oRS.MoveNext
    	Wend	         
    	oRS.Close
    	Set oRs = Nothing
    	oConn.Close
    	Set oConn = Nothing
    End Sub
    %>
    When I run that query in Query Analyzer, it returns me six rows and these are the six checkboxes.

    Any advice on how this code can be migrated to .NET?

  2. #2
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: ASP dynamically generates checkboxes...

    i think you should use checkboxlist control.In that u can specify the datasource (Result of select query) ,Datatextfield (des ) and datavalueField (toplvl_ik).

    Hope this will help u.

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Re: ASP dynamically generates checkboxes...

    I think so too.

    Thanks for the quick reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width