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

a little help please...

hey all,

i apologize for this repost, but can someone please help me with writing
some javascript for my radiobuttonlist control.

all i want to do is when the radiobuttonlist control is clicked is to
populate a texbox on the same webform with the value that was selected.

thanks,
rodchar
Nov 19 '05 #1
1 892
Here is a potential solution:

Copy this function to your page code:

Function CreateRBLSelectorScript(ByVal r As RadioButtonList, _
ByVal t As TextBox) As String
Dim js As String
js = "var c=document.getElementsByTagName('INPUT');" _
& "for(var i=0;i<c.length;i++)" _
& "{if ((c[i].name=='" & r.UniqueID & "')&&(c[i].checked))" _
& "{document.getElementById('" & t.UniqueID & "').value= " _
& "c[i].value}}"
Return js
End Function

In your page_load sub add this line:

rbl.Attributes.Add("onclick", Me.CreateRBLSelectorScript(rbl, txt))

Replace all "rbl" references with the variable for your radiobuttonlist
and replace all "txt" references with the variable for the destination
textbox.

Testing performed:
- Browsers: IE 6, Opera 8.5, and Mozilla 1.04
- RadiobuttonList Table and Flow layouts
- Single and multiple RadioButtonLists on a page
- Two RadioButtonLists pointing to one textbox
- Two RadioButtonLists pointing to their own textboxes

Hope this resolves a long-outstanding issue for all.
"=?Utf-8?B?cm9kY2hhcg==?=" <ro*****@discussions.microsoft.com> wrote in
news:A8**********************************@microsof t.com:
hey all,

i apologize for this repost, but can someone please help me with writing some javascript for my radiobuttonlist control.

all i want to do is when the radiobuttonlist control is clicked is to
populate a texbox on the same webform with the value that was selected.

thanks,
rodchar


Nov 19 '05 #2

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

Similar topics

2
by: rmn | last post by:
Hi, I'm looking for the translation betwen the color spaces, but I must be mistaken with the methods to use, losing the values. Please, I need a little help of a "coloured guru"....
3
by: Ron Stephens | last post by:
I posted to my web site a fun little program called merlin.py today. Please keep in mind that I am a hobbyist and this is just a little hack, if you look at the code you will see that it is still...
2
by: hicham | last post by:
Hi, I am looking for help, i would like to know how can i use the endian.h and config.h to convert compiled files under solaris from BIG-ENDIAN to compiled files LITTLE-ENDIAN. I am working...
2
by: Slash | last post by:
I often do a lot of text-mode programming in Linux and wanted to use colors in text mode, and found the ncurses library needlessly complex for small applications. So I wrote my own little header to...
8
by: Perception | last post by:
Hello all, If I have a C-like data structure such that struct Data { int a; //16-bit value char; //3 ASCII characters int b; //32-bit value int c; //24-bit value }
2
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP...
13
by: junky_fellow | last post by:
Hi guys, I need to convert a big endian integer to little endian integer. (the integer is 4 bytes in size on my implementation). I came up with the following code. I need your comments on...
3
by: ThaDoctor | last post by:
Hi. I am quite new to C++ so I think I would ask here what I am doing wrong with this code. I am writing a little game in a text console, but here is something that is in no way related to the...
23
by: Niranjan | last post by:
I have this program : void main() { int i=1; if((*(char*)&i)==1) printf("The machine is little endian."); else printf("The machine is big endian."); }
3
by: Ethan Furman | last post by:
len wrote: I've never had the (mis?)fortune to work with COBOL -- what are the files like? Fixed format, or something like a dBase III style? I
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: 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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.