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!
    Steve
     
    Stephen Hatfield, May 1, 2006
    #1
    1. Advertisements

  2. http://www.webswapp.com/codesamples/aspnet20/itemplate/default.aspx
    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Stephen Hatfield" wrote:

    > 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!
    > Steve
     
    Phillip Williams, May 1, 2006
    #2
    1. Advertisements

  3. 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.

    Steve

    "Phillip Williams" wrote:

    > http://www.webswapp.com/codesamples/aspnet20/itemplate/default.aspx
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "Stephen Hatfield" wrote:
    >
    > > 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!
    > > Steve
     
    Stephen Hatfield, May 2, 2006
    #3
  4. Hi Stephen,

    I just added another demo within the same section on my website for the
    FormView.
    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Stephen Hatfield" wrote:

    > 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.
    >
    > Steve
    >
    > "Phillip Williams" wrote:
    >
    > > http://www.webswapp.com/codesamples/aspnet20/itemplate/default.aspx
    > > --
    > > HTH,
    > > Phillip Williams
    > > http://www.societopia.net
    > > http://www.webswapp.com
    > >
    > >
    > > "Stephen Hatfield" wrote:
    > >
    > > > 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!
    > > > Steve
     
    Phillip Williams, May 4, 2006
    #4
  5. Stephen Hatfield

    cynosureabu

    Joined:
    Oct 20, 2012
    Messages:
    1
    Likes Received:
    0
    Update in FormView does not persist data

    Philip,
    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

    this.MyFormView.ChangeMode(FormViewMode.Edit);
    this.MyFormView.DataBind();

    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!

    Chen
     
    cynosureabu, Oct 20, 2012
    #5
    1. Advertisements

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.
Similar Threads
  1. JKop
    Replies:
    3
    Views:
    779
  2. recover
    Replies:
    2
    Views:
    1,168
    recover
    Jul 25, 2006
  3. =?Utf-8?B?QW5u?=
    Replies:
    0
    Views:
    633
    =?Utf-8?B?QW5u?=
    May 12, 2007
  4. Chris

    Formview within Formview

    Chris, May 19, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    927
    Chris
    May 19, 2007
  5. Nathan Sokalski

    FormView not displaying the correct templates

    Nathan Sokalski, Aug 26, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    1,638
    Nathan Sokalski
    Aug 26, 2007
  6. Greg Hoover
    Replies:
    1
    Views:
    768
    Robert Bossy
    Mar 25, 2008
  7. Cirene
    Replies:
    0
    Views:
    463
    Cirene
    May 20, 2008
  8. David Thielen

    FormView/Repeater/ Eval(FormView data)

    David Thielen, Jun 16, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    1,029
    David Thielen
    Jun 16, 2006
Loading...