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.

GridView/FormView (master/details) questions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dan - 26 Mar 2008 23:19 GMT
Hi,

I have a hard time finding an example with GridView and FormView on the same
page. So I'm hoping that someone will be able to help me with the following:

1) How do I refresh GridView after Insert, Update, and Delete in a linked
FormView?
That is, I'd like the GridView to show updates made to a row, show a newly
added row, and remove a deleted row.

2) How do I force the FormView to display in InsertMode if no items are
present in the associated GridView?
I know that I need to call ChangeMode() on the FormView but I'm not sure
where.  I tried Selected event of the associated ObjectDataSource with "if
(e.RowsAffected <  1) FormView.ChangeMode(FormViewMode.Insert)" but this
does not seem to work.  The ObjectDataSourceStatusEventArgs.RowsAffected is
always -1 regardless of how many rows are displayed in the GridView. So I
must be checking it in the wrong place.

Any help will be greatly appreciated.
Thanks,
Stan - 29 Mar 2008 01:50 GMT
> Hi,
>
[quoted text clipped - 17 lines]
> Any help will be greatly appreciated.
> Thanks,

1) Execute the GridView's DataBind() method in the event handlers for
the FormView's ItemInserted, ItemUpdated and ItemDeleted events.

2) In the Page_load event handler execute the FormView's ChangeMode()
method if the GridView's Rows.Count property is zero.

HTH
Stan - 29 Mar 2008 09:53 GMT
> > Hi,
>
[quoted text clipped - 27 lines]
>
> - Show quoted text -

Correction:

It might be safer to use the GridView DataBound event rather than the
Page_Load event in (2).

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.