GridView with ObjectDataSource. Can't get NewValues & OldValues


X

xs8899

I have a gridview with objectdatasource. The gridview is automatically bind
to my business object.
However when I attempt to update, the NewValues & OldValues properties are
null.
What am I doing wrong when I have UpdateParameters in my ObjectDataSource?

Please find the code below.

---------------------------------------------------------------------------------------------
<asp:GridView ID="master" runat="server" AllowPaging="True"
DataSourceID="ods" AutoGenerateColumns="False"
PagerSettings-Position="TopAndBottom"
PagerSettings-Mode="NumericFirstLast" PageSize="50"
onrowupdating="RowUpdating" >
<PagerSettings Mode="NumericFirstLast"
Position="TopAndBottom" />
<Columns>
<asp:TemplateField HeaderText="Original"
SortExpression="Original">
<EditItemTemplate>
<table>
<tr>
<td>
<b>Term</b><br />
<asp:TextBox ID="term"
runat="server" Width="200px" Text='<%#
((GO)(Container.DataItem)).Original.Term %>' />
</td>
<td>
<b>Language</b><br />
<asp:Literal ID="language"
runat="server" Text='<%#
((GO)(Container.DataItem)).Original.ShortLanguageName %>' />
</td>
</tr>
<tr align="center">
<td>
<asp:LinkButton ID="LinkButton1"
runat="server" CommandName="Update" Text="Save" />
</td>
<td>
<asp:LinkButton ID="LinkButton2"
runat="server" CommandName="Cancel" Text="Cancel" />
</td>
</tr>
</table>
<asp:RequiredFieldValidator
ControlToValidate="term" ID="regTerm" runat="server"
ErrorMessage="<strong>Required Field Missing</strong><br />Term is required."
Display="None" />
<cc1:ValidatorCalloutExtender
ID="ValidatorCalloutExtender1" runat="server" TargetControlID="regTerm" />
</EditItemTemplate>
<ItemTemplate>
<cc1:HoverMenuExtender ID="selectMenu"
runat="server" HoverCssClass="popupHover"
PopupControlID="menu"
PopupPosition="Left" TargetControlID="term" PopDelay="50" />
<asp:Label ID="term" runat="server"
Text='<%# ((GO)(Container.DataItem)).Original.Term %>' />
<asp:panel CssClass="popupMenu" ID="menu"
runat="server">
<div style="border: 1px outset white;
padding: 2px;">
<div>
<asp:LinkButton ID="LinkButton1"
runat="server" CommandName="Edit" Text="Edit" /></div>
<div>
<asp:LinkButton ID="LinkButton2"
runat="server" CommandName="Delete" Text="Delete" /></div>
</div>
</asp:panel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div class="pnl3">
<asp:GridView ID="slave" runat="server">
</asp:GridView>
</div>
<asp:ObjectDataSource ID="ods" runat="server" TypeName="Core2"
OnObjectCreating="OnObjectCreating"
SelectMethod="CoreSearch" UpdateMethod="UpdateTerm">
<UpdateParameters>
<asp:parameter Name="originalTerm" Type="String" />
<asp:parameter Name="originalLanguage" Type="Int32" />
<asp:parameter Name="translatedTerm" Type="String" />
<asp:parameter Name="translatedLanguage" Type="Int32" />
<asp:parameter Name="appName" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="search"
ConvertEmptyStringToNull="False" Name="term"
PropertyName="Text" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top