473,396 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

EditOnly DetailsView?

Hi,

I am upgrading my asp.net 1.x to asp.net 2.0. In my page I have a
datagrid and a group of textbox, dropdownlist, checkbox... etc. the
datagrid and the group of controls are hooked up - when user click on
datagrid to select a row, then I will populate the record detail to
those controls for user to edit.

As in asp.net 2.0, I tried to use detailsview to replace the group of
controls by using <ItemTemplate>. But I do not like the user has to
click edit/insert button to change read-only to edit mode. I want the
detailsview always in edit/insert mode so that the user can edit
/insert then click a save button to save changes. Can I achive this? I
tried to use ItemTemplate but got lots of problems. Any example for a
edit-mode only detailview/formview?
Thanks a lot
-rockdale

Sep 15 '06 #1
2 7710
You should be able to use the DefaultMode property, setting it to 'Edit'

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"rockdale" <ro************@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi,

I am upgrading my asp.net 1.x to asp.net 2.0. In my page I have a
datagrid and a group of textbox, dropdownlist, checkbox... etc. the
datagrid and the group of controls are hooked up - when user click on
datagrid to select a row, then I will populate the record detail to
those controls for user to edit.

As in asp.net 2.0, I tried to use detailsview to replace the group of
controls by using <ItemTemplate>. But I do not like the user has to
click edit/insert button to change read-only to edit mode. I want the
detailsview always in edit/insert mode so that the user can edit
/insert then click a save button to save changes. Can I achive this? I
tried to use ItemTemplate but got lots of problems. Any example for a
edit-mode only detailview/formview?
Thanks a lot
-rockdale

Sep 15 '06 #2
Hi, David:

Thanks for your reply, I set the defaulemode as edit. But i kept
getting error
OnModeChanging, OnUpdating event not handled error. I did not using
DataSourceID since my website is a 3-tiers structure, I have a business
logic layer so basically put sql statement on the page is out of the
question.

I attached my source code below see if you can give me a hand what am I
missing?

It is a sample detailsview with NAME textbox field and STATE
DropDownList field. (I removed other fields for easier reading)

When user click a member on my gridview( not show here) , I will
databind this detailsview and the user can edit immediately (not by
click edit button). detailsview databinding and dropdownlist
databinding are in code behind and works fine.

Should I remove the command field for (update /edit) and use my own?

Thanks a lot
-rockdale
------------------------------------------

<asp:DetailsView ID="detlMemb" runat="server"
AutoGenerateRows="False" DataKeyNames="member_id"
DefaultMode="Edit"
HeaderText="Member"
EnableViewState="True"
OnDataBound="DetlMemb_OnDataBound"
OnItemInserted="DetlMemb_OnItemInserted"
OnItemUpdated="DetlMemb_OnItemUpdated"
>
<Fields>
<asp:BoundField DataField="member_id"
HeaderText="Member ID" SortExpression="member_id" Visible="false" />
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:TextBox ID="txtmember_name"
runat="server" Text='<%# Eval("member_name") %>'
Width="80px"></asp:TextBox>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="State" >
<ItemTemplate>

<asp:DropDownList ID="ddlstate"
runat="server"
AppendDataBoundItems="true"
DataTextField="state_id" DataValueField="state_id">
<asp:ListItem
Value="">Select...</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>

</asp:TemplateField>
<asp:CommandField ShowEditButton="True"
EditText="Save" ShowInsertButton="True" InsertText="New"/>

</Fields>
</asp:DetailsView>

David Wier wrote:
You should be able to use the DefaultMode property, setting it to 'Edit'

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"rockdale" <ro************@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi,

I am upgrading my asp.net 1.x to asp.net 2.0. In my page I have a
datagrid and a group of textbox, dropdownlist, checkbox... etc. the
datagrid and the group of controls are hooked up - when user click on
datagrid to select a row, then I will populate the record detail to
those controls for user to edit.

As in asp.net 2.0, I tried to use detailsview to replace the group of
controls by using <ItemTemplate>. But I do not like the user has to
click edit/insert button to change read-only to edit mode. I want the
detailsview always in edit/insert mode so that the user can edit
/insert then click a save button to save changes. Can I achive this? I
tried to use ItemTemplate but got lots of problems. Any example for a
edit-mode only detailview/formview?
Thanks a lot
-rockdale
Sep 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shawn Wildermuth | last post by:
I have a *single* SqlDataSource that loads up a single result set that I show in a GridView. In the GridView, i've added a "Select" button and handling the SelectedItem event. I also have a...
2
by: Andrew Robinson | last post by:
Is there any way to accomplish two way data binding in a Details View with a DataSet or DataTable as the DataSource. All I want is to get an updated DataSet or DataTable back from the...
12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
1
by: sck10 | last post by:
Hello, I am trying to change a value when a user goes into edit mode on a DetailsView control. I am trying to use the following, but can not figure out how to get to the bound field...
4
by: Frits van Soldt | last post by:
Hello, I hope somebody can help me with this! I have 2 listboxes in the edititemtemplate of a detailsview. In the databound event of the detailsview I would like to fill the listboxes...
3
by: chrisn | last post by:
Hi, (Using ASP.Net 2.0) I have a wizard control inside a detailsview control. When I attempt to call the InsertItem method on the DetailsView I get an error "ObjectDataSource...
0
by: mike | last post by:
Hi, When I programatically Bind a DataSource to DetailsView it does not fire "ModeChanged" event. This is first time i am trying to use ASP.NET DetailsView control. I have played with some of the...
1
by: needhelp1 | last post by:
I have gridview with a detailsview below. When I click on 'New' in brings up the DetailsView for inserting. When I click on 'Edit' in does not brink up the DetailsView. What am I doing wrong? I...
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.