Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6596665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:06:20+00:00 2026-05-25T18:06:20+00:00

I have a .Net 3.5 application with a simple form view and an object

  • 0

I have a .Net 3.5 application with a simple form view and an object data source.

<asp:ObjectDataSource ID="odsDevice" runat="server" SelectMethod="GetDeviceByDeviceNumber" EnableViewState="True"
     UpdateMethod="updateDevice" DataObjectTypeName="GPSO.Repository.Device" TypeName="GPSOnline.ATOMWebService">
<SelectParameters>
    <asp:SessionParameter DbType="Guid" Name="deviceid" SessionField="deviceid" />
</SelectParameters>

and here is the form view

<asp:FormView ID="fvDevices" runat="server" DataSourceID="odsDevice">
<EditItemTemplate>
    <table cellpadding="0" cellspacing="0" class="AdminContent">
        <tr>
            <td class="Content">
                <h1>
                    Device Details</h1>
                <hr />
                <table class="AdminDetails" cellpadding="0" cellspacing="0">
                    <tr>
                        <th>
                            Atom Serial #
                        </th>
                        <td class="control">
                            <asp:TextBox ID="txtDeviceNumber" runat="server" Text='<%#Bind("DeviceNumber")%>' />
                        </td>
                    </tr>
                    <tr>
                        <th>
                            &nbsp;
                        </th>
                        <td class="control">
                            <asp:RequiredFieldValidator ID="rfvDeviceNumber" runat="server" ToolTip="Must specify Device Number"
                                Display="Dynamic" ErrorMessage="Device Number is Required" EnableClientScript="false"
                                ControlToValidate="txtDeviceNumber"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="revDeviceAddId" runat="server" ToolTip="Device ID must be an Integer."
                                ValidationExpression="[0-9]{1,6}" Display="Dynamic" ErrorMessage="Device ID must be an Number, less then 1000000."
                                EnableClientScript="false" ControlToValidate="txtDeviceNumber"></asp:RegularExpressionValidator>
                            <asp:CustomValidator ID="cvDeviceAddId" runat="server" ErrorMessage="Device ID already Exists."
                                Display="Dynamic" ToolTip="Device ID already Exists." ControlToValidate="txtDeviceNumber"
                                OnServerValidate="CheckDeviceDoesNotExist"></asp:CustomValidator>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            &nbsp;
                        </th>
                        <td class="control">
                            <asp:Label runat="server" ForeColor="Red" ID="lblFeedback" Text="" />
                        </td>
                    </tr>
                    <tr>
                        <th>
                            &nbsp;
                        </th>
                        <td class="control">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <th>
                            &nbsp;
                        </th>
                        <td class="control">
                            <asp:Button runat="server" ID="btnUpdate" Text="Update" CausesValidation="true" CommandName="Update"
                                Width="160px" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</EditItemTemplate>

and here is the code for the object data source methods.

    [OperationContract]
    [WebGet]
    public  void updateDevice(Device device)
    {
        DeviceRep.updateDevice(device);

    }

    [OperationContract]
    [WebGet]
    public Device GetDeviceByDeviceNumber(Guid deviceid)
    {
        return DeviceRep.GetDeviceByDeviceNumber(deviceid);}

Now the business object contains a far few fields that I am not interested in for the update, I only really want to update the Device Number.

However the problem I have is that the device object that I get as a parameter into the ” public void updateDevice(Device device)” method does not have an ID for the object that is being updated. Which make it impossible to know which record in the repository to update.

Is there a way to persist the ID of the device so that its part of the object when it comes to be updated?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:06:20+00:00Added an answer on May 25, 2026 at 6:06 pm

    Not sure but you have to set DataKeyNames property of FormView with,

     <asp:FormView ID="fvDevices" runat="server" 
       DataSourceID="odsDevice" DataKeyNames="deviceid" ..
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning Entity Framework 4. I have a simple ASP.NET (Web Form) application.
Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have
A simple question. I have an ASP.NET web application which contains several assemblies and
I have a really simple ASP.NET web application and a web setup project that
We have a very simple ASP.NET web application comprising mostly static content and a
Hi I am developing a simple application based upon ASP.NET MVC. I have altered
Let's say I have a simple ASP.NET MVC blog application and I want to
I created a simple ASP.NET MVC version 1.0 application. I have a ProductController which
I have a simple form in ASP.NET MVC. I am trying to post these
I have a simple Windows Form application that is using the .net 3.5 compact

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.