473,325 Members | 2,805 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,325 software developers and data experts.

html or web control question


I want to have 2 mutually exclusive checkboxes on a webform. I do not want
to post back to server for this to happen.

Last week I built this using javascript with each ctrl calling a javascript
function on the page that automatically unchecked it's mate. I ran into
problems with this approach when I needed to pass the list of checked
checkboxes to the next webform for processing via some vb.net code.

Is there a way to load an arraylist or hashtable referencing these html
controls? Obviously this would be done on the server. ... I just don't know
how to reference these checkboxes from vb.net code on the server (or
otherwise) since they are html controls...

Is dumping this information into the url via javascript the only way?

If these checkboxes where webctrl checkboxes I could write code to load them
into a hashtable and pass them back via a session variable (demostrated in
Mark Ridgeway's book - VB.net developer's handbook)....but based on my small
understanding of things this would entail having each check cause a postback
to the server for unchecking it's mate (which seems like a really big waste
of time)....

Feedback appreciated...


Jan 30 '06 #1
5 1073
Use the Web Control. Every control has a Unique ClientID. If you have 2
checkboxes then you can attach Javascript code to each of the Checkboxes to
uncheck the other. All this can be done on the server side to execute client
side code. So when you do the actual postback you have the code.

Another method is to use HTML controls and add the Runat="Server" attribute
and write client side code, but not sure why you would want this in this
scenario.

Regards,

Trevor Benedict R
MCSD

"astro" <as***@bcmn.com> wrote in message
news:5x******************@tornado.rdc-kc.rr.com...

I want to have 2 mutually exclusive checkboxes on a webform. I do not
want to post back to server for this to happen.

Last week I built this using javascript with each ctrl calling a
javascript function on the page that automatically unchecked it's mate. I
ran into problems with this approach when I needed to pass the list of
checked checkboxes to the next webform for processing via some vb.net
code.

Is there a way to load an arraylist or hashtable referencing these html
controls? Obviously this would be done on the server. ... I just don't
know how to reference these checkboxes from vb.net code on the server (or
otherwise) since they are html controls...

Is dumping this information into the url via javascript the only way?

If these checkboxes where webctrl checkboxes I could write code to load
them into a hashtable and pass them back via a session variable
(demostrated in Mark Ridgeway's book - VB.net developer's handbook)....but
based on my small understanding of things this would entail having each
check cause a postback to the server for unchecking it's mate (which seems
like a really big waste of time)....

Feedback appreciated...

Jan 30 '06 #2
Hi,

astro wrote:
I want to have 2 mutually exclusive checkboxes on a webform. I do not want
to post back to server for this to happen.


Aren't two mutually exclusive checkboxes, per definition, radio buttons?

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 31 '06 #3
yes - but i like the look of checkboxes....

-)
"Laurent Bugnion" <ga*********@bluewin.ch> wrote in message
news:dr**********@zrha118x.zrh.siemens.ch...
Hi,

astro wrote:
I want to have 2 mutually exclusive checkboxes on a webform. I do not
want to post back to server for this to happen.


Aren't two mutually exclusive checkboxes, per definition, radio buttons?

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jan 31 '06 #4
Hi,

astro wrote:
yes - but i like the look of checkboxes....

-)


*L* That's an funny, though very much anti-ergonomic reason ;-)

I won't try to make you change your mind.

If you give more details about the way you create the controls, I can
show you how to have client-side JavaScript code to make them mutually
exclusive.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 31 '06 #5
>> yes - but i like the look of checkboxes....
-)


*L* That's an funny, though very much anti-ergonomic reason ;-)

I won't try to make you change your mind.


I will, as would anyone who has read up anything about user interfaces.

Changing the behaviour of any standard control is a very bad idea. Users
have come to expect certain behaviours from certain controls. If you
change this, you will confuse them. The chances are that they will not
bother fighting with your site, they will just give up and go elsewhere.

This is well researched and well known. It's not a piece of folklore.
You are running a serious risk of losing visitors for the sake of some
personal (and highly irregular) whim. What's the point?

End of rant ;-)

--
Alan Silver
(anything added below this line is nothing to do with me)
Feb 6 '06 #6

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

Similar topics

1
by: Ralph Krausse | last post by:
I know more html is needed to really produce this but enough is here for me to ask my question. So, this HTML code produce 2 buttons. One button is a HTML control and the other is ASP Web or Server...
4
by: ALESSANDRO Baraldi | last post by:
Good evening. Few day ago i ask about this Object. A very kindly replay of Sthepen Lebans give me the solution to use ClipBoard to synthesise the Conversion, but i've some truble. My scene: ...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
4
by: Chris | last post by:
Hello. I had a question that I was hoping someone might be able to answer. I have an ASP .NET Web Form with a custom control that generates HTML based on certain criteria. This control is...
3
by: mca | last post by:
Hi everyone, I'm new to asp.net and i have a question about separating the html code from the programming code. i have an unknown numbers of entries in my table. I want to make a hyperlink...
4
by: clintonG | last post by:
Technically speaking, this issue is not about modifying the HTML generated by server controls but preceding the HTML generated by server controls with an HTML control generated on the basis of the...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
5
by: Andrew | last post by:
Hi, friends, In ASP, we use obj = CreateObject("com.dll") obj.GetHTMLText(inVal, outHTMLTxt1, outHTMLTxt2) to get different HTML strings based on input values. Then, we insert them into...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
2
by: Bob | last post by:
Hi, in aspx file, i defined this: <input id="Button2" type="button" value="button" runat="server" onclick="klik()"/> This 'onclick' event is a clientclick (starting the Javascript function...
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...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.