Creating Dynamic FormView Templates

Discussion in 'ASP .Net Web Controls' started by Stephen Hatfield, May 1, 2006.

  1. Is it possible to create FormView templates (EditItemTemplate,
    InsertItemTemplate, ItemTemplate) dynamically by calling a separate class
    file to generate the template. My attempts at this have been unsuccessful. I
    am working in the ContentPlaceHolder on a page using a masterpage. I have
    tried adding a PlaceHolder tag and putting the FormView control within but
    still no luck. I have seen the example for doing this within a web page but
    not by calling the ITemplate class within a different .cs file.

    Thank you!
    Stephen Hatfield, May 1, 2006
    1. Advertisements

    1. Advertisements

  2. Thanks for your reply Philip! I have no problem generating templates for
    Columns in a GridView. I am having problems doing the same with a FormView.

    Stephen Hatfield, May 2, 2006
  3. Hi Stephen,

    I just added another demo within the same section on my website for the
    Phillip Williams, May 4, 2006
  4. Stephen Hatfield


    Oct 20, 2012
    Likes Received:
    Update in FormView does not persist data

    I was checking the FormView sample on your website, However, the code there does not seem to be complete. e.g, I could not see where DataBound occurs.

    My current issue is that
    I add the ItemTemplate, and EditItemTemplate during OnInit stage as in your sample.

    ItemTemplate has an edit button, then in order to switch to the Edit mode,
    I have to do


    in OnItemCommand, (this part is not shown in your sample either)

    However, the timing when DataBind occured in OnItemCommand is already too late. Although formview correctly displayed the edit mode, any updated value cannot be saved. In fact, I even could not receive Update command in OnItemCommand. Does my question makes sense to you?
    Thank you in advance for your help!

    cynosureabu, Oct 20, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.