473,394 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Objectdatasource and e.newvalues e.oldvalues

Hello all,

I have used sqldatasource many times calling e.newvalues, and e.oldvalues in the
iteminserting, itemupdating, itemdeleting subs.

When I try using them with the objectdatasource they return no value, which I am assuming they aren't finding the fields.

is anyone having the same problem? I can't figure out what I am doing wrong.

Any help would be appreciated.

code behind --------------------------------------------------------------------------
Protected Sub FormViewAccountSettings_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles FormViewAccountSettings.ItemUpdating

'insert new image

e.NewValues("ProfilePicture") = e.OldValues("ProfilePicture")


'Insert new password
e.NewValues("UserPassword") = e.OldValues("UserPassword")


End Sub


------------------------------------------------------------------------


------------------------------------------------------------------------

<asp:FormView ID="FormViewAccountSettings" runat="server" DataKeyNames="UserAccountsID" DataSourceID="ObjectDataSourceAccountSettings" DefaultMode="Edit">

<EditItemTemplate>
<div style="padding: 7px; border: 1px solid #aeadad; margin: 0px; background-color: #FFFFFF;">
<div style="padding: 3px; border: 1px solid #aeadad;">



<table style="width: 100%">
<tr>
<td style="width: 225px" align="right">
Nickname:</td>
<td>
<asp:TextBox runat="server" id="nickname" Width="242px" Text='<%# Bind("Nickname")%>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px" align="right">
Gender:</td>
<td>
<asp:DropDownList runat="server" id="GenderDD" Selectedvalue='<%# Bind("Gender")%>'>
<asp:ListItem Text="Male" Value="Male"></asp:ListItem>
<asp:ListItem Text="Female" Value="Female"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td style="width: 225px">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 225px" align="right">First
Name:</td>
<td>
<asp:TextBox runat="server" id="FirstName" Width="242px" Text='<%# Bind("FirstName")%>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px" align="right">Last
Name:</td>
<td>
<asp:TextBox runat="server" id="LastName" Width="242px" Text='<%# Bind("LastName")%>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 225px" align="right">
Profile Photo:</td>
<td>
<asp:FileUpload runat="server" id="FileUploadProfilePhoto" Width="377px" /></td>
</tr>
<tr>
<td style="width: 225px">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 225px" align="right">Email</td>
<td>
<asp:TextBox runat="server" id="Email" Width="201px" Text='<%# Bind("Email")%>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 225px; height: 23px" align="right">
Password1:</td>
<td style="height: 23px">
<asp:TextBox runat="server" id="Password1" Width="242px" TextMode="Password">
</asp:TextBox><asp:CompareValidator ID="CompareValidatorPassword" runat="server" ErrorMessage="Passwords must match" ControlToCompare="Password1" ControlToValidate="Password2">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td style="width: 225px" align="right">
Password2:</td>
<td>
<asp:TextBox runat="server" id="Password2" Width="242px" TextMode="Password">
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 225px" align="right">Hint
Question:</td>
<td>
<asp:TextBox runat="server" id="HintQuestion" Width="242px" TextMode="MultiLine" Height="50px" Text='<%# Bind("HintQuestion")%>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px" align="right">Hint
Answer:</td>
<td>
<asp:TextBox runat="server" id="HintAnswer" Width="242px" Text='<%# Bind("HintAnswer")%>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px" align="right"></td>
<td align="right">
<asp:LinkButton ID="ButtonUpdate" runat="server" Text="Update" CommandName="Update"></asp:LinkButton>
</td>
</tr>
</table>



</div>




</EditItemTemplate>


</asp:FormView>







</div>
<asp:ObjectDataSource ID="ObjectDataSourceAccountSettings" runat="server"
SelectMethod="GetAccountSettings" UpdateMethod="UpdateAccountSettings" TypeName="Dal">
<SelectParameters>
<asp:SessionParameter Name="UserAccountsID" SessionField="UserAccountsID" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ProfilePicture" />
</UpdateParameters>

</asp:ObjectDataSource>

-----------------------------------------------------------------------------------
Aug 3 '07 #1
1 2917
ok , this worked. I don't know if this is the solution, or a work around but I just added

<asp:HiddenField ID="HiddenFieldProfilePicte" runat="server" Value='<%# Bind("ProfilePicture")%>' />

and same with the other field in the vb code and it worked.
Aug 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
5
by: Ole M | last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0. I have a wrapper that contains the static methods for Select and Update. The Update-method takes the business object as...
5
by: Mark Olbert | last post by:
I ran into a situation this morning where the RowUpdating event of a GridView kept insisting there were no entries in either the OldValues or NewValues dictionaries. The GridView is bound to a...
0
by: Keith Jackson | last post by:
I have, over the last week, been attempting to play with the ObjectDataSource binding an ASP.NET 2.0 UI through to a Data Access Assembly. Selection of data using the new GridView control worked...
0
by: loga123 | last post by:
Hi All, I am using asp.net 2.0. I have a gridview with AutoGenerateEditButton="True" . I am trying to access newValues in rowupdating event. It gives me "oldvalues" collection. I have a)...
0
by: loga123 | last post by:
Hi All, I am using asp.net 2.0. I have a gridview with AutoGenerateEditButton="True" . I am trying to access newValues in rowupdating event. It gives me "oldvalues" collection. I have a)...
3
by: Haleigh | last post by:
I just started a few days ago, so I'm very new to this. I'm trying to update a gridview using a store procedure. When I am in the update subroutine, newvalues and oldvalues are empty, plus count is...
4
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters...
0
by: lightgram | last post by:
Hello I am having problems extracting the OldValues collection from the RowUpdating event in my GridView. Every time I access this I am getting the values from the NewValues collection in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.