SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Need help creating a ~300-item web survey

    I'm building my first real C# project, and need just a little guidance about the best way to do it. The website is pretty simple, pretty much just a few static pages, but one is going to be a nearly 300-item survey of the activities a person enjoys. The data will be stored in a table (massive one, I know), and I'll perform different statistical analyses on it as I accumulate a large enough sample size.

    The survey is set up in four columns:

    -Name of the activity
    -A dropdown box populated with a few choices regarding their level of experience
    -A dropdown box populated with a few choices about their level of interest in the activity
    -A small input box for comments & additional explanation of their answers for each activity.

    As it stands now, I have 45 items set up, and the page is SLOW (both on my computer and in the browser), and bloated. There HAS to be a more efficient way to do it. I'm thinking about generating the form on the fly (because I have the activities loaded into a database table), but don't really know where to start, because I want to be able to easily store all the data in another table record that's created upon submitting the form.

    Here are my questions:

    -Should I go ahead and hard-code 300 items on the form? That would make my page massive, make it very difficult to find the corresponding dropdown & input boxes for my answers when I go to store the form, and it seems like it'd be difficult to change if I wanted to modify my page structure later.
    -Should I break up the form into multiple pages? That may help the loading times and page sizes, but I have the form broken up by section into a sweet jQuery accordion that works well.
    -Is there an even more efficient way to do this? There probably is, but I just don't have enough experience to know.
    -Is a database table with over 600 columns poor database design? I haven't read anything stating that it's too big, but I can't think of any other way to store the data the way I want to.

    I don't mind reading tutorials and books (perhaps I should pick up a LINQ & SQL book?), and am not expecting a long, detailed response. Any quick tidbits to point me in the right direction would be MASSIVELY appreciated.

    Thanks so much in advance!

  2. #2
    SitePoint Zealot
    Join Date
    May 2008
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Personally, I try to avoid hard coding items whenever possible and would definitely recommend breaking the quiz up and not showing the entire 300 questions on one page. This is both for size/speed concerns and also the sanity of your readers. Instead, having several pages and saving the results after each page, for those who do not finish.

    With that said, 300 questions seems like a tad much, bordering on unrealistic. I can't imagine many people sitting through it, unless they are your friends/family or they get some sort of benefit from it.
    Stair Lifts & Residential Dumbwaiters, source of health news

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2009
    Location
    England
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I've come up with a few ideas, most of them involve lots more code for small amount of speed increase, but this one, if I can explain it correctly, will I believe give you the fastest bang for your bucks.

    Presumptions:
    1. You don't mind your questions being hardcoded.
    2. Happy to write lots of javascript, really lots of it.
    3. Slowing down rendering time on the clients.

    If your happy with the above presumptions, here goes with my crummy attempt number one of an explanation

    1. Make a javascript file, which has the questions hard coded into an javascript array.

    2. Write more javascript that when the page loads creates your sweet jQuery accordion on the client with the questions from the javascript array.

    3. For speed, make the javascript expire after 24 hours. Minify the javascript file and even compress the file to deflate.

    4. For postback, your need some way to attach the input each user does, with a hidden asp field that is sent back to the server. You'll have to hand craft this with your own javascript.

    This should reduce your load on the server, though obviously passing the workload over to each client.
    Last edited by SirKilljoy; Mar 25, 2009 at 10:17.

  4. #4
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the responses SirKillJoy and HeathMan. I'll try to respond & elaborate.

    There are actually about 250, not 300 (my bad), and it's simply a list of activities of all different kinds that won't change much, if at all ever. The user will see a one- or two-word activity, click a couple checkboxes, and move on to the next. The comments section is not necessary, and I don't expect many responses in it, so I may even eliminate it all together to help speed things up.

    Someone else recommended a MultiView control, and I've never heard of it, but I'll definitely check into it. It seems like it could be a good solution. I've also thought of using a tabstrip or something with an UpdatePanel in it that would call either hardcoded pages (for each category) or dynamically generate the "questions" in that category on the fly. The questions aren't going to change much, if at all ever, so I don't need the most flexible solution out there.

    Perhaps there's a way I could accomplish some AJAX-like magic to load the questions (similar to my tabstrip idea) into my accordion I already have built? If at all possible, I'd REALLY like to have all the questions on one page, and loaded into the accordion since it fits perfectly. I could also just break up the items into a few pages and use accordions on each of them. Too many options...

    I'd also like to avoid writing a ton of JavaScript if necessary. My hands are already full learning the dotNET framework, C#, & SQL, so I don't know if I could cram any more new languages into my head. I'll still do some reading.

    Either way, I need to just play around with it and I appreciate any more comments.

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2009
    Location
    England
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Eck, don't wanna come across as a smart alex, but I did spend a few minutes thinking along the lines you've just written.

    Multi-view, tabs etc will not speed up your server, they will involve you learning new things. Main advantage is making the output pretty using standard asp controls. I'm not that cold to your idea of using a jQuery accordion, you say it already exists. I haven't seen it, but I've not heard you wish to replace it because you don't like it.

    Splitting your single page, into seperate pages. Well this seems obvious that it will speed things up, though the user will have to keep waiting for new pages to load.

    AJAX. This is the single best way of slowing down your server. I'll re-phase that; if its slow before, wait until you have it ajaxed. If you think people will only complete 1% of the quiz, then yes it might have an advantage.



    I'm trying to see if I can give an overview. You have to send some info to the client, you can :

    Send it as HTML
    Send it in Javascript
    Send it in Ajax
    Send it using XML and other fancy formats.

    HTML: Is currently heavy on your server, changing how the HTML is generated will have marginal effect, only reducing the amount of HTML sent will reduce server load.

    JavaScript: Re my first post

    Ajax: Always the prettiest, but slowest. Gives you a continuous communication channel with the user - if you need that.

    XML and other fancy formats: Possible, though I aint played with sending XML to a browser and asking it to render HTML from it, in years. Doesn't seem to be in vogue these days.

  6. #6
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SirKillJoy, I didn't take offense to it, just trying to understand your point of view. I seem to get the idea from your posts that my efforts are pretty much in vain at this point, and that whatever I try will be slow and horrible.

    Maybe that's true, but:
    1. I figure I'm not the only person who's ever tried to make a survey like this in dotNET. Seems like there would be a decent way to do a long survey.
    2. I've seen a very similar form online before in PHP and it is FAST. Is dotNET incredibly slow at this kind of thing? I figured that since this language is compiled, it would rival PHP's speed, but I may be misunderstanding something.
    3. If I split up the "questions" into multiple pages, there will be a significant speed increase that should make the load time bearable to a user and somewhat easier on my server.


    I'm at a standstill with my project at the moment, and welcome any more insight.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •