user input forms with user defined fields - asp.net

Ive been tasked with creating a user input form that has a set of defined fields and the ability for the user to add their own fields on the fly. e.g textbox, select box with options etc etc. Has anyone got any ideas on how i could implement this. What do i need to consider?
Also How would i store the data as i wont know the amount of fields. Generally in past projects a field in the input form has mapped to a column in the database.
Any ideas
Thanks in advance

It will need to be stored in a denormalised fashion:
QuestionField
AnswerField
So you'll probably need a Questions table which defines the question and maybe the type of input and any contraints.
You'll then have an answers table which is linked to whatever your entity is. The answers table will have an question and an answer field.

Do your users log into your site? If so you could use a SQL table to store each users controls e.g. :
UserName ControlID ControlType
JohnSmith 1 TextBox
JohnSmith 2 CheckBox
JoeBlogs 3 TextBox
You can then have another table with each controls value within it:
ControlID Value
1 My Text Value
2 False
3 Hi I’m Joe
You can then just do a simple join to get all the users controls and there values. You can also store information such as location/index of the control on screen. Doing it this way you can add more than one value per control, meaning things like list box's will have multipul rows.
If your not using a log in system you could do the same sort of thing but using Cookies.

Related

Selecting Sql Data Source Column Value to Variable (VB.NET)

I have a SqlDataSource, defined in the Master Page, that gets the current user permissions for the web application Select * from portal_users where userid = #userid, where portal_users is a view i built with all the data needed. I need to access the contents on the returned row so I can disable/enable site features according to the user permissions. This results in a lot of if blocks across the child pages to do it.
I browsed around forums and I only found issues about assigning those values to controls like i.e. label. Is there a way to access the SqlDataSource from the Master Page, get the row that is returned, select 1 or more column's values and assign them to variables?
Hy
It's not a good idea, use Master Page to share Data Source connections
Read this post to help you:
http://forums.asp.net/t/1188088.aspx?sql+data+source+in+Master+Page
Regards

How to store user responses on-the-fly temporarily for later use?

I am looking for the best way to store information that is entered within an Oracle ApEx app that is sectioned off like a wizard.
Basically there are a number of fields on the screen, i.e. text box, text area, select list, checkboxes as well as radiogroup buttons but are not attached to any particular database tables.
What I would like to do is basically have the user enter required answers say on one pane, which might have 5 items in total, i.e., 2 textfields, 1 radiogroup, 1 selectlist and 1 checkbox and when they press the "Next>" button before going to the next pane, store these answers into a ApEx Collection against a particular Id and perform the same process on the following pane of answers entered.
I am using Oracle ApEx 4.1.2. Basically want to store away values on the fly and reuse at a later stage.
As I mentioned in my last comment above, Plouf came through with the goods. I didn't require an ApEx Collection after all - regular items did the trick.

How to create a form with variable no. of field set

I have to design a page for user information, for some background verification purpose, at my work. I need a set of fields for address, total count of which will be selected by user to update the form with that many fields. So, if user selects 3, form will have 3 set of address fields. Similar concept for work and education details.
Right now, I am passing the count to a handler page, which checks total count, and return it along with querystring, back to the main page. I am able to update the no. of fields, this way, but, all values are lost, once I return to the form. There are a lot of fields to even use session object for every value. Also, it resets the count of other such field set to 0. So, if I select 4 in address field, it renders four set of address fields, but fields for other details are gone.
I need to know, if it is possible to update the fields, using just one page, instead of creating a handler file to handle the redirect, so that I don't lose other data.
Sorry, for sounding a bit confusing. Will update the question, if needed.
Edit:
Similar blocks are there for education and work details. I want the update button to update the block, with that many fields, while retaining the values already entered by the user.
I have finally shifted the update code to one page. And the total count of blocks, is calculated by this way.
if request.form("addresscount") <> "" then
varaddresscount = request.form("addresscount")
else
varaddresscount = 1
end if
varaddresscount is used to loop through the html code which renders address fields. Even with this method, if I click on update button to change the total field count, every value entered by user is reset to default. Is there a way to retain the no. of fields without using session object, as there are way too many fields for which I have to store the value in session.
Why not have just a "add address" button that, whenever clicked, adds a extra set of input boxes using Javascript? That solves a lot of your problems regarding retaining the data on already filled in fields AND it makes it easier for the user.

Help learning asp.net

I am currently building an asp.net application. Its supposed to be pretty simple.
The problem is, I've only experience with asp.net mvc and for this app I'm limited to .net 2.0 so no mvc.
The only requirement is this.
I have a table of about 2000 records with these columns:
Id, Code1(unique), Code2(unique), Name, LastName, Email.
The table is already populated with Id, Code1, Code2.
Now, the idea is that when someone looks up their record (through Code1 or Code2) they are able to fill the rest of the fields (Name, LastName, Email).
So, search -> if no email, name, lastname set =>edit=>display
What do I need? please help.
I have tried Details View but Im not sure how to allow edit only if the email field is blank.
Do I need something else?
I think the easiest way to go is the following:
2 textboxes, 1 button (Search), 1 GridView, 1 SqlDataSource.
Gridview should be hooked up to SqlDataSource, which in turn should take 2 parameters (textbox values)
use textboxes for searching, on Search click, GridView.DataBind()
Make sure your SqlDataSource has the Update command specified
Check out ASP.NET Data tutorials for more info, got to Step 3 in this tutorial for GridView Updating help.
You'd be able to edit 1 record at a time, I wish I could give you more details on setting up the Gridview for automatic Updates, but it's been a while since I've worked with it (Google should help you with this though).

How do I use the ASP.NET grid view to instert new records?

Using the ASP.NET grid view. It displays 3 columns with 1 row for each, displaying an integer saved in the database. I would like to have a text input one for each column, so the user can add a new row of integers to the database. (The table only displays the last row updated, that part seems to be working OK)
Here is the code I have that displays data but without the input option I would like.
What is the way this is done in ASP.NET (3.5)? Are there more options in the control or do I need to manually bring in text input controls and give each one manual code to update the database? Any help is appreciated.
Thank You.
Do you know the asp.net website? There are a lot of tutorials, e.g. about data access. You might find the information you need, e.g An Overview of Inserting, Updating, and Deleting Data.
Also check out the ASP.NET Dynamic Data section on the same page.

Resources