473,790 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DetailsView programmaticall y enter Insert Mode

Don
I have a detailsView that I use with a GridView. When a row is
selected I show the GridView with a default mode of Edit. This shows
my fields with text boxes for changing the data. It also has the
update and cancel buttons.

Now I need to put the DetailsView into Insert mode when a button is
clicked. In the button clicked event handler, in the code behind, I
change to insert mode with this code:
dvSingleRow.Cha ngeMode(Details ViewMode.Insert );

This takes me into InsertMode but I do not see any of the fields. If
I first select a row and then click the insert button I see all my
fields.

I am using autoGenerateRow s=true because by ObjectDataSourc e is
dynamic and I may have different columns.
Feb 21 '08 #1
3 21089
On 21 Feb, 21:44, Don <chambers...@ho tmail.comwrote:
I have a detailsView that I use with a GridView. *When a row is
selected I show the GridView with a default mode of Edit. *This shows
my fields with text boxes for changing the data. *It also has the
update and cancel buttons.

Now I need to put the DetailsView into Insert mode when a button is
clicked. *In the button clicked event handler, in the code behind, I
change to insert mode with this code:
dvSingleRow.Cha ngeMode(Details ViewMode.Insert );

This takes me into InsertMode but I do not see any of the fields. *If
I first select a row and then click the insert button I see all my
fields.

I am using autoGenerateRow s=true because by ObjectDataSourc e is
dynamic and I may have different columns.
It may be that you need to execute the DataBind method in the code for
the event handler so as to refresh databound controls in response to
state changes.
Feb 21 '08 #2
Don
I tried that but still get the same results.
I put a breakpoint in the DataBound event and I see that
sender.DataItem is null when I call dataBind from by insert click
event handler.

On Feb 21, 5:14*pm, Phil H <goo...@philpha ll.me.ukwrote:
On 21 Feb, 21:44, Don <chambers...@ho tmail.comwrote:


I have a detailsView that I use with a GridView. *When a row is
selected I show the GridView with a default mode of Edit. *This shows
my fields with text boxes for changing the data. *It also has the
update and cancel buttons.
Now I need to put the DetailsView into Insert mode when a button is
clicked. *In the button clicked event handler, in the code behind, I
change to insert mode with this code:
dvSingleRow.Cha ngeMode(Details ViewMode.Insert );
This takes me into InsertMode but I do not see any of the fields. *If
I first select a row and then click the insert button I see all my
fields.
I am using autoGenerateRow s=true because by ObjectDataSourc e is
dynamic and I may have different columns.

It may be that you need to execute the DataBind method in the code for
the event handler so as to refresh databound controls in response to
state changes.- Hide quoted text -

- Show quoted text -
Feb 22 '08 #3
It can happen if the DetailsView is linked to a GridView witch
SelectedIndex = -1.
Did you try this ?

GridView1.Selec tedIndex = 0;
DetailsView1.Ch angeMode(Detail sViewMode.Inser t);


Mar 24 '08 #4

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

Similar topics

2
1585
by: Playmaker | last post by:
Hopefully someone else has come across this issue. What I have is a SQL Server 2000 back-end. I've created a simple webform which has both Gridview and DataList controls on it populated with a SqlDataSource. Okay, simple enough, that all works fine. I have also enabled inserting and editing on these controls. This is a very cool feature of 2.0 and it works quite well. Functionally I am able to do everything such as inserting and...
2
1473
by: Eric Zhao | last post by:
My details view is in insert mode and my dataset is empty but the details view doesnt show. who can help me, how to do? Also I tried to set the defaultmode to insert mode, but i found i can't cancel the inserting. thanks in advance.
3
5547
by: Developer | last post by:
I use the RichTextBox and sometimes put it into overwrite mode. I'd like the cursor to show whether its in overwrite or insert mode. I often use Cursor.Current = Cursors.WaitCursor and therefore need to change the cursor to show the overwrite/insert mode in such a way that when the Cursor.Current is reset after the need for the wait cursor ends, the cursor resets to the overwrite cursor or insert cursor as appropriate.
2
2491
by: William LaMartin | last post by:
Is there a way to increase the width of the text boxes for the DetailsView in edit or insert mode? When I put the control in either edit or insert mode, the text boxes to type the new text are always much smaller than the available space in the row.
1
1715
by: cannontrodder | last post by:
I am using a custom business object to deal with inserting, editing, deleting and adding new users to my site which uses the membership class. When I add a new user, it can fail due to the user already existing in the membership data store. This is fine, I catch the exception in my business object and gracefully deal with it. What is frustrating is that the detailsview does not remember the values it contained before the insert...
0
1693
by: jobs at webdos | last post by:
I have a formview that will either edit or insert records into a database. when I call the page with a query string ?x= its goes to edit mode and loads data from a datasource in the form and load data into the dropdown (from another datasource) with no problem. I'm using the same dropdownlist tag for both edit and insert, however the dropdown only get populated in insert mode... <asp:DropDownList ID="RouteCodeList" runat="server"...
1
1321
by: aekta | last post by:
Hello, How to place a dropdownlist in DetailsView programmatically? Thanks
1
6917
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
When I click the "Edit" hyperlink, my DetailsView doesn't enter Edit mode. It will if I set the DefaultMode="Edit". Any thoughts? Thanks. <asp:DetailsView ID="DetailsView1" DataKeyNames="TopicId" runat="server" Height="50px" Width="547px" AutoGenerateEditButton=true OnModeChanging="DetailsView1_ModeChanging" OnPageIndexChanging="DetailsView1_PageIndexChanging"> </asp:DetailsView> protected void DetailsView1_ModeChanging(Object...
0
1493
by: Nirmal Singh | last post by:
How can I (programattically) set a Detailview control into Insert mode and set data to default values? Nirmal
0
10413
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9021
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.