|
 |
aspx_beginners thread: Binding Servers Control To An ArrayList
Message #1 by "Eng Teik Lim" <enterprise@t...> on Tue, 16 Apr 2002 10:34:08
|
|
Hello,
I have a problem with the ArrayList I am working on as an example. The
return reply is that:
"Control 'myDropDownList' of type 'DropDownList' must be placed inside a
form tag with runat=server."
I have placed the tag as mentioned but yet the returned as the above:
______________________________ Source code __________________
<%@ Page Language="VB" %>
<script language="vb" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim al As New ArrayList
al.Add("Item 1")
al.Add("Item 2")
al.Add("Item 3")
al.Add("Item 4")
al.Add("Item 5")
myDropDownList.DataSource = al
Page.DataBind()
End Sub
</script>
<html>
<head>
<title>Sample Text</title>
</head>
<body>
<p>
<b>Binding to a DropDownList</b><br>
<asp:DropDownList id="myDropDownList" runat="server" />
</p>
</body>
</html>
_______________________________end code _______________________
Message #2 by "lena nyman" <lena_nyman@h...> on Wed, 17 Apr 2002 07:10:36 +0000
|
|
Hello
Try myDropDownList.DataBind()
and put it all in if not page.ispostback then
al.Add ...
Lena
>From: "Eng Teik Lim" <enterprise@t...>
>Reply-To: "aspx_beginners" <aspx_beginners@p...>
>To: "aspx_beginners" <aspx_beginners@p...>
>Subject: [aspx_beginners] Binding Servers Control To An ArrayList
>Date: Tue, 16 Apr 2002 10:34:08
>
>Hello,
>
>I have a problem with the ArrayList I am working on as an example. The
>return reply is that:
>
>"Control 'myDropDownList' of type 'DropDownList' must be placed inside a
>form tag with runat=server."
>
>I have placed the tag as mentioned but yet the returned as the above:
>
>______________________________ Source code __________________
>
><%@ Page Language="VB" %>
>
><script language="vb" runat="server">
> Sub Page_Load(sender As Object, e As EventArgs)
> Dim al As New ArrayList
> al.Add("Item 1")
> al.Add("Item 2")
> al.Add("Item 3")
> al.Add("Item 4")
> al.Add("Item 5")
> myDropDownList.DataSource = al
> Page.DataBind()
> End Sub
></script>
><html>
><head>
><title>Sample Text</title>
></head>
><body>
> <p>
> <b>Binding to a DropDownList</b><br>
> <asp:DropDownList id="myDropDownList" runat="server" />
> </p>
></body>
></html>
>
>_______________________________end code _______________________
_________________________________________________________________
Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se
|
|
 |