I have a contact form that a person submits to the server.
In ASP, you'd make a page, post the form to another page, which would grab
the values and do somethign with them.
in ASP.NET, it appears that you grab the values directly from the form
objects on the postback.
Here's our problem:
We wanted to make a list of radiobutton options. Unfortunately, .net's
datalist and radioButtonGroup controls produce invalid HTML if you want to
format it in columns and you don't have enough record to populate every
column of every row of the table. So, to remedy this, I am building the HTML
for this list of radio buttons on the codebehind page and passing it to the
aspx page as text for a label.
The problem is that the person that is grabbing the data from the form to
submit it to the database and email can't 'grab' the value of these
radioButtons since they don't 'exist' on the ASPX page until the page is
processed on the server.
Is there a way around this? We're thinking that perhaps we can add a
radioButton to the aspx page in a hidden panel, which will allow the
codebehind to 'see' the radioButotn prior to page rendering. Then, when the
page does render, the radioButtons that do appear can override the value of
the hidden default one. Of course, this seems like a giant hack to me. ;o)
-Darrel 4 1378
Hi darrell, the hidden default one. Of course, this seems like a giant hack to me. ;o)
The whole thing IS a giant hack. Unfortunately, and I can certainly
sympathize with you in regards to this situation, but you will need to
understand ASP.Net's programming model a good bit better before you can
really make use of it effectively. For example, instead of using a
RadioButtonGroup for radio buttons, you could certainly use individual
RadioButton Controls in your page.
The rub here, is, of course, you have to produce a product. But it would be
better in the long run if you got to know this much bigger than ASP
programming model before you try to implement it in production. If you're in
a bind, you can access any form field data posted by the client in the
Request.Form collection, regardless of whether the client-side HTML elements
are connected to CodeBehind Controls or not.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"darrel" <no*****@hotmail.com> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl... I have a contact form that a person submits to the server.
In ASP, you'd make a page, post the form to another page, which would grab the values and do somethign with them.
in ASP.NET, it appears that you grab the values directly from the form objects on the postback.
Here's our problem:
We wanted to make a list of radiobutton options. Unfortunately, .net's datalist and radioButtonGroup controls produce invalid HTML if you want to format it in columns and you don't have enough record to populate every column of every row of the table. So, to remedy this, I am building the
HTML for this list of radio buttons on the codebehind page and passing it to
the aspx page as text for a label.
The problem is that the person that is grabbing the data from the form to submit it to the database and email can't 'grab' the value of these radioButtons since they don't 'exist' on the ASPX page until the page is processed on the server.
Is there a way around this? We're thinking that perhaps we can add a radioButton to the aspx page in a hidden panel, which will allow the codebehind to 'see' the radioButotn prior to page rendering. Then, when
the page does render, the radioButtons that do appear can override the value
of the hidden default one. Of course, this seems like a giant hack to me. ;o)
-Darrel
> For example, instead of using a RadioButtonGroup for radio buttons, you could certainly use individual RadioButton Controls in your page.
Well, as you said, I need to produce real product based on what I know. I'm
always up to learning more though!
So, conceptually, what would the solution be if I were to use individual
RadioButton Controls?
Here's what I'm doing:
Grabbing a set of records from a table.
Assigning each record to a radioButton.
Rendering it on the page.
If you're in a bind, you can access any form field data posted by the client in the Request.Form collection, regardless of whether the client-side HTML
elements are connected to CodeBehind Controls or not.
That's good to know. What is the disadvantage of using this? I'm all for
doing things the 'right way--the .net way' but sometimes the .net way seems
counter-intuitive, or just plain verbose for web development. I know part of
that is just making the mental leap from interpreted code to OOP but there
are times when classic ASP and ASP.NET seem to be at polar opposites of the
web development methodology spectrum when, in the real world, there seems to
be a need for that middle-ground.
-Darrel
> So, conceptually, what would the solution be if I were to use individual RadioButton Controls?
HTML Radio Buttons are grouped by their name attribute. When several Radio
buttons have the same name, they belong to the same group. The form will
post only ONE value for the entire group, whichever Radio button that is
checked. In the RadioButton WebControl, the GroupName property determines
the name attribute of the RadioButton when rendered on the client. I
wouldn't set them to AutoPostBack, but when the PostBack occurs you could
certainly check their Checked properties. Only one will be true.
That's good to know. What is the disadvantage of using this? I'm all for doing things the 'right way--the .net way' but sometimes the .net way
seems counter-intuitive, or just plain verbose for web development. I know part
of that is just making the mental leap from interpreted code to OOP but there are times when classic ASP and ASP.NET seem to be at polar opposites of
the web development methodology spectrum when, in the real world, there seems
to be a need for that middle-ground.
Good question, Darrel. There are a good number of reasons why the ASP.Net
programming model was designed the way it was. HTTP is stateless, which
means that, in ASP, you had to build your own routines for maintaining state
in your ASP pages. ASP.Net has state management built right into it. ASP was
a bit too relaxed in its rules, making for some serious spaghetti code out
there (I've had to untangle a good bit of it in the past myself). ASP.Net is
more rigidly structured by nature, and tends to force the developer to
separate presentation code and business logic, which is a very good thing
when it comes to code maintenance. Object-oriented programming is by nature
much better overall than procedural, for quite a few reasons.
As for being "counter-intuitive," that's just a matter of time and practice.
Once you "get it" it becomes entirely intuitive.
Good luck!
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"darrel" <no*****@hotmail.com> wrote in message
news:eE**************@TK2MSFTNGP10.phx.gbl... For example, instead of using a RadioButtonGroup for radio buttons, you could certainly use individual RadioButton Controls in your page.
Well, as you said, I need to produce real product based on what I know.
I'm always up to learning more though!
So, conceptually, what would the solution be if I were to use individual RadioButton Controls?
Here's what I'm doing:
Grabbing a set of records from a table. Assigning each record to a radioButton. Rendering it on the page.
If you're in a bind, you can access any form field data posted by the client in the Request.Form collection, regardless of whether the client-side HTML elements are connected to CodeBehind Controls or not.
That's good to know. What is the disadvantage of using this? I'm all for doing things the 'right way--the .net way' but sometimes the .net way
seems counter-intuitive, or just plain verbose for web development. I know part
of that is just making the mental leap from interpreted code to OOP but there are times when classic ASP and ASP.NET seem to be at polar opposites of
the web development methodology spectrum when, in the real world, there seems
to be a need for that middle-ground.
-Darrel
HTML Radio Buttons are grouped by their name attribute. When several Radio buttons have the same name, they belong to the same group. The form will post only ONE value for the entire group, whichever Radio button that is checked. In the RadioButton WebControl, the GroupName property determines the name attribute of the RadioButton when rendered on the client. I wouldn't set them to AutoPostBack, but when the PostBack occurs you could certainly check their Checked properties. Only one will be true.
Oh...right...I know all of that. That is what I'm doing. I'm making my own
set of radio buttons with the same name in the codebehind and then spitting
it out to the aspx page as text for a label.
The issue is that I can't use the built in controls for RadioButtonLists
since .net spits out invalid HTML when it makes a multi-column table. As
such, the codebehind doesn't see the object , since the object is just a
label that has standard HTML assigned to it in the codebehind.
ASP.Net is more rigidly structured by nature, and tends to force the developer to separate presentation code and business logic, which is a very good thing
Well, I agree that conceptually it is a good thing, but I'm also finding
that you can't allow .net to make your presentation for you. It's bad at it.
It tends to make bloated, innaccessible and oft-times invalid markup. Hence,
I'm finding that I end up using a lot of repeater controls (which is still
good) but then at times having to move my presentation back to the
codebehind side so I can build it myself.
I'm sure part of that is me not fully understanding all there is to know
about .net, but there also seems to be clear concensus that .net has a long
way to go before developers fully trust it to handle the presentation side
for us.
As for being "counter-intuitive," that's just a matter of time and
practice. Once you "get it" it becomes entirely intuitive.
I'm getting there. Thanks for the help!
-Darrel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dani |
last post by:
Hello everybody,
I have some code that disables form elements on body load, but I notice
when I hit the "back" button, I need to re-enable the form elements
(that is done by clicking on a radial...
|
by: William Wisnieski |
last post by:
Hello Everyone,
Access 2000
I have a main form with a continuous subform. On the main form I have a
text box that references a field on the subform. What I'd like it to do is
show the value...
|
by: Zlatko Matić |
last post by:
There is a form (single form) and a combobox. I want that current record of
the form is adjusted according to selected value in the combobox. Cuurrent
record should be the same as the value in the...
|
by: Baz |
last post by:
Hi.
I'm new to this VB.Net mullarkey, and I must say it is proving to be a very
trying experience. Here is the latest in a long line of problems:
The Scenario
=========
I am building an...
|
by: Kermit Piper |
last post by:
Hello,
OK, almost there. Here's what I have so far, which handles characters
as they're typed in. Could someone please show me how I would loop
through all the values that are entered if a block...
| |
by: Rik |
last post by:
Hello guys,
now that I'm that I'm working on my first major 'open' forms (with
uncontrolled users I mean, not a secure backend-interface), I'd like to add
a lot of possibilities to check wether...
|
by: ozTinker |
last post by:
I'm sure this shouldn't be too difficult, but I lack familiarity with the MS object model.
Suppose I have a table "Purchase_Orders" and a form "TEMP" which I am using to look up a customer's...
|
by: bsturg21 |
last post by:
Hello,
I have a windows form that has a series of linklabels on it, and I
need to have each linklabel, when clicked, open a separate windows
form that has a single paramter passed into it. The...
|
by: Norman |
last post by:
I am trying to find a way to implement something like:
<FORM name='form1'><TABLE>
server scripting loop (php), generates X (a variable number) lines
with the 3 fields {
<TR><TD><input...
|
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...
|
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,...
| |
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |