Posts: 1
Location: Brisbane Australia
|
Hi I am trying to set the textbox.text from a databound list box. I am using asp.net VB script.
I can get it to work if i set the listbox items manualy but not when I use a dataset.
here is the code I use to manuly do it
<%@ Page Language="vb" ContentType="text/html" ResponseEncoding="iso-8859-1" %><!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">
<script runat="server">
Sub listbox1_SelectedIndexChanged(Sender as Object, E as EventArgs)
textbox1.Text = listbox1.SelectedValue
end sub
</script>
<html>
<head>
</head>
<p>
<form runat=server>
<asp:ListBox id=ListBox1 runat="server" Width="100px">
<asp:ListItem value="item1v">item1</asp:ListItem>
<asp:ListItem value="item2v">item2</asp:ListItem>
<asp:ListItem value="item3v">item3</asp:ListItem>
</asp:ListBox>
<p>
<asp:TextBox ID="TextBox1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Get Value" OnClick="listbox1_SelectedIndexChanged" />
</form>
</body>
</html>
|