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 4544026
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:36:49+00:00 2026-05-21T15:36:49+00:00

<asp:TabPanel ID=AbsentTabPanel runat=server HeaderText=Excused Absences> <ContentTemplate> <asp:ListView ID=AbsentListView runat=server InsertItemPosition=LastItem DataSourceID=AbsentSqlDataSource DataKeyNames=> <InsertItemTemplate> <tr>

  • 0
    <asp:TabPanel ID="AbsentTabPanel" runat="server" HeaderText="Excused Absences">
        <ContentTemplate>
        <asp:ListView ID="AbsentListView" runat="server" InsertItemPosition="LastItem"
                DataSourceID="AbsentSqlDataSource" DataKeyNames="">

            <InsertItemTemplate>
                <tr>
                    <td>
                        <asp:DropDownList ID="ExcusedAbsences_employee_idDropDownList2" runat="server">
                            <asp:ListItem Text="John Smith" Value="1" />
                            <asp:ListItem Text="Indiana Jones" Value="2" />
                        </asp:DropDownList> 

                    </td>
                    <td>
                        <!-- start date -->
                        <asp:TextBox ID="start_dt_codeTextBox" runat="server" Columns="6" Text='<%#Bind("start_dt")%>' />
                    </td>
                    <td>
                        <!-- end date -->
                        <asp:TextBox ID="end_dt_codeTextBox" runat="server" Columns="6" Text='<%#Bind("end_dt")%>' />
                    </td>
                    <td>
                        <asp:Button runat="server" CommandName="Insert" Text="insert" />
                        <asp:Button runat="server" CommandName="Clear" Text="clear" />
                    </td>
                </tr>                    
            </InsertItemTemplate>

…

<asp:SqlDataSource ID="AbsentSqlDataSource" runat="server"
    ConnectionString="<%$ ConnectionStrings:Rotations3ConnectionString %>"
    SelectCommand="SELECT employee_id, start_dt, end_dt
                     FROM Excused_Absences
                    WHERE fy = @fy AND pgy = @pgy"

    UpdateCommand="UPDATE Excused_Absences
                      SET start_dt = @start_dt, end_dt = @end_dt, employee_id = @employee_id
                    WHERE absence_nbr = @absence_nbr"

    InsertCommand="INSERT INTO Excused_Absences (fy, pgy, employee_id, start_dt, end_dt)
                        VALUES (@fy, @pgy, @employee_id, @start_dt, @end_dt)"

    OldValuesParameterFormatString="old_{0}">

    <SelectParameters>
        <asp:ControlParameter Name="fy" Type="Int32" ControlID="fyTextBox" PropertyName="Text" />
        <asp:ControlParameter Name="pgy" Type="Int32" ControlID="pgyTextBox" PropertyName="Text" />
    </SelectParameters>

    <InsertParameters>
        <asp:ControlParameter Name="fy" Type="Int32" ControlID="fyTextBox" PropertyName="Text" />
        <asp:ControlParameter Name="pgy" Type="Int32" ControlID="pgyTextBox" PropertyName="Text" />
        <asp:Parameter Name="employee_id" Type="String" />
        <asp:Parameter Name="start_dt" Type="DateTime" />
        <asp:Parameter Name="end_dt" Type="DateTime" />
    </InsertParameters>

For some reason when I insert John Smith or Indiana Jones, the employee_id is not inserted into the database, I get a NULL value. What am I missing?

  • 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-21T15:36:50+00:00Added an answer on May 21, 2026 at 3:36 pm

    Found it! long time programmer, but novice to asp.net so I’m not sure of the reason, but just poking around other code that did the same thing i wanted, I was able to write this function:

    Protected Sub AbsentListView_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewInsertEventArgs) Handles AbsentListView.ItemInserting
        e.Values("employee_id") = DirectCast(AbsentListView.InsertItem.FindControl("ExcusedAbsences_employee_idDropDownList2"), DropDownList).SelectedValue
    End Sub
    

    I couldn’t find any call to this function, but apparnetly it gets called automatically with every insert of my “AbsentlistView” item.

    This function somehow tells the SQL command what the value should be for the drop down, and therefore when the SQL command goes, it has the correct value in the employee_id field.

    Thanks all for your help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ASP.Net: <asp:GridView id =sampleGridView AutoGenerateEditButton =True OnRowEditing =sampleGridView_RowEditing OnRowCancelingEdit =sampleGridView_RowCancelingEdit OnRowUpdating =sampleGridView_RowUpdating runat =server></asp:GridView>
ASP.Net 3.5 I want to create a user control that contains the ListView and
Why isn't this working? <ajaxToolkit:TabPanel Enabled='<%# User.IsInRole(admin) %>'... While this works: <asp:TextBox Enabled='<%# User.IsInRole(admin)
I have the following front end code: <ajaxToolkit:TabContainer runat=server Height=150px Width=70% ActiveTabIndex=1 OnDemand=true AutoPostBack=false
ASP.NET server-side controls postback to their own page. This makes cases where you want
I just updated from ASP.NET Ajax 1.0 to 4, and now the HeaderText in
I have this hierarchy, a tabcontainer(tcmain) under that a tabpanel(tpnlRaiseMRF) under that an asp
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
Asp.Net 3.5 / WebForms (no ajax) I am trying to update a delete confirm
ASP.Net MVC Controllers have several methods of forwarding control to another controller or action.

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.