Solved

How do I create and populate an asp:FormView in an Asp.Net application dynamically in the code behind ?

Posted on 2014-07-23
1
478 Views
Last Modified: 2014-07-27
Hi:

I'm working on an ASP.net (VB.Net) application.
We have a page from which we display a ModalPopupExtender(s) tied to a input button click.
We would like to embed an asp:FormView control within the popup div.

Depending on the scenario, the use can edit one of several different record types.
With this in mind, we would like to be able to create and populate the item templates
dynamically in the code behind.

Ideally, we would like the FormView to display it's items in a grid consisting
of multiple rows/columns (<td>label </td><td>Field</td>
The template contents would depend on the current record type.
We won't be editing all the fields in the records, just a subset.

We would like to use the FormView to:
a) view record details
b) update a record
c) create a new record

How do I go about doing this dynamically in the code behind?

Thanks,
JohnB
0
Comment
Question by:jxbma
1 Comment
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 40217554
That's a broad question. do you have anything in place and facing any issues?
Though here's basic steps:
- You can place the FV in modal without any issues.
- In code behind you can bind the FV control like:

FormView1.DataSource = //It is the data e.g. collection of Person objects that holds the data
FormView1.DataBind();
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question