ObjectDataSource 'odsUser' has no values to insert. Check that the 'values' dictionary contains values

Hi All! I am currently trying to pull 2 values from two different sources (Details View & a Session) to use in a Stored Proceedure.  I have spent quite a bit of time trying to determine what is occuring without any luck. However, by the Subject Line you can tell that it's not getting anything for some reason?  

Here are the components:

Object Datasource:
<asp:ObjectDataSource ID="odsUser" runat="server" DataObjectTypeName="System.Nullable`1[[System.Int32, mscorlib, Version=, Culture=neutral, PublicKeyToken=************]]"
DeleteMethod="RemoveEnrollment" InsertMethod="AddEnrollment" OldValuesParameterFormatString
SelectMethod="GetActivitiesByUser" TypeName
<asp:SessionParameter Name="UserName" SessionField="UserName" Type="String"
<asp:Parameter Name="UserName" Type="String"
<asp:Parameter Name="iActivityID" Type="Int32"

This Object Datasource runs the following Stored Procedure:
tblUserActivity (UserName, iActivityID)
(@UserName, @iActivityID)

The problem that is occuring is that after pulling data into the details view I am unable to retrieve both the ActivityID from the Details View  & the UserName from the session. I have verified in the Trace log that both a Session Key and a QueryString Collection Exists.

Details View:
<asp:DetailsView ID="dvActivity" runat="server" AutoGenerateRows="False" DataKeyNames
DataSourceID="odsActivity" Height="50px" Width
<asp:BoundField DataField="iActivityID" HeaderText="iActivityID" InsertVisible
ReadOnly="True" SortExpression="iActivityID"
<asp:BoundField DataField="vcTitle" HeaderText="vcTitle" SortExpression="vcTitle"
<asp:BoundField DataField="vcDescription" HeaderText="vcDescription" SortExpression="vcDescription"
<asp:BoundField DataField="dtDateOfActivity" HeaderText="dtDateOfActivity" SortExpression="dtDateOfActivity"
<asp:BoundField DataField="vcStartTime" HeaderText="vcStartTime" SortExpression="vcStartTime"
<asp:BoundField DataField="vcEndTime" HeaderText="vcEndTime" SortExpression="vcEndTime"
<asp:BoundField DataField="iTotalSlots" HeaderText="iTotalSlots" SortExpression="iTotalSlots"
<asp:CheckBoxField DataField="bIsPublished" HeaderText="bIsPublished" SortExpression="bIsPublished"

Code to create the Session:
protected void Page_Load(object sender, EventArgs
if (!Page
//Session["UserName"] = HttpContext.Current.User.Identity.Name;
Session["UserName"] = Membership
//Session["UserName"] = HttpContext.Current.User.Identity.Name;
//Session["@User"] = Page.User.Identity.Name.ToString;

Button Click Method:
protected void btnEnroll_Click(object sender, EventArgs e)
if (Session["UserName"] != null
string UserName = (string)(Session["UserName"
Label1.Text = UserName;
Label1.Text =
"Has No Value";

If I test to see if a session is available without running the insert method all looks good and a UserName is returned.  If  I run the method with
I receive the error shown on the Subject Line!!!

As I am new to programing I am sure that is probably all to easy however, through my research I have been unable to find an awnser!!!


9/25/2005 11:30:21 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 17

When using the Insert method you have to set the insert parameters. Try to use the DetaislView's InsertItem method instead.
/Fredrik Normén - fredrikn @ twitter

Microsoft MVP, MCSD, MCAD, MCT

My Blog
9/26/2005 5:15:14 AM

I am not sure how I can do this as the reading that is available seems to be limmited to providing out of the box support. It appears from the reading I have done that you can only Insert values that are available to the Details View Container and must be in Edit Mode to run the Insert?

I am also confused as to how I would get the Session Value (UserName) over to the Details View for use with the Insert Method?

Please Help! I am Lost!!! 

P.S.S.  I was also wondering if it might be easier to move all the values to a Label and calling the  Stored Proceedure that way?  I have spent the day with this as well and I was unable to find a way to pull the Activity ID from the Details View over to the Label....

Your Time Is Sincerely Appreciated!!!


9/28/2005 12:59:27 AM
I am still lost but I found an article written by Fredrik that seems potential but I have to end my studying tonight for a tuff 4:30 A.M. Wake-up. What I found was an article about an insert using Gridview (Gridview does not support inserting by default). I will need this for either type.  I am still lost as to how I can add the Session Value to the Gridview for this event.

If anyone is interested in his article about inserting with Gridview take a look: http://fredrik.nsquared2.com/viewpost.aspx?PostID=155 Inspiring!!!

If anyone has any ideas or some good reading to put me in the right direct please feel free to add to the string!!!
9/30/2005 2:29:03 AM

This post was edited by XIII for better readibility:

Hello Everyone, I am still lost. I thought I would try to give you some psudocode as to what I am trying to do. I have implemented some new steps for you to look at and hoping someone could point me in the right direction!!!

As you remember  you thought that it might be easier to implement an insert from within the Details View. I am having a hard time comprehending what needs to be done. Here is what is happening.

From a previous page I am passing data from a Grid View to my Details View on the current page. I want to catch the UserName from a Session and an ActivityID from the Gridview and then run a stored proceedure that will insert into a second table and read back the data to a Grid View for a user to verify that they have been added or enrolled.

I havent been able to make this work with a simple objectdatsource.insert() in which worked in a previous lab due to the update to beta 2.
I have currently implemented a new method to get the values and am trying to insert into the Dictionary w/out any luck.

New Implementation:
protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
//Session["UserName"] = Membership.GetUser().UserName;
if (Session["UserName"] != null)
string UserName = (string)(Session["UserName"]);
Label1.Text = UserName;
// Retrieve the key field value.
//String keyValue = "iActivityID".ToString();
DataKey key = DetailsView1.DataKey;
// Insert the record only if a Value exists.
// otherwise, cancel the insert operation.
if (key.Value != null)
Label2.Text = key.Value.ToString();
e.Cancel =
Label2.Text =
"No Value";
e.Cancel =
IDictionary.Add["UserName"] = Label1.Text;
IDictionary.Add["iActivityID"] = Label2.Text;

There has to be an easier way to do this!!!  Please help as I believe I am getting deeper and deeper in the hole!!!

Thanks Again!!!

10/2/2005 2:32:16 PM

Similar Artilces:

GridView: ObjectDataSource has no values to insert. Check that the 'values' dictionary contains values.
Hi, I have a grid view, bound to the following object data source: <asp:ObjectDataSource ID="_odsMySampleTable"  runat="server"  SelectMethod="OnSelectAll" TypeName="SampleObjectDataSourceController" DataObjectTypeName="MyItem" InsertMethod="OnInsertItem" ></asp:ObjectDataSource> My OnInsertItem has the following signature: [DataObjectMethod( DataObjectMethodType.Insert )]public int OnInsertItem( MyItem item ) { ... } Now when I make the following call: _odsMySampleTable.Insert(); I get the following error: Exception Details: System.InvalidOperationExceptio...

Check that the 'values' dictionary contains values.
I'm using ObjectDataSource control to insert record in oracle database table "Employee" which has EMP_CODE as a primary key & accepts value from user (no sequence is created). I have set input parameters also  but while executing the Insert() of ObjectDataSource control it throws exception as((System.InvalidOperationException)) & description as "{"ObjectDataSource 'odsEmployee' has no values to insert. Check that the 'values' dictionary contains values."}". My code is as follows :aspx page <form id="form1" ...

value of variable switches from ' ' to 'value'
--------------000108090907030800060105 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I'm trying to figure out what exactly a script I wrote (see the attachment) is doing by stepping through it in the debugger. I have an array of dates in %Y-%m-%d format for each of the last 7 days. So, for instance, the range of dates for today (June 17, 2007) is from the 10th to the 16th. I then take these dates and use them to find work tickets in our ticketing system which were last updated on the day currently being checked. So, the first date would be 200...

how to specify 'near to' value and 'from-to' value
Hi, I have a property search  with a ability to enter minimum and maximum price and also a sq. m. area size. How do I implement this in my sql query  - 'from-to' value and 'near to' value ThanksAndy Current project: Cycle round the world  Hi,you could use the BETWEEN statement. SELECT PropertyName, Price WHERE Price BETWEEN 100 AND 500  for your "NEAR TO" search you also could use the BETWEEN statement. SELECT PropertyName, Price WHERE Price BETWEEN @SearchValue - 100 AND @SearchValue + 100 Hope this helps :-) ...

'Value' should be between 'minimum' and 'maximum'.
I'm attempting to invoke with parameters:  Dim thing2 As New mydelsubPBStep(AddressOf pbStep) Me.Invoke(thing2, "setMax", dt.Rows.Count)      <---- this is where the error occurs   the delegate looks like this: Private Delegate Sub mydelsubPBStep(ByVal mode As String, ByVal value As Integer)   the function it's calling looks like this:Private Sub pbStep(ByVal mode As String, ByVal value As Integer) Select Case mode.ToLower Case "clear" ProgressBar1.Value = 0 Case "step" ProgressBar1.PerformStep() L...

How to INSERT INTO [Table] ([Field]) VALUES('I Have a ' in value')
Hi, I want to INSERT INTO [Table] ([Field]) VALUES('I Have a ' in value') please teach me how to xxx INSERT INTO [Table] ([Field]) VALUES('I Have a '' in value') instead of one single quote, u need to add one more.Om Prakash Use Parameterized Queries ...you woudnt have to worry about escape characters besides saving your db from sqlinjection attacks. hth***********************Dinakar NethiLife is short. Enjoy it.***********************...

Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/ GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Why 'and' not '&&' ? (was Cleaning up 'uninitialized value')
> Use: > > if (@ARGV and -T $ARGV[0]) { ... } Just wondering if there is a reason for using the lower precedence 'and' here instead of '&&'? I haven't been finding many uses for 'and' which tells me I might not fully understand it. Thanks, Peter C. On May 30, Peter Cornelius said: >> if (@ARGV and -T $ARGV[0]) { ... } > >Just wondering if there is a reason for using the lower precedence 'and' >here instead of '&&'? I haven't been finding many uses for 'and' which >tells...

why a string column with a '' value synchronize from ASE to ASA, in ASA it's value become ' ' with a blank in it?
"darcy.zhai" <zhaizy@e-future.com.cn> wrote in news:43967064@forums-2-dub of sybase.public.sqlanywhere.mobilink: Please try to ask your question in the _body_ of the post, not the subject line. There are many people that never really look at the subject line (like myself most of the time). > why a string column with a '' value synchronize from ASE to ASA, in > ASA it's value become ' ' with a blank in it? This has to do with nullability. First, connect to ASE via ISQL and try the same query ML is executing. What is returned? An...

RGB values of 'Transparent' and 'ButtonFace'
Hi, I want to dynamicaly change the colorvalues of some controls. But what are the color or RGB-values of 'Transparent','ButtonFace' and this colors like 'Mint','Sky' and 'Cream'???? Is there any way to get these colors? Roy Bungert /* COLOURS RGB coded */ constant long BUTTONFACE = 78682240 constant long WINDOW_BACKGROUND = 1087434968 constant long WINDOW_TEXT = 33554592 constant long APPLICATION_WORKSPACE = 268435456 constant long TRANSPARENT = 553648127 constant long DEFAULT_REQUIREDCOLOR = RGB(255, 255, 230) constan...

Compile time error: "[value] is not a valid value for the 'color' (or 'background-color') property
Greetings:  Have tried searching for anything to do with this error message and I either get far too many results to search or nothing at all. So here's the problem. In a CSS style sheet I have built various styles selecting colours from the IDE's color picker/web colors tab. Two of the colors for example are 'named' "cornflower blue" and "crimson". If I preview a page in the browser with styles containing these 'values' (which are written into the style sheet as their names not Hex or RGB values), everything is fine. But if I run the app in debug...the compiler with throw these error...

INSTALLSCRIPT doesn't have 'site', 'vendor' values?

Cannot convert value of parameter 'Course_FK' from 'System.String' to 'System.Guid'
Hi, I'm building a site and I've been trying to accomplish something similar to what is talked about in "Working with Data in ASP.NET 2.0 :: Declarative Parameters" tutorial. Below is the code for my methods from the xsd. I tried to attach a screenshot of my xsd but for some reason I'm not allowed GetAllCourseNames() SELECT        CourseID, NameFROM            Course GetCourseScheduleByCourseID SELECT        ScheduleID, Course_FK, Date, TeeTime, NumberOfPlayersF...

Web resources about - ObjectDataSource 'odsUser' has no values to insert. Check that the 'values' dictionary contains values - asp.net.presentation-controls

Resources last updated: 11/21/2015 1:39:16 PM