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 / March 2008

Tip: Looking for answers? Try searching our database.

DetailsView programmatically enter Insert Mode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Don - 21 Feb 2008 21:44 GMT
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.ChangeMode(DetailsViewMode.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 autoGenerateRows=true because by ObjectDataSource is
dynamic and I may have different columns.
Phil H - 21 Feb 2008 22:14 GMT
> 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
[quoted text clipped - 12 lines]
> I am using autoGenerateRows=true because by ObjectDataSource 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.
Don - 22 Feb 2008 16:21 GMT
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.

> > 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
[quoted text clipped - 18 lines]
>
> - Show quoted text -
fs241690@scarlet.be - 24 Mar 2008 10:42 GMT
It can happen if the DetailsView is linked to a GridView witch
SelectedIndex = -1.
Did you try this ?

GridView1.SelectedIndex = 0;
DetailsView1.ChangeMode(DetailsViewMode.Insert);

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.