?
Solved

DetailsView only returning empty strings when "Insert"

Posted on 2007-10-14
4
Medium Priority
?
622 Views
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.
E.g.:
<DetailsView><Fields><TemplateField><EditItemTemplate>
   //normally the fields would have been visible here, but I am adding:
   <TabContainer><TabPanel>
       <UpdateTemplate><ContentTemplate>
       //now my fields arrive here...

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

Just a thought...
Hopefully you might see the proper solution.
0
Comment
Question by:wahooo
  • 2
4 Comments
 

Author Comment

by:wahooo
ID: 20074943
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:
<DetailsView><Fields><TemplateField><EditItemTemplate>
   //normally the fields would have been visible here, but I am adding:
   <TabContainer><TabPanel>
       //now my fields arrive here...

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

Author Comment

by:wahooo
ID: 20078927
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:
<DetailsView><Fields><TemplateField>
  <InsertItemTemplate>
      <TabContainer><TabPanel...>etc
  <EditItemTemplate>
      <TabContainer><TabPanel...>etc

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...
0
 
LVL 5

Accepted Solution

by:
royend earned 2000 total points
ID: 20081842
I added a response to a similar request at:
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22894290.html

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!
0
 

Expert Comment

by:micjones
ID: 20098311
Do you have any examples that I may use?  Thanks.

mj
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

807 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