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

very urgent...

I have a form in which there are two types of control a) asp.net (3
radio button) b) html control (textbox).
On everytime page is load (postback or withoupostback) i want my code
to check which radio button is checked. If any of the first two radio
button is checked i want to set textbox value as "t" and in case 3rd
radio button is checked i want to set textbox value as "f"

This thing is not working :
if(radio1.checked==true)
textbox.text="t"

because textbox is an html control and not an asp.net control.....can
anybody tell me how to solve this issue???

Aug 11 '06 #1
3 1120
I think you can do this by javascript in client side code.
try writing the code inside <FORMor make this as a function and call it
from Form_Onload.

<script language="Javascript>
if (form.getelimentid('radio1').checked == true ||
form.getelimentid('radio2').checked == true)
textboxt.text = 't';
else
textboxt.text = 'f';
endif
</script>

HTH
Bipin

<DIV>&quot;saurabh&quot; &lt;sa********@gmail.com&gt; wrote in message
news:11**********************@74g2000cwt.googlegro ups.com...</DIV>>I have a
form in which there are two types of control a) asp.net (3
radio button) b) html control (textbox).
On everytime page is load (postback or withoupostback) i want my code
to check which radio button is checked. If any of the first two radio
button is checked i want to set textbox value as "t" and in case 3rd
radio button is checked i want to set textbox value as "f"

This thing is not working :
if(radio1.checked==true)
textbox.text="t"

because textbox is an html control and not an asp.net control.....can
anybody tell me how to solve this issue???
Aug 11 '06 #2
Bipin napisał(a):
I think you can do this by javascript in client side code.
try writing the code inside <FORMor make this as a function and call
it from Form_Onload.

<script language="Javascript>
if (form.getelimentid('radio1').checked == true ||
form.getelimentid('radio2').checked == true)
textboxt.text = 't';
else
textboxt.text = 'f';
endif
</script>
this code doesn't seems to work.

You can do what you want to in two ways:
1) on the client-side (with javascript):
use "document.getElementById('radio1').checked" instead of
"form.getelimentid('radio1').checked"

2) on the server-side :
First you must convert textbox (actually html input element) into a
html server control. Just add to this element runat="server" and id
attributes.
Second - write event handler for radioButton event that will set
textBox's Text property.

--
PP
Aug 12 '06 #3
Hey still didnt get the solution...even this thing is not working...
getting the error "object required" at the line
"if(document.getElementById('rbupdated').checked== true ||
document.getElementById('rbmostused')==true)"....
It seems it is not able to identify the radio button rbupdated...also
it seems "checked" property is not thr, because whn i pressed
ctr+space baar after ('rbupdated') , I didnt get "checked " in the
list of available properties
Przemek Ptasznik wrote:
Bipin napisal(a):
I think you can do this by javascript in client side code.
try writing the code inside <FORMor make this as a function and call
it from Form_Onload.

<script language="Javascript>
if (form.getelimentid('radio1').checked == true ||
form.getelimentid('radio2').checked == true)
textboxt.text = 't';
else
textboxt.text = 'f';
endif
</script>

this code doesn't seems to work.

You can do what you want to in two ways:
1) on the client-side (with javascript):
use "document.getElementById('radio1').checked" instead of
"form.getelimentid('radio1').checked"

2) on the server-side :
First you must convert textbox (actually html input element) into a
html server control. Just add to this element runat="server" and id
attributes.
Second - write event handler for radioButton event that will set
textBox's Text property.

--
PP
Aug 13 '06 #4

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

Similar topics

1
by: samir dsf | last post by:
hi this is kinda urgent ... i will insert some data in html format..i just need to know how to disply it back.its urgent...so if anyone can suggest pls tell me i simply need to know that if i...
33
by: dembla | last post by:
Hey Frnds can anyone help me in this i need a program in 'c' PROGRAM to print NxN Matrix 9 1 8 1 2 3 2 7 3 as 4 5 6 6 4 5 7 8 9 in sorted form
4
by: archana | last post by:
Hi all, I am having one confusion regarding invoking web method of web service asychronously through windows applicaiton. What i am doing is i am having one long runing web method whose one...
1
by: alok sengar | last post by:
hi, I have already tried this URL's code "http://www.java2s.com/Code/CSharp/Network/SimpleSNMP.htm" but I am getting error when i am creating a UDP type Socket and recieving packet from this...
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from...
1
by: sohail28 | last post by:
Respected Sir, I try to connect my DB which is present in my hosting server control panel using Dreamweaver MX 2004. Everything is going fine, except while testing connection configuration, its...
3
by: settyv | last post by:
Hi, I need to generate PDF stream when i click on Linkbutton in datagrid ..At present i hardcoded the DMS Id and now it is working.But i need to pass DMS ID when click linkbutton.How can i do...
1
by: rajesh.us.it.recruiter | last post by:
Hi Guys/Partners, We have a URGENT Requirement for Perl Programmer with H1 visa in India/US for one of our prestigious Client. Location : New Jersey Requirements : Should be very strong in...
6
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
9
by: uppili4chi | last post by:
Good morning my dear friends, I am uppili from India. i am working in one mnc. I need a help very urgent. "My problem i need to write a program for search a file just like search option at...
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...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.