Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defining handles for a dropdownList

Status
Not open for further replies.

Lecutus1

Programmer
Sep 17, 2008
3
0
0
US
The basic question was: " How do I get the choice/selection of a dropdowndown list to be a variable, to be used for the rest of the process/program?"

I found what I thought was the answer, but instead got this error. I've several different declarations, none worked.

If someone could point me in the right direction, it would be most appreciated.

I've done some programming, but .ASP is new to me.

Thanx
N.

On to the Story



Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

Source Error:



Line 20:
Line 21:
Line 22: Protected Sub FormView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewPageEventArgs) Handles FormView1.PageIndexChanging
Line 23:
Line 24: End Sub


Source File: C:\Documents and Settings\WiFi\My Documents\Visual Studio 2005\WebSites\WebSite1\Default.aspx.vb Line: 22

The code that caused this mess:

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<script runat="server">


Sub submit(ByVal sender As Object, ByVal e As EventArgs)
mess.Text = "You selected TruckList.SelectedItem.Value" & TruckList.SelectedItem.Value
mess1.Text = "Hello from the inside of TruckList.DataValueField" & TruckList.DataValueField
mess2.Text = "Hello from the inside of TruckList.SelectedValue" & TruckList.SelectedValue
mess3.Text = "Hello from the inside of TruckList.SelectedIndex" & TruckList.SelectedIndex
End Sub
</script>
<html xmlns=" >
<head runat="server">
<title>Whitlock WIFI Development Crop.</title>
</head>

<! Dim WithEvents submit As New Button !>
<body>
<form id="form1" runat="server">
<div id="DIV1">
Pick ATruck to Monitor&nbsp;
<asp:DropDownList ID="TruckList" runat="server">
<asp:ListItem Value="190.180.170.101">Truck1</asp:ListItem>
<asp:ListItem Value="190.180.170.102">Truck2</asp:ListItem>
<asp:ListItem Value="190.180.170.103">Truck3</asp:ListItem>
<asp:ListItem Value="190.180.170.104">Truck4</asp:ListItem>
<asp:ListItem Value="190.180.170.105">Truck5</asp:ListItem>
<asp:ListItem Value="190.180.170.106">Truck6</asp:ListItem>
<asp:ListItem Value="190.180.170.107">Truck7</asp:ListItem>
<asp:ListItem Value="190.180.170.108">Truck8</asp:ListItem>
<asp:ListItem Value="190.180.170.109">Truck9</asp:ListItem>
<asp:ListItem Value="190.180.170.110">Truck10</asp:ListItem>
</asp:DropDownList><br />
<br />
<asp:Button Text="Submit" OnClick="submit" runat="server"/>

<p><asp:label id="mess" runat="server"/></p>
<p><asp:label id="mess1" runat="server"/></p>
<p><asp:label id="mess2" runat="server"/></p>
<p><asp:label id="mess3" runat="server"/></p>
&nbsp;Hello from the inside of&nbsp; <br />
</div>
</form>
</body>
</html>
 
I suggest you create a new page. In that page, use the code-behind file for your code. Including code mixed with HTML is classic ASP programming. .NET allows for a separate code-behind file which makes for maintainablity and easier debugging.
 
Thanks jbenson001

Ya see, this is why I LIKE TEK-Tips. I can get something done.

It's always the simple stuff!!!!!!!!!!!!!!!

I'll Be Back

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top