DetailsView only returning empty strings when "Insert"

Posted on 2007-10-14
Last Modified: 2012-06-27
I have a fairly complex solution in order to combine modalpopup with tabs and updatepanels, as well as the usual gridview and detailsview. The setup at a glance:
- gridview allowing for deletion and editing, wrapped in a updatepanel.
- modalpopup which is invoked when editing a row in gridview, it contains:
   * a detailsview which uses an objectDataSource to get the editable data.
   *  the detailview consist of a templateField with a two tabs in a TabContainer, allowing for more fields to be edited in a limited space. Both tabs are wrapped with an updatePanel.

When I push the "Save"-button in my detailsView everything seems fine since the modalPopup closes and the gridview updates itself. But, the new row does not contain any data. Every string passed by my detailsView is emtpy.

Do you know of any solutions?

Since it worked until I added the two tabs and their updatePanels (only used the regular detailsView), I am suspecting that the name of my fields are to complex and eventually hidden for my objectDataSource which is supposed to pass them on.
   //normally the fields would have been visible here, but I am adding:
       //now my fields arrive here...

Perhapse this is getting to difficult for the ObjectDataSource:
      <Parameter Name="myField" ...>

Just a thought...
Hopefully you might see the proper solution.
Question by:wahooo

    Author Comment

    I just wanted to add that I removed the UpdatePanel within the tabs, without any loss (nor gain) in the funticonality of the page. So now the setup is like:
       //normally the fields would have been visible here, but I am adding:
           //now my fields arrive here...

    Still nothing saved thogh, although everything else works perfect...
    Some advice please?

    Author Comment

    Some more details about my problem:
    Usually when you create a DetailsView it accepts that you define the same ID for multiple objects (like TextBox) as long as they are situated in different states of the DetailsView (like EditItemTemplate and InsertItemTemplate). When I use the tabs, this is not allowed, although I create the a new tabContainer in in each state of the DetailsView, like this:

    So why does it all of a sudden return error messages telling me that my site already contains a definition for 'name', when the definitions are created in different states of the DetailsView?

    Well, the most crucial agenda is still to make my tabs-detailsview-modalpopup to send the data via my ObjectDataSource. Remember that a regular detailsview-modalpopup will send the data, but this doesn't give me the correct design/layout for my input.

    I really need some advice...
    LVL 5

    Accepted Solution

    I added a response to a similar request at:

    The same answer following here:
    One method I often use when I am having trouble with the automatic hierarchy of objects in ASP.NET is to directly address the wanted object with the "automatically" created instance name. Ok, when using runat="server" for any object in .NET, the object is automatically assigned a name depending on its location in hierarchy. Therefore a TextBox which you call "myTextBox" is placed inside a TabContainer (called Tab) and one of its TabPanels (ID = "TabPanel1"), then the generated ID for the TextBox would end up in the HTML to look like: ct100$ContentPlaceHolder1$Tab$TabContainer$myTextBox.
    Here the first ct100 refers to the page and ContentPlaceHolder1 refers to the actual ContentPlaceHolder you are adding the object to.

    So, in order to exploit this you have to change your parameters in your ObjectDataSource to a FormParameter, and point it towards the wanted Field:
    <asp:FormParameter FormField="ct100$ContentPlaceHolder1$Tab$TabContainer$myTextBox" Name="someName" Type="String" />

    Hope this works!

    Expert Comment

    Do you have any examples that I may use?  Thanks.


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now