473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

javascript for putting text in an asp.net edit control

I have a list box that I am populating (not via
databinding) from some tables from my SQL database. I
also have a TEXT BOX on the screen.

I want to display whatever the user clicks on the list
box on the edit box. I know I can do it by setting the
AUTOPOSTBACK property of the list box to TRUE and by
writing code to assign the .TEXT property of the edit box
to the selected item in the list box. But I want to avoid
the server round trip time.

Can someone give me the javascript equivalent statement?
I am new to javascript, so I would like to know the
complete statement as I should put it in my code-behind
(which is why i thought posting to this message to this
newsgroup rather than a javascript newsgroup).

Response.Write (something something something?)

Thanks...
Nov 17 '05 #1
1 1341
Hi,

Read up about using IsClientScriptRegistered and RegisterClientScript - You
will need to use these otherwise you will have to hardcode the javascript
into the page, and that can cause issues if you start using user controls
and the like.

- You will need to create a function for the Client-Side onclick event of
the listbox
- You will also need to add an attribute to the listbox so that it
recognises the OnClick event

Use lstBox.Attributes.Add("OnClick", "lstBoxClickfunction()")

the javascript functoin would look something like the following
function lstBoxClickfunction(){

i = document.getElementById("lstBox").selectedIndex

document.getElementById("txtBox").value =
document.getElementById("lstBox").options[i].value

}

email me if there are any issues
"Michelle Stone" <mi********@yahoo.com> wrote in message
news:0a****************************@phx.gbl...
I have a list box that I am populating (not via
databinding) from some tables from my SQL database. I
also have a TEXT BOX on the screen.

I want to display whatever the user clicks on the list
box on the edit box. I know I can do it by setting the
AUTOPOSTBACK property of the list box to TRUE and by
writing code to assign the .TEXT property of the edit box
to the selected item in the list box. But I want to avoid
the server round trip time.

Can someone give me the javascript equivalent statement?
I am new to javascript, so I would like to know the
complete statement as I should put it in my code-behind
(which is why i thought posting to this message to this
newsgroup rather than a javascript newsgroup).

Response.Write (something something something?)

Thanks...

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
5
by: | last post by:
Hi all, Has anyone been able to write some custom javascript on the onclick event of submit button to do certain things like disable submit button, only submit form once etc. This was a breeze...
4
by: Brie_Manakul | last post by:
I need to set up an if else to show different weather scripts based on the city selection they choose. Any help on this would be great. Thanks! <%@ page language="java" import="java.util.*,...
8
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
0
by: kegs01 | last post by:
I am using a JavaScript DHTML Calendar cotrol in the Edit Template of a Grid View, and I'm having trouble getting the setup code to fire properly. I have tried adding the JavaScript using...
5
by: Alex Maghen | last post by:
I frequently find myself wanting to insert some basic client-side JavaScript functions in the page of an ASPX of mine. But I find it so frustrating that I have to actually contruct my JavaScript in...
4
by: tfsmag | last post by:
Okay, I have a project management app i'm writing and in the left hand menu i have a treeview control that is populated with each project... in child nodes under each project node I have an "edit"...
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
16
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.