Detailsview: Is it possible to share templatefields

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?T2xlIEtpcmtob2x0?=

    Detailsview: Is it possible to share templatefields

    Hello

    I'm starting on my first asp.net project.
    I'm using VS2008sp1 and .Net 3.5

    I'm trying to create a page for inserting/editing a single databaserecord

    I need both multiline textboxes, check- and listboxes.
    To do that I need templatefields, right ?

    Is there a way to share the same templatefield between inserting and editing,
    so I don't have til make everything (including validation controls) twice ?

    Best Regards

    Ole
  • =?Utf-8?B?Y21lZWsxXzE5OTk=?=

    #2
    RE: Detailsview: Is it possible to share templatefields

    If you do not specify an inserting template, the editing template will be used.
    The save button needs an "insert" or "update" string, so you can create
    a protected property UpdateOrInsert which returns
    FormView1.Curre ntMode != FormViewMode.In sert ? "Update" : "Insert";
    Specify CommandName='<% # UpdateOrInsert %>' for the save button.

    Regards,

    Carlo Mekenkamp

    "Ole Kirkholt" wrote:
    Hello
    >
    I'm starting on my first asp.net project.
    I'm using VS2008sp1 and .Net 3.5
    >
    I'm trying to create a page for inserting/editing a single databaserecord
    >
    I need both multiline textboxes, check- and listboxes.
    To do that I need templatefields, right ?
    >
    Is there a way to share the same templatefield between inserting and editing,
    so I don't have til make everything (including validation controls) twice ?
    >
    Best Regards
    >
    Ole

    Comment

    • =?Utf-8?B?T2xlIEtpcmtob2x0?=

      #3
      RE: Detailsview: Is it possible to share templatefields

      Hello again

      I have tried this, but it is not working on inserts.

      When I want to insert a record by setting the formview's defaultmode to
      Insert, the property isn't read, and therefore the commandtext isn't updated.

      Is there any other way/event that can be used to set the CommandText of a
      linkbutton, of to force the form til save the new record ?¨

      Best Regards

      Ole Kirkholt



      "cmeek1_199 9" wrote:
      If you do not specify an inserting template, the editing template will be used.
      The save button needs an "insert" or "update" string, so you can create
      a protected property UpdateOrInsert which returns
      FormView1.Curre ntMode != FormViewMode.In sert ? "Update" : "Insert";
      Specify CommandName='<% # UpdateOrInsert %>' for the save button.
      >
      Regards,
      >
      Carlo Mekenkamp
      >
      "Ole Kirkholt" wrote:
      >
      Hello

      I'm starting on my first asp.net project.
      I'm using VS2008sp1 and .Net 3.5

      I'm trying to create a page for inserting/editing a single databaserecord

      I need both multiline textboxes, check- and listboxes.
      To do that I need templatefields, right ?

      Is there a way to share the same templatefield between inserting and editing,
      so I don't have til make everything (including validation controls) twice ?

      Best Regards

      Ole

      Comment

      • =?Utf-8?B?Y21lZWsxXzE5OTk=?=

        #4
        RE: Detailsview: Is it possible to share templatefields

        Dit you use a FormView1.DataB ind()?
        In the PageLoad I mostly DataBind all controls:
        if (!IsPostBack)
        {
        FormView1.DataB ind();
        }


        "Ole Kirkholt" wrote:
        Hello again
        >
        I have tried this, but it is not working on inserts.
        >
        When I want to insert a record by setting the formview's defaultmode to
        Insert, the property isn't read, and therefore the commandtext isn't updated.
        >
        Is there any other way/event that can be used to set the CommandText of a
        linkbutton, of to force the form til save the new record ?¨
        >
        Best Regards
        >
        Ole Kirkholt
        >
        >
        >
        "cmeek1_199 9" wrote:
        >
        If you do not specify an inserting template, the editing template will be used.
        The save button needs an "insert" or "update" string, so you can create
        a protected property UpdateOrInsert which returns
        FormView1.Curre ntMode != FormViewMode.In sert ? "Update" : "Insert";
        Specify CommandName='<% # UpdateOrInsert %>' for the save button.

        Regards,

        Carlo Mekenkamp

        "Ole Kirkholt" wrote:
        Hello
        >
        I'm starting on my first asp.net project.
        I'm using VS2008sp1 and .Net 3.5
        >
        I'm trying to create a page for inserting/editing a single databaserecord
        >
        I need both multiline textboxes, check- and listboxes.
        To do that I need templatefields, right ?
        >
        Is there a way to share the same templatefield between inserting and editing,
        so I don't have til make everything (including validation controls) twice ?
        >
        Best Regards
        >
        Ole

        Comment

        Working...