Show/Edit on one page: Best option

Discussion in 'ASP .Net' started by ma, Sep 27, 2007.

  1. ma

    ma Guest

    Hello,

    I want to have a page that displays the fields of a record of a database.
    When user press 'Edit' button, he would be able to edit the data. What is
    the best way to do this?



    What I can suggest is to show the fields using label controls and when user
    press 'Edit', replace the labels with TextBox controls (setting visible
    property of Labels to false and TextBox to true).



    Is there any better way to do this?



    Regards
     
    ma, Sep 27, 2007
    #1
    1. Advertising

  2. ma

    ma Guest

    Thank,
    I want to have a form view instead of a gridview.
    Regards


    "David Wier" <> wrote in message
    news:...
    > Look into the Gridview - it has display and edit capabilities built in:
    > http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=GvNoCodeEdit
    >
    > Also another way, if you would like it in a Master/Detail fashion, you
    > could use a DetailsView, along with a Gridview:
    > http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=MasterDetail20
    >
    > David Wier
    > http://aspnet101.com
    > http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with
    > no bloated markup
    >
    >
    > "ma" <> wrote in message
    > news:...
    >> Hello,
    >>
    >> I want to have a page that displays the fields of a record of a
    >> database. When user press 'Edit' button, he would be able to edit the
    >> data. What is the best way to do this?
    >>
    >>
    >>
    >> What I can suggest is to show the fields using label controls and when
    >> user press 'Edit', replace the labels with TextBox controls (setting
    >> visible property of Labels to false and TextBox to true).
    >>
    >>
    >>
    >> Is there any better way to do this?
    >>
    >>
    >>
    >> Regards
    >>
    >>

    >
    >
     
    ma, Sep 27, 2007
    #2
    1. Advertising

  3. > I want to have a form view instead of a gridview.

    Then you have answered your own question. Use a FormView control bound to a
    (Sql/Xml/Etc)DataSource control, and use Labels in the ItemTemplate and
    TextBoxes in the EditItemTemplate. There is also an InsertItemTemplate for
    when you want to insert new records.

    Check out the MSDN library or VS help.

    http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.aspx
     
    =?Utf-8?B?QW5kcmV3IEhheWVz?=, Sep 28, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Julien ROUZIERES

    g++ -pg option and -shared option

    Julien ROUZIERES, Dec 21, 2004, in forum: C++
    Replies:
    1
    Views:
    725
    GianGuz
    Dec 21, 2004
  2. Cas
    Replies:
    5
    Views:
    793
    Kevin Jones
    Aug 28, 2006
  3. Kevin Blount

    page.aspx?option - how to detect "option"

    Kevin Blount, Nov 28, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    607
    =?Utf-8?B?RWVyYWo=?=
    Nov 28, 2006
  4. John

    Regex for <option> ... </option>

    John, Jan 23, 2009, in forum: Perl Misc
    Replies:
    10
    Views:
    240
    Eric Pozharski
    Jan 29, 2009
  5. Mark Kolber
    Replies:
    4
    Views:
    348
Loading...

Share This Page