hi,
there... im doing a page that shows report of a delivery boy in a courier company. But, I can't get any results and i don't know where i've gone wrong...please help

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>DELIVERY BOY REPORT</title>
</head>

<script runat="server">
    Sub Check(ByVal sender As Object, ByVal e As EventArgs)
        Dim i
        mess.Text = "<p>Selected Item(s):</p>"
        For i = 0 To CheckType.Items.Count - 1
            If CheckType.Items(i).Selected Then
                    mess.Text+=CheckType.Items(i).Text+
                    "<br>"
                    
            End If
        Next
    End Sub
        </script>
        
<body>
    <form id="form1" runat="server">
    
        
   
    <br >
    Package Code:
    <asp:TextBox ID="txtPackage" runat="server"></asp:TextBox>
    <br />
    <br >
    Destination:
    <asp:TextBox ID="txtDes" runat="server"></asp:TextBox>
    <br />
    <br >
    <asp:CheckBoxList ID="CheckType" AutoPostBack="true" OnSelectedIndexChangedIndexChanged="Check" runat="server">
    <asp:ListItem>Prescheduled</asp:ListItem>
    <asp:ListItem>Emergency Delivery</asp:ListItem>
    
    </asp:CheckBoxList>
    
    <asp:Label ID="mess" runat="server" />
    <br />
    <br >
    Package Status:
    <asp:TextBox ID="txtStatus" runat="server"></asp:TextBox>
    <br />
    
    
           
    
    <div>
    
    </div>
    </form>
</body>
</html>

also this portion has an error:

mess.Text+=CheckType.Items(i).Text+        
            "<br>"

in vb.net each line represents a statement. you should put "<br>" immediatly after .Text+.

your first line in the page should be :

<%@ Page Language="VB" %>

instead of

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

your first line is wrong, you are not using code behind but your page directive says so.

hi, im aware that there is a mistake in the first line, but i am dont know what kind of code to write...please help.

tell me first what you want to do?

This page is suppose to be keyed in by the delivery boy. once the boy clicks on the radioButtonlist , a new page with all the details must appear. The delivery boy then has to click on the information he wants. Once the delivery boy does that and conforms, the selected items should appear automatically on the previous page. I dont know how to do that.

after ive gone through, i modified i and still found errors while debugging, such as below:

Parser Error Message: System.Web.UI.WebControls.ListItemCollection must have items of type 'System.Web.UI.WebControls.ListItem'. 'asp:RadioButtonList' is of type 'System.Web.UI.WebControls.RadioButtonList'.

Ive submitted my modified programme:

<%@ Page Language="VB"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>DELIVERY BOY REPORT</title>
</head>
             <script runat="server">
                 Sub Page_Load()
                     If Not Page.IsPostBack Then
                         Dim PackType = New Hashtable
                         
                         PackType.Add("Prescheduled Delivery")
                         PackType.Add("Emergency Delivery")
                         rb.DataSource = PackType
                         rb.DataValueField = "key"
                         rb.DataTextField = "Value"
                         rd.Databind()
                         
                     End If
                 End Sub
                 </script>



<script runat="server">
    Sub Check(ByVal sender As Object, ByVal e As EventArgs)
        Dim i
        mess.Text = "<p>Selected Item(s):</p>"
        For i = 0 To CheckType.Items.Count - 1
            If CheckType.Items(i).Selected Then
                    mess.Text+=CheckType.Items(i).Text+"<br>"
                    
            End If
        Next
    End Sub
        </script>
        
<body>
    <form id="form1" runat="server">
    
        
   
    <br >
    Package Code:
    <asp:TextBox ID="txtPackage" runat="server"></asp:TextBox>
    <br />
    <br >
    Destination:
    <asp:TextBox ID="txtDes" runat="server"></asp:TextBox>
    <br />
    <br >
    <!--<asp:CheckBoxList ID="CheckType" AutoPostBack="true" OnSelectedIndexChangedIndexChanged="Check" runat="server">
    <asp:ListItem>Prescheduled</asp:ListItem>
    <asp:ListItem>Emergency Delivery</asp:ListItem>-->
        <asp:RadioButtonList ID="CheckType"  runat="server" AutoPostBack="true">
        </asp:RadioButtonList>
        <asp:CheckBoxList runat="server">
        <!--</asp:CheckBoxList>
    </asp:CheckBoxList>-->
    
    <asp:Label ID="mess" runat="server" />
    <br />
    <br >
    Package Status:
    <asp:TextBox ID="txtStatus" runat="server"></asp:TextBox>
    <br />
    
    
    
    
           
    
    <div>
    
    </div>
    </form>
</body>
</html>
This article has been dead for over six months. Start a new discussion instead.