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
485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 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