TO GIVE THE EXACT LIST OF HEADERS SENT BY THE BROWSER

DEFAULT.ASPX FILE:

<%@ 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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Select your choice:"></asp:Label>
    <div>
   
    </div>
    <asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple">
        <asp:ListItem>AUDI</asp:ListItem>
        <asp:ListItem>BENZ</asp:ListItem>
        <asp:ListItem>MARUTHI</asp:ListItem>
        <asp:ListItem>MAHINDRA</asp:ListItem>
        <asp:ListItem>JAQUAR</asp:ListItem>
    </asp:ListBox>
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" Text="submit" Width="105px" />
    <p>
        <asp:Label ID="Label2" runat="server"></asp:Label>
    </p>
    </form>
</body>
</html>


DEFAULT.ASPX.VB FILE:

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim str As String = Request.Form("listbox1")
        If Len(str) < 0 Then
            Label2.Text = "Please select any one option"
        Else
            Label2.Text = "you have selected  " & str
        End If
    End Sub
End Class

No comments:

Post a Comment