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"> </td>
<td> </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"> </td>
<td> </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"> </td>
<td> </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"> </td>
<td> </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"> </td>
<td> </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>
-----------------------------------------------------------------------------------