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

  • Home
  • SEARCH
  • 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 7058329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:05:59+00:00 2026-05-28T04:05:59+00:00

I am writing an asp.net program for creating reservations in which I have a

  • 0

I am writing an asp.net program for creating reservations in which I have a listview control connected to an SQL database. The user enters most of the information to be sent to the database (name, phone-number, etc..) however there is some info (the current date/time for example) that I would like to be automatically populated before being added to the db. I would like to set this up in the code-behind (C#), but I cannot seem to figure out the proper way to do it. Any thoughts would be greatly appreciated!

Here is my current code:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SummaryForm.ascx.cs" Inherits="RamRideOps.Controls.SummaryForm" %>

<asp:EntityDataSource ID="Rides_EDS" runat="server" 
ConnectionString="name=RamRideOpsEntities" 
DefaultContainerName="RamRideOpsEntities" EnableFlattening="False" 
EntitySetName="Rides" EntityTypeFilter="Ride" EnableDelete="True" 
EnableInsert="True" EnableUpdate="True">
</asp:EntityDataSource>

<asp:ListView ID="SummaryLV" runat="server" DataKeyNames="TimeOfCall" 
DataSourceID="Rides_EDS" InsertItemPosition="LastItem" 
onselectedindexchanged="ListView1_SelectedIndexChanged">
<AlternatingItemTemplate>
    <tr style="background-color:#FFF8DC;">           
        <td>
            <asp:Label ID="TimeOfCallLabel" runat="server" 
                Text='<%# Eval("TimeOfCall") %>' />
        </td>           
        <td>
            <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
        </td>
        <td>
            <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />
        </td>
        <td>
            <asp:Label ID="NumPatronsLabel" runat="server" 
                Text='<%# Eval("NumPatrons") %>' />
        </td>
        <td>
            <asp:Label ID="PickupAddressLabel" runat="server" 
                Text='<%# Eval("PickupAddress") %>' />
        </td>            
        <td>
            <asp:Label ID="DropoffAddressLabel" runat="server" 
                Text='<%# Eval("DropoffAddress") %>' />
        </td>
        <td>
            <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>' />
        </td>
        <td>
            <asp:Label ID="AssignedCarLabel" runat="server" 
                Text='<%# Eval("AssignedCar") %>' />
        </td>
        <td>
            <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
            <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delt" />                
        </td>
    </tr>
</AlternatingItemTemplate>
<EditItemTemplate>
    <tr style="background-color:#008A8C;color: #FFFFFF;">
        <td>
            <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
        </td>
        <td>
            <asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Bind("Phone") %>' />
        </td>
        <td>
            <asp:TextBox ID="NumPatronsTextBox" runat="server" 
                Text='<%# Bind("NumPatrons") %>' />
        </td>
        <td>
            <asp:TextBox ID="PickupAddressTextBox" runat="server" 
                Text='<%# Bind("PickupAddress") %>' />
        </td>            
        <td>
            <asp:TextBox ID="DropoffAddressTextBox" runat="server" 
                Text='<%# Bind("DropoffAddress") %>' />
        </td>
        <td>
            <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' />
        </td>
        <td>
            <asp:TextBox ID="AssignedCarTextBox" runat="server" 
                Text='<%# Bind("AssignedCar") %>' />
        </td>
        <td>
            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                Text="Update" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Cancel" />
        </td>
    </tr>
</EditItemTemplate>
<EmptyDataTemplate>
    <table runat="server" 
        style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
        <tr runat="server">
            <td runat="server">
                There are currently no scheduled rides!</td>
        </tr>
    </table>
</EmptyDataTemplate>
<InsertItemTemplate>
    <tr style="">
        <td>
            <asp:TextBox ID="TimeOfCallTextBox" runat="server" 
                Text='<%# Bind("TimeOfCall") %>' Visible="False" />
        </td>
        <td>
            <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
        </td>
        <td>
            <asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Bind("Phone") %>' />
        </td>
        <td>
            <asp:TextBox ID="NumPatronsTextBox" runat="server" 
                Text='<%# Bind("NumPatrons") %>' />
        </td>
        <td>
            <asp:TextBox ID="PickupAddressTextBox" runat="server" 
                Text='<%# Bind("PickupAddress") %>' />
        </td>
        <td>
            <asp:TextBox ID="DropoffAddressTextBox" runat="server" 
                Text='<%# Bind("DropoffAddress") %>' />
        </td>
        <td>
            <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' Visible="True" />
        </td>
        <td>
            <asp:TextBox ID="AssignedCarTextBox" runat="server" 
                Text='<%# Bind("AssignedCar") %>' />
        </td>
        <td>
            <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                Text="Add" OnClientClick="addButton_Click" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Clear" />
        </td>
    </tr>
</InsertItemTemplate>
<ItemTemplate>
    <tr style="background-color:#DCDCDC;color: #000000;">     
        <td>
            <asp:Label ID="TimeOfCallLabel" runat="server" 
                Text='<%# Eval("TimeOfCall") %>' />
        </td>           
        <td>
            <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
        </td>
        <td>
            <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />
        </td>
        <td>
            <asp:Label ID="NumPatronsLabel" runat="server" 
                Text='<%# Eval("NumPatrons") %>' />
        </td>
        <td>
            <asp:Label ID="PickupAddressLabel" runat="server" 
                Text='<%# Eval("PickupAddress") %>' />
        </td>            
        <td>
            <asp:Label ID="DropoffAddressLabel" runat="server" 
                Text='<%# Eval("DropoffAddress") %>' />
        </td>
        <td>
            <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>' />
        </td>
        <td>
            <asp:Label ID="AssignedCarLabel" runat="server" 
                Text='<%# Eval("AssignedCar") %>' />
        </td>
        <td>
            <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
            <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delt" />                
        </td>
    </tr>
</ItemTemplate>

<LayoutTemplate>
    <table runat="server">
        <tr runat="server">
            <td runat="server">
                <table ID="itemPlaceholderContainer" runat="server" border="1" 
                    style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                    <tr runat="server" style="background-color:#DCDCDC;color: #000000;">
                        <th runat="server" style="width:auto">
                            Call Time</th>                            
                        <th runat="server" style="width:auto">
                            Name</th>
                        <th runat="server" style="width:5px">
                            Phone</th>
                        <th runat="server" style="width:auto">
                            Size</th>
                        <th runat="server" style="width:auto">
                            Pick-Up</th>
                        <th runat="server" style="width:auto">
                            Drop-Off</th>
                        <th runat="server" style="width:auto">
                            Status</th>
                        <th runat="server" style="width:auto">
                            Car</th>
                        <th id="Th1" runat="server">
                            </th>
                    </tr>
                    <tr ID="itemPlaceholder" runat="server">
                    </tr>
                </table>
            </td>
        </tr>
        <tr runat="server">
            <td runat="server" 
                style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                <asp:DataPager ID="DataPager1" runat="server">
                    <Fields>
                        <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                            ShowLastPageButton="True" />
                    </Fields>
                </asp:DataPager>
            </td>
        </tr>
    </table>
</LayoutTemplate>

  • 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-28T04:05:59+00:00Added an answer on May 28, 2026 at 4:05 am

    Use the EntityDataSource.Inserting or EntityDataSource.Updating event to access the object you are saving.

    You can access the entity property to change the values in your object like this:

    // E.g. Inserting
    protected void Rides_EDS_DataSource_Inserting(object sender, EntityDataSourceChangingEventArgs e)
    {
        var rides = (e.Entity as Rides);
        rides.Date = DateTime.Now;
        rides.Total = Fee + Tax;
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET program that is writing date to an SQLExpress Database date
I'm writing a program which has both an ASP.NET configuration system and a Silverlight
I am writing an asp.net application and have a form where a user must
I was writing some ASP.NET control when I came to the scenario where I
I'm writing an ASP.Net webform with some DropDownList controls on it. Then user changes
I come from an ASP .Net background. I am now writing a Java program
I've been writing asp.net apps with SQL Server back ends for the past 10
I am writing a web app in asp.net. I have an aspx page that
Background: I'm writing ASP.NET MVC 3 Web app. I have a List<MyObject> (actually several
I am writing asp.net website which will going to be host on public network.

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.