473,839 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Objectdatasourc e and e.newvalues e.oldvalues

62 New Member
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 objectdatasourc e 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 FormViewAccount Settings_ItemUp dating(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Form ViewUpdateEvent Args) Handles FormViewAccount Settings.ItemUp dating

'insert new image

e.NewValues("Pr ofilePicture") = e.OldValues("Pr ofilePicture")


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


End Sub


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


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

<asp:FormView ID="FormViewAcc ountSettings" runat="server" DataKeyNames="U serAccountsID" DataSourceID="O bjectDataSource AccountSettings " DefaultMode="Ed it">

<EditItemTempla te>
<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:DropDownLi st runat="server" id="GenderDD" Selectedvalue=' <%# Bind("Gender")% >'>
<asp:ListItem Text="Male" Value="Male"></asp:ListItem>
<asp:ListItem Text="Female" Value="Female"> </asp:ListItem>
</asp:DropDownLis t>
</td>
</tr>
<tr>
<td style="width: 225px">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 225px" align="right">F irst
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">L ast
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:FileUplo ad runat="server" id="FileUploadP rofilePhoto" Width="377px" /></td>
</tr>
<tr>
<td style="width: 225px">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 225px" align="right">E mail</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="Passw ord">
</asp:TextBox><as p:CompareValida tor ID="CompareVali datorPassword" runat="server" ErrorMessage="P asswords must match" ControlToCompar e="Password1" ControlToValida te="Password2"> *</asp:CompareVali dator>
</td>
</tr>
<tr>
<td style="width: 225px" align="right">
Password2:</td>
<td>
<asp:TextBox runat="server" id="Password2" Width="242px" TextMode="Passw ord">
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 225px" align="right">H int
Question:</td>
<td>
<asp:TextBox runat="server" id="HintQuestio n" Width="242px" TextMode="Multi Line" Height="50px" Text='<%# Bind("HintQuest ion")%>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px" align="right">H int
Answer:</td>
<td>
<asp:TextBox runat="server" id="HintAnswer " Width="242px" Text='<%# Bind("HintAnswe r")%>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 225px" align="right"></td>
<td align="right">
<asp:LinkButt on ID="ButtonUpdat e" runat="server" Text="Update" CommandName="Up date"></asp:LinkButton>
</td>
</tr>
</table>



</div>




</EditItemTemplat e>


</asp:FormView>







</div>
<asp:ObjectData Source ID="ObjectDataS ourceAccountSet tings" runat="server"
SelectMethod="G etAccountSettin gs" UpdateMethod="U pdateAccountSet tings" TypeName="Dal">
<SelectParamete rs>
<asp:SessionPar ameter Name="UserAccou ntsID" SessionField="U serAccountsID" />
</SelectParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="ProfilePi cture" />
</UpdateParameter s>

</asp:ObjectDataS ource>

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

<asp:HiddenFiel d ID="HiddenField ProfilePicte" runat="server" Value='<%# Bind("ProfilePi cture")%>' />

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
8710
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 update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
5
1993
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 parameter. When the Update-method is invoked by the ObjectDataSource, the object referenced is not the same object returned by the Select-method, but a new object with only the values from the Edit-template. So basically I get a reference to a useless...
5
8371
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 strongly-typed collection, derived from CollectionBase, through the control's datasource property at runtime. From some googling it appears that, at least in the release candidate for NET2 this was a known bug; only binding to DataSources lets those...
0
1336
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 flawlessly but, on attempting any kind of data writing, the system produced the following error... "The DateModified field could not be converted from System.String to System.DateTime"
0
2780
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) datakeynames property set b) I am using template fields in my gridview and have "EVAL" for ItemTemplate and "BIND" for EditItemTemplate
0
1416
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) datakeynames property set b) I am using template fields in my gridview and have "EVAL" for ItemTemplate and "BIND" for EditItemTemplate
3
3364
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 zero. Here is the code I have. What I really want to do is get the changed value for startdate and endate just before doing an update. Thanks <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"...
4
6088
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 are being populated. Integers are being passed as 0 and strings are empty regardless of what I changed them to in Edit mode on the GridView. My object method to perform the update:
0
2458
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 both OldValues and NewValues. I am fairly sure that the data is not being rebound prior to the updating event. I have posted my code below. Thanks in advance.
0
10908
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10586
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7828
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5866
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4484
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3134
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.