Reply
settingtextbox.text from a listbox
Old 06-06-2005, 02:36 AM settingtextbox.text from a listbox
Junior Talker

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>
keithjakins is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Reply     « Reply to settingtextbox.text from a listbox
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11255 seconds with 13 queries