What happen to the DetailView, oldValues and newValues are the same....

Discussion in 'ASP .Net' started by LamSoft, Jul 5, 2007.

  1. LamSoft

    LamSoft Guest

    In the object of detailView, i added a function to check the values during itemUpdating, the source is:

    protected void test2(object sender, DetailsViewUpdateEventArgs e)
    {
    foreach (System.Collections.DictionaryEntry o in e.OldValues)
    {
    Response.Write("Old Values:" + o.Key.ToString() + "==>" + o.Value + "<br/>");
    }
    foreach (System.Collections.DictionaryEntry o in e.NewValues)
    {
    Response.Write("New Values:" + o.Key.ToString() + "==>" + o.Value + "<br/>");
    }
    Response.End();
    }

    <asp:DetailsView ID="dv_ServerInformation" runat="server" AutoGenerateEditButton="True" AutoGenerateRows="False" DataSourceID="sDS_ServerInformation" Height="50px" Width="80%" OnItemUpdated="test" DataKeyNames="server_id" OnItemUpdating="test2">
    <Fields>
    <asp:BoundField DataField="serverip" HeaderText="Server IP" ReadOnly="True" SortExpression="serverip" />
    <asp:BoundField DataField="location" HeaderText="Location" SortExpression="location" />
    <asp:BoundField DataField="server_owner" HeaderText="Server Owner" SortExpression="server_owner" />
    <asp:BoundField DataField="application" HeaderText="Server Application" SortExpression="application" />
    <asp:BoundField DataField="backup_type" HeaderText="Backup Type" SortExpression="backup_type" />
    <asp:BoundField DataField="remark" HeaderText="Remark" SortExpression="remark" />
    <asp:BoundField DataField="server_id" HeaderText="server_id" SortExpression="server_id"
    Visible="False" />
    </Fields>
    </asp:DetailsView>

    While a user modify some values in the detailview and click update, the new values in the object "e" should be different from the old values, however the result is same.... which made me fail to update database (because old values and new values are the same, nothing updated...), is it a bug or anything i made wrong? Thanks

    Old Values:serverip==>10.10.10.193
    Old Values:location==>5555
    Old Values:server_owner==>55555
    Old Values:application==>55
    Old Values:backup_type==>55555555
    Old Values:remark==>555555
    New Values:location==>5555
    New Values:server_owner==>55555
    New Values:application==>55
    New Values:backup_type==>55555555
    New Values:remark==>555555
    LamSoft, Jul 5, 2007
    #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. rahulsurya
    Replies:
    0
    Views:
    503
    rahulsurya
    Dec 12, 2007
  2. Marius Manolea
    Replies:
    0
    Views:
    1,023
    Marius Manolea
    Jun 4, 2008
  3. 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,308
    Rachna
    Nov 19, 2007
  4. Doug Kent

    OldValues and NewValues collections are empty

    Doug Kent, Jul 30, 2008, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    893
    Doug Kent
    Jul 31, 2008
  5. Doug Kent

    OldValues and NewValues collections are empty

    Doug Kent, Jul 30, 2008, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    173
    Doug Kent
    Jul 30, 2008
Loading...

Share This Page