Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Show/Edit on one page: Best option

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ma - 27 Sep 2007 14:28 GMT
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
David Wier - 27 Sep 2007 14:58 GMT
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

> Hello,
>
[quoted text clipped - 9 lines]
>
> Regards
ma - 27 Sep 2007 17:09 GMT
Thank,
I want to have a form view instead of a gridview.
Regards

> Look into the Gridview - it has display and edit capabilities built in:
> http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=GvNoCodeEdit
[quoted text clipped - 21 lines]
>>
>> Regards
Andrew Hayes - 28 Sep 2007 01:24 GMT
> 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.