GridView with ObjectDataSource. Can't get NewValues & OldValues

Discussion in 'ASP .Net' started by xs8899, May 22, 2009.

  1. xs8899

    xs8899 Guest

    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>
     
    xs8899, May 22, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Olbert

    GridView: Empty OldValues, NewValues

    Mark Olbert, Jan 19, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    12,416
    jfortier2
    Jul 22, 2006
  2. loga123
    Replies:
    0
    Views:
    1,474
    loga123
    Jun 23, 2006
  3. Replies:
    1
    Views:
    1,070
  4. Ryan
    Replies:
    1
    Views:
    171
  5. Pulkit Sharma

    Gridview e.OldValues and e.NewValues are nothing

    Pulkit Sharma, Jul 24, 2007, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    1,352
    Rachna
    Nov 19, 2007
Loading...

Share This Page