Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 27th, 2006, 02:12 AM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with updating the detailsview control

Hi..

Here i ended up in very bad situation. i will try to explain the problem here. In our webapp development we are using detailsview controls to display one record. Mind it, that DetailsView control is not bounded to sqlDataSourse or else.. its DataSource is Dataset which is generated dynamically.

On the Edit i have added dropdowlists dynamically loading them from the database. it works fine. but the problem is. when i click on the update i cant see the just added dropdownlist in the Detailsview control. This is really wierd way of behaving.

Please i need help..
suggestion will be appriciated.
thanks
Rake

 
Old August 2nd, 2006, 10:45 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You have to specify in the DetailsView control the Item events with something like this:

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="AgentID"
            OnItemUpdated="Agency_ItemUpdated"
            OnItemInserted="Agency_ItemInserted"
            OnItemDeleted="Agency_ItemDeleted" ...

and then rebind your drop down list data in the events with your code with something like this:

protected void Agency_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {
        drpAgencies.DataBind();
    }
    protected void Agency_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
        drpAgencies.DataBind();
    }
    protected void Agency_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
    {
        drpAgencies.DataBind();
    }

Make sure you use the DetailsViewDeletedEventArgs so the item events will fire from the DetailsView control.
--Harry




Similar Threads
Thread Thread Starter Forum Replies Last Post
Events for Control Inside DetailsView AspNetGuy ASP.NET 3.5 Basics 3 June 6th, 2008 02:09 PM
DetailsView Control on ManageCategories.aspx pinch BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 October 6th, 2007 09:15 PM
DetailsView "Out of range" error when updating rsearing ASP.NET 2.0 Basics 16 August 17th, 2007 07:38 AM
detailsview not updating table when null column davej ASP.NET 2.0 Professional 3 April 11th, 2007 06:59 AM
DetailsView Control Showkkath ASP.NET 1.x and 2.0 Application Design 2 August 21st, 2006 07:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.