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
495 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

690 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