Web Forms :: Dynamically Add More Fields
Sep 27, 2010
I have seen it on here or while googling, but never had a need for it with any projects, now i have a form that has 32 fields, PLUS up to 32 other possible fields.. Not sure how to go about this.. i dont think that having a form with 64 fields is the best solution as you may just need the first 32, but here is my attempt to explain it. I have a page which will gather configuration information, one of the things about this configuration is that you have a 1 to many relation with cameras.
So you have your set configuration for a location, but that location can have up to 32 possible cameras associated with it. But of course you may have just have one camara, so of course you would only need to add 1 new field. Any links to adding dynamic fields would be great.. the other thing is if fields are added dynamically, how to handle that in the insertign of the data into the database, since we wont know how many fields there will be until they hit the submit button.
View 10 Replies
Similar Messages:
Nov 9, 2010
I have an application that allows the user to define custom fields that will later show up on a form for viewing and editing. The user defines the field type, label, length and other custom attributes about a field and these field definitions are stored in a database. The fields are loaded into an array of CustomField objects at runtime. Later when the page is rendered I want to be able to display these fields and if in edit mode allow the user to edit the fields.
what is the easiest way to throw these up on the webform for display and allow editing if edit mode is selected?
View 3 Replies
Jul 14, 2010
I have a Grid view which is being populated from a database. Now I want to add a button that has its own html with some Hidden fields. I have introduced an Template Field and put the html in that field which works fine. But now I want to send the values in hidden field dynamically. i.e. the Id and value comming form the database.
View 3 Replies
Aug 20, 2010
I have created DetailsView in designer page with SqlDataSource, Details view is with autoGenerateRows="false" i.e. I have declared my own fields. it is fine there, but what if I want to add these fields dynamically from codebehind with select & edit commands. I want to to use Details View in designer page and want to add fields from codebehind
View 1 Replies
Jan 20, 2011
I dont understand how to bind grid view fields dynamically..
whenever user send question then i directly bind that
but whenever same user share their images then i want to bind that images into same grid...
so what can i do for that...??
View 5 Replies
Mar 24, 2010
I have a working gridView/DetailsView used as a member Lookup.
Some Fields in the Details View have data only some of the time, and when there isn't any, I want to suppress that row of the detail. No Go.
It seems that some of the function available in other controls don't exist so I cannot make the "field and its "header" Visible = "False"
FWIW, The control is nested inside a loginview control.
[Code]....
When I try and put logiin the control the error I get is:
Error 156 Literal content ('<asp:TemplateField ItemStyle-Wrap="false" HeaderText="PO Box:" Visible="') is not allowed within a 'System.Web.UI.WebControls.DataControlFieldCollection'. C:UsersBillDocumentsMy Web SitesNausetNewcomersMembershipCopy of Lookup.aspx 345
View 1 Replies
Nov 14, 2010
New to .net and revamping a project from classic. In short, I am trying to create all the form fields in the view based on the database and want to figure out the best practice for .net. I've tried a few things but none seem very clean.
So basically select all the fields and data from the database and loop through each record creating the field type(text, drop down ect)/name/onchange event ect along with creating the basic layout, like putting in a column or group a set related fields.
I see how it can be done in the view itself, but there is a bunch of logic required that would be better suited for a function or class more than a bunch of if then elses in the view itself.
Just for context, it's for a real estate investment management project. So there are over 1000 fields that represent information on a house. What the end user see's is based on their choices and their security. Also, all the fields save with the onchange event which is tied to the name of the field. So everything is dynamic.
View 7 Replies
Jan 25, 2011
What's the best way to approach the following situation in asp.net mvc2 (c#):I have a form where a user can add more fields ... for example I ask user the details of personal computing devices that they have. For simplicity sake let's say I ask for the brand and type (dropdown list of Desktop/Laptop/Tablet/Other) and they can provide unlimited devices. I will start with a pair of text boxes:
<label>Type</label>
<select><option>Desktop</option><option>Laptop</option><option>Tablet</option><option>Other</option></select>
<label>Brand</label>
<input type="text" />
<input type="button" value="Add more device" />
And then as user click the "Add more device" button I will display another pair of Brand and Type text boxes ... and so on.My question is how should I use HTML helper for this, how I construct the viewModel, etc.I am from PHP background and I used to use the following in PHP:
<input type="text" name="brand[]" />
which on the back end will give me an array of brands ... not sure if that's doable in asp.net environment. I would appreciate any input.[I added the following lines to make my question clearer]
I think I have not been very clear with my question.Suppose I have the following viewmodel:
public class UserRegisterViewModel
{
public string DeviceBrand { get; set; }
[code]...
View 2 Replies
Mar 18, 2010
I have a a gridview with a dynamic number of columns and rows. In each of the gridiview cells, a textbox get's added dynamicaly. I need users to be able to tab through these textboxes, but I can't get it to work.
I set the tabindex of the the textbox when it is created in the code behind, however when I try and tab in the page it doesn't work. If I click inside a textbox in the grdiview then pressing tab does nothing at all, If I click outside the gridview I can tab through the other controls on the page, and it will tab into the first cell of the gridiview, and then stop/
View 2 Replies
May 9, 2010
Is there a way to dynamically create a report?I have the following tables:
[Code]....
Obviously, this is quite straight forward if I could restrict the limit of the sizes, but they want the flexibility to add sizes, particularly with footwear or if they should need to add women's dress sizes.So the problem is that I'm generating dynamic table columns (the number unknown) during run-time.
View 2 Replies
Nov 16, 2010
I have a query expression which I am binding to a GridView in Page_Load. The data I want to capture in the SelectedIndexChaned event is in a BoundField defined thus:
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True"
SortExpression="ID" Visible="False" />
If I set Visible="True", I have no trouble getting this data. Is there a way to hide the ID field and still get the data?
View 1 Replies
Feb 24, 2010
My C# web app requires the user to enter automobile information. The user can add information for one auto, or more (max 20).
My page has these text fields: Car Number, Car Make, Car Year, Mileage, VIN I have a button that allows the user to "Add More Cars" is to allow the user to add more than one car.
When the user clicks "Add More Cars", how can I dynamically display the text boxes, and keep track of how many cars the user has added (in order to load them to an array and write to database)
View 3 Replies
Mar 25, 2010
Is there a way to list on the fly all fields in object context? in entity framework?
for example in my Log (object context) i have fields LogId, Name, CreateDate
I would like to loop through these dynamically and assign values. This would be useful when my current context changes to another table I would be doing this:
[code]....
View 1 Replies
Apr 5, 2010
Once again i am faced with an issue. I must allow a user to add as many pieces of data as they wish. I have therefore employed some javascript from an tutorial
[URL]
I would now like to return the data from the dynamic fields through the c#(.cs page)
View 1 Replies
Mar 23, 2011
my requirement is i want to add education details having three fields
1) name of school
2)name of city
3)Degree
some persons will studied only in one school . some in 2 . aome in 3. how to add dynamically .and after that i want to show the data to admin .if there is 2 means i want to display 2 school informa
View 4 Replies
Jan 12, 2011
Similar to the "add more experience" functionality in [URL], I want to provide a "Add another location" link which should display an additional row of a set of 4 dropdowns (country, state, city, region). I'm actually using the CascadingDropDown jQuery Plugin for ASP.NET MVC [URL] for my location dropdown functionality, but I need to give the user the ability to add multiple locations. What would be the easiest way to handle this in ASP.NET MVC and jQuery?
View 4 Replies
Jul 17, 2010
I have a gridview that is populating from a SQL DB and working fine. However, based upon certain data I find in fields in the SQL table, I want to place a 'n' or a 'y' in extra columns in the gridview that I am assuming need to be templatefields. My thought was I could maybe add 8 template columns and then I could put a 'y' in the appropriate column based upon the data I find the table. For the life of me, I cannot figure out how to do this. I want to do this at rowdatabound time ( i think) but I just cannot find out how to, in my code, put that 'y' in the columns. Is this the right way to do this or do I need to do it another way? How do I get that 'y' in the proper column?
View 3 Replies
Dec 17, 2010
How do I implement client side validation for input fields that have been added to the form dynamically with javascript in an MVC 2 application?
View 2 Replies
Feb 8, 2011
I have a sql data souce that returns several columns of data, and they are displayed in a DetailsView on a pretty simple vb.net page. I'm stuggling with one field though for the details view.
It's a template field, and if ClientType=1 (this value is determined else where on the page), then the label in the template field should have Text='<%# Bind("ClientName") %>', but if the ClientType = 0, then the label in the template field should have Text='<%# Bind("ClientTemporaryName") %>'
How do I tell the details view to set the text for ClientName to one or the other?
[Code]....
View 3 Replies
Aug 18, 2010
I am using TempleteFields for all columns in my GridView. In that columns I am using only some fields for customization but not all.
Is there any performance issue with Databound Fields vs Templete Fields in a GridView...?
Do I need to replace the remaining columns with Databound Columns instead of TempletField columns...?
View 4 Replies
Sep 26, 2010
I have a GridView, and I want Column1 to be equal to datatable data (filled by a SqlDataAdapter). Then I have two other fields by the SqlDataAdapter (first name, last name), and I want to have those two fields combined to form Column2. I have a TemplateField for my GridView that combines the first name and last name with Eval()'s, but the GridView places this combined field TemplateField and puts it as the first column.
How can I do this so that TemplateField can go in between fields that are databound?
View 6 Replies
Feb 25, 2011
I have a relatively complex dataset (numerous tables, some with multiple records) generated from reading in an XML file. I need to connect said dataset fields to an ASP form. At the moment I'm assigning them manually, like so in the pageload:
txt_first_init.Text = formData.ds.Tables["phrmHdrKey"].Rows[0]["first_init"].ToString();
txt_last_name.Text = formData.ds.Tables["phrmHdrKey"].Rows[0]["last_name"].ToString();
ddl_pregnancy_flag.SelectedValue = formData.ds.Tables["pPhrm"].Rows[0]["pregnancy_flag"].ToString();
And conversely when it's time to submit.
formData.ds.Tables["phrmHdrKey"].Rows[0]["first_init"] = txt_first_init.Text;
formData.ds.Tables["phrmHdrKey"].Rows[0]["last_name"] = txt_last_name.Text;
formData.ds.Tables["pPhrm"].Rows[0]["pregnancy_flag"] = ddl_pregnancy_flag.SelectedValue.ToString();
I did some looking into binding the textboxes (and dropdownlists, and checkboxes, and and and...) directly, but it seemed to be too many formats to use.
So this works fine, but as the number of fields increases, those load and unload lists are going to get unwieldy.
View 1 Replies
Jan 3, 2013
I am working on Crystal Reports 8.5 and SQL Server 2000 as backend. I have a stored procedure which has been added to the Crystal Report. So that fields are visible in the Fields object section from where i can drag and drop the fields on the report and display it. But now as they want more fields i have written two select statements for displaying required fields. But these newly added fields are not visible in the Fields object section in the Crystal Reports. I have done verify database, removed and again attached the SP but the problem is not solved.
View 1 Replies
Jan 9, 2011
Q1: I have an Asp.net page , one textarea there the user can enter all his details like name age gender; how do get the get name, age, gender in seperate fields(text fields). how can i split?
Q:
dawn barric 25 male
answer:
text1: dawn barric
text2: 25
text3: male
View 3 Replies
Sep 28, 2010
I'm creating an quiz application which queries the database and extracts the questions and choices. I use dynamically created controls such as a checkbox list and fill the values dynamically. How do I do this? Right now I have these functions:
array_random_init(); this creates a 10 element integer array from 1-20 - extract_question(i): this extracts a question indexed at i in DB, I created the controls and set the appropriate text in this function. - validate_question(i); this is called by button_click and validates the question i according to DB.
I understand I have to recreate the controls in Page_init on postback, but what should it look like? Do I need to add "if IsPostBack" in page_init, or do I create the controls in page_init() and reset their properties in page_load when I use extract_question(i)? Also, I cannot seem to clear the selected boxes on postback, I added page directive "enableviewstate=false" but it doesn't work.
View 2 Replies