Concatenating asp server controls

A

Ani

I have a questionaire page , which basically has questions
with multiple choice answers. I need to accomplish paging
on this and there are few questions that are gender
specific. According the person who has logged in, if the
person is male, i need to generate only those questions
specific to males . I have a function that returns the
contents of the questionaire in the form of a datatable. I
have successfully displayed all the questions .
Next part of my work is to get all the user input and dump
into a table. Now the datatable in part loads just the
questions and I'm calling a function in my UI page that in
turn calls a function in my class to load all the multiple
choice answers. So, basically the questions and multiple
choice answers are being displayed from two different
functions. Since the multiple choice answers need to be
loaded dynamically, I have used string concatenation for
the radio buttons and checkboxs. I am using asp server
controls like <asp:radiobuttonlist> in the string
concatenation. The function returns the values for the
controls , but not the radio buttons. Is it that I cannot
return the controls in the form of a string and write the
string in my UI page? My code on the whole looks very
messy. I am new to .Net and I need to get the work done
asap. I need to get the form validation done and insert
the user input into a table. I do not want to use asp form
validation controls, as I need to alert the user using
message boxes. I would like to do this using vbscript or
javascript.
Could someone give suggestions on how to accomplish the
task in a better way and explain why I am not able to
write asp server controls on to the page when they are
returned as a string.
 
K

Kevin Spencer

First, concatentaing a string of HTML is not the way to go, as it is the
farthest thing from object-orientation that you could do. Use Controls, and
dynamically load them if you need to.

In addition, the ASP.Net Form validation Controls are highly configurable,
and can do your validation all on the client side using alert boxes if you
configure them to, so you might want to revisit that idea as well.

In the meantime, if you have a short deadline, you might want to go with ASP
until you get your head around the way ASP.Net is designed to work. It
sounds like you've got quite a learning curve ahead of you before you'll be
doing much of anything ASAP with ASP.Net. You've got to get used to doing
things in an object-oriented fashion. It gets easier from there.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,129
Latest member
FastBurnketo
Top