473,383 Members | 1,880 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,383 software developers and data experts.

anyway to do this without post back to server

Hi I have a dropdown box with entries like

AY Activity Yellow
AB Activity Blue
AR Activity Red

This dropdown is followed by two text boxes and when the user selects AY I
would like to display the following in the text boxes

txbx1 [AY] txbx2 [Activity Yellow]
for AB Activity Blue
txbx1 [AB] txbx2 [Activity Blue]
So I am just spliting the string and displaying portions in each text box.
I was just wondering if there is a way to do this without posting back the
server on the dropdown SelectedIndexChanged event?
Thanks

--
Paul G
Software engineer.
Jun 27 '08 #1
2 784
yes, its simple javascript.

<script>
function doDropChange(e)
{
var txt1 = document.getElementById('<%=txt1.ClientID%>');
var txt2 = document.getElementById('<%=txt2.ClientID%>');
txt1.value = e.value.substr(0,2);
txt2.value = e.value.substr(3);
}
</script>

then in codebehind:

myDropDowm.Attributes["onchange"] = "doDropChange(this)";
-- bruce (sqlwork.com)
"Paul" wrote:
Hi I have a dropdown box with entries like

AY Activity Yellow
AB Activity Blue
AR Activity Red

This dropdown is followed by two text boxes and when the user selects AY I
would like to display the following in the text boxes

txbx1 [AY] txbx2 [Activity Yellow]
for AB Activity Blue
txbx1 [AB] txbx2 [Activity Blue]
So I am just spliting the string and displaying portions in each text box.
I was just wondering if there is a way to do this without posting back the
server on the dropdown SelectedIndexChanged event?
Thanks

--
Paul G
Software engineer.
Jun 27 '08 #2
Thanks it works. For the code behind I used
if (!Page.IsPostBack)
{
this.dropdown.Attributes["onchange"] = "doDropChange(this)";
}
--
Paul G
Software engineer.
"bruce barker" wrote:
yes, its simple javascript.

<script>
function doDropChange(e)
{
var txt1 = document.getElementById('<%=txt1.ClientID%>');
var txt2 = document.getElementById('<%=txt2.ClientID%>');
txt1.value = e.value.substr(0,2);
txt2.value = e.value.substr(3);
}
</script>

then in codebehind:

myDropDowm.Attributes["onchange"] = "doDropChange(this)";
-- bruce (sqlwork.com)
"Paul" wrote:
Hi I have a dropdown box with entries like

AY Activity Yellow
AB Activity Blue
AR Activity Red

This dropdown is followed by two text boxes and when the user selects AY I
would like to display the following in the text boxes

txbx1 [AY] txbx2 [Activity Yellow]
for AB Activity Blue
txbx1 [AB] txbx2 [Activity Blue]
So I am just spliting the string and displaying portions in each text box.
I was just wondering if there is a way to do this without posting back the
server on the dropdown SelectedIndexChanged event?
Thanks

--
Paul G
Software engineer.
Jun 27 '08 #3

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

Similar topics

3
by: Troy | last post by:
Hello- I have a website that uses a custom built webserver to serve the pages. (Please don't ask me why my boss had his own web server written). I am displaying a log of information that is an...
3
by: Alex | last post by:
Hi!! i have a major problem, and i've been searching for a solution for about 2 weeks, but havent found one. i have to do a POST-Request to a server, but the server shouldnt know my referrer....
3
by: Richard | last post by:
Hey there, I have a textbox and a listbox. When a user types a number in the textbox, I want to get all the records from a MS Access DB but without reloading the page. I now have something...
2
by: Keshav Gadia | last post by:
Hi, I am an ASP.net newbie. I am writing a user control that is made up of datagrid with one of the columns opening a new window to display some details on click of the set image. I have...
5
by: Vishal | last post by:
Hello, I already asked this question in the ASP.NET forums, but no help came. So I am hoping that somebody can help me out. This is really very URGENT me. For my e-commerce application, I...
9
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
4
by: dkode | last post by:
Hello, The webhost that I have my asp.net website with does not allow me to change the ISAPI handler for IIS, I am wondering if there is a way to accomplish this without modifying the ISAPI...
4
by: SammyBar | last post by:
Hi all, I wonder is it possible to upload the content of an <imgfield to a server. The content of the <imgwas downloaded from a web site different from the one it should be uploaded. The image...
19
by: klenwell | last post by:
Another request for comments here. I'd like to accomplish something like the scheme outlined at this page here: http://tinyurl.com/3dtcdr In a nutshell, the form uses javascript to hash...
0
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a dropdown box with entries like AY Activity Yellow AB Activity Blue AR Activity Red This dropdown is followed by two text boxes and when the user selects AY I would like to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.