即使项目成功编译,提交一些数据时也出现以下错误。
“ mscorlib.dll中发生类型'System.Threading.ThreadAbortException'的第一次机会异常 mscorlib.dll中发生类型'System.Threading.ThreadAbortException'的异常,但未在用户代码中处理。”
页面布局(屏幕快照)在下面的链接中以及下面的源代码中显示。通过谷歌搜索,我只看到错误的原因是方法Response.Redirect(),但是在源文件中却没有。
https://1drv.ms/u/s!AmtdwiEaHvNNn0qQ937QPHO8JZLi
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
CodeBehind="Default.aspx.vb" Inherits="HR_Leave.hr_leave_app" EnableEventValidation="false"
ValidateRequest="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:SqlDataSource ID="ds_staff_leave" runat="server" ConnectionString="<%$ ConnectionStrings:SGL_HR_DBConnectionString %>"
SelectCommand="SELECT * FROM [staff_leave]"
InsertCommand="INSERT INTO staff_leave(staffid, staff_leave_categoryid, leave_typeid, leave_application_date, leave_start, leave_end, leave_resume, leave_days, leave_details, approved, approved_date, approved_comments, entered_by, entered_date, effect_balance, leave_entitledid) VALUES (@staffid, @staff_leave_categoryid, @leave_typeid, @leave_application_date, @leave_start, @leave_end, @leave_resume, @leave_days, @leave_details, @approved, @approved_date, @approved_comments, @enter
ed_by, @entered_date, 0, @leave_entitledid)">
<InsertParameters>
<asp:Parameter Name="staffid" />
<asp:Parameter Name="staff_leave_categoryid" />
<asp:Parameter Name="leave_typeid" />
<asp:Parameter Name="leave_application_date" />
<asp:Parameter Name="leave_start" />
<asp:Parameter Name="leave_end" />
<asp:Parameter Name="leave_resume" />
<asp:Parameter Name="leave_days" />
<asp:Parameter Name="leave_details" />
<asp:Parameter Name="approved" />
<asp:Parameter Name="approved_date" />
<asp:Parameter Name="approved_comments" />
<asp:Parameter Name="entered_by" />
<asp:Parameter Name="entered_date" />
<asp:Parameter Name="leave_entitledid" />
</InsertParameters>
</asp:SqlDataSource>
<asp:ScriptManager ID="ScriptManager2" runat="server">
</asp:ScriptManager>
<asp:Label ID="Label11" runat="server" ForeColor="Red"></asp:Label>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DetailsView ID="DetailsView2" runat="server" AllowPaging="True" AutoGenerateRows="False"
CellPadding="4" DataKeyNames="leaveid" DataSourceID="ds_staff_leave" Font-Size="Small"
Height="326px" HorizontalAlign="Center" Width="602px" BorderStyle="Solid" DefaultMode="Insert"
Font-Bold="False" ForeColor="#333333">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
<EditRowStyle BackColor="White" />
<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
<Fields>
<asp:BoundField DataField="leaveid" HeaderText="Leave #" InsertVisible="False" ReadOnly="True"
SortExpression="leaveid" />
<asp:TemplateField HeaderText="Staff Name" SortExpression="staffid">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("staffid") %>' ReadOnly="True" ></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="staffid" runat="server" Height="20px" Width="250px" SelectedValue='<%# Bind("staffid") %>'
AutoPostBack="True" DataSourceID="ds_staff_details" DataTextField="firstname"
DataValueField="staffid">
</asp:DropDownList>
<asp:SqlDataSource ID="ds_staff_details" runat="server" ConnectionString="<%$ ConnectionStrings:SGL_HR_DBConnectionString %>"
SelectCommand="SELECT * FROM [staff_list] WHERE staffid=@staffid">
<SelectParameters>
<asp:SessionParameter DefaultValue="0" Name="staffid" SessionField="sess_staffid" />
</SelectParameters>
</asp:SqlDataSource>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("staffid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Leave Category" SortExpression="staff_leave_categoryid">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("staff_leave_categoryid") %>' ReadOnly="True" ></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="staff_leave_categoryid" runat="server" Height="20px" Width="200px"
SelectedValue='<%# Bind("staff_leave_categoryid") %>' AutoPostBack="True" DataSourceID="ds_leave_category"
DataTextField="staff_leave_category" DataValueField="staff_leave_categoryid">
</asp:DropDownList>
<asp:SqlDataSource ID="ds_leave_category" runat="server" ConnectionString="<%$ ConnectionStrings:SGL_HR_DBConnectionString %>"
SelectCommand="SELECT c.* , l.* FROM [SGL_HR_DB].[dbo].[staff_list] l , [SGL_HR_DB].[dbo].[staff_leave_category] c where c.staff_leave_categoryid = l.staff_leave_categoryid and l.staffid=@staffid">
<SelectParameters>
<asp:SessionParameter DefaultValue="0" Name="staffid" SessionField="sess_staffid" />
</SelectParameters>
</asp:SqlDataSource>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("staff_leave_categoryid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Leave Type" SortExpression="leave_typeid">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("leave_typeid") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="leave_typeid" runat="server" Height="20px" Width="250px" SelectedValue='<%# Bind("leave_typeid") %>'
AutoPostBack="True" DataSourceID="ds_leave_type" DataTextField="leave_type" DataValueField="leave_typeid"
OnSelectedIndexChanged="leave_typeid_SelectedIndexChanged">
</asp:DropDownList>
<asp:SqlDataSource ID="ds_leave_type" runat="server" ConnectionString="<%$ ConnectionStrings:SGL_HR_DBConnectionString %>"
SelectCommand="SELECT * FROM [leave_types]"></asp:SqlDataSource>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("leave_typeid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Entitled Days">
<InsertItemTemplate>
<asp:TextBox ID="leave_entitled_days" runat="server" Enabled="False" Font-Bold="True"
Font-Size="Medium" Height="21px" Width="71px"></asp:TextBox>
<asp:TextBox ID="leave_entitledid" runat="server" Enabled="False" Text='<%# Bind("leave_entitledid") %>'
Visible="False"></asp:TextBox>
<strong> <asp:Label ID="Labelbr" runat="server" >Brought Forward:</asp:Label> </strong>
<asp:TextBox ID="leave_days_cf" runat="server" Enabled="False" Font-Bold="True" Font-Size="Medium"
Height="21px" Width="54px"></asp:TextBox>
<strong>Days Taken:<asp:TextBox ID="days_taken" runat="server" Enabled="False" Font-Bold="True"
Font-Size="Medium" Height="21px" Width="54px"></asp:TextBox>
</strong>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Current Balance">
<InsertItemTemplate>
<asp:Label ID="CurrentBalance" runat="server" Font-Bold="True" Font-Size="Large"
ForeColor="Blue" Text="0"></asp:Label>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label14" runat="server" Text="0"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Application Date" SortExpression="leave_application_date">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("leave_application_date") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="leave_application_date" runat="server" Text='<%# Bind("leave_application_date") %>'
AutoPostBack="True" Enabled="False"></asp:TextBox>
<asp:CalendarExtender ID="TextBox4_CalendarExtender" runat="server" Enabled="True"
TargetControlID="leave_application_date" Format="yyyy-MM-dd">
</asp:CalendarExtender>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("leave_application_date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Start Date" SortExpression="leave_start">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("leave_start") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="leave_start" runat="server" Text='<%# Bind("leave_start") %>' AutoPostBack="True"
OnTextChanged="leave_start_TextChanged"></asp:TextBox>
<asp:CalendarExtender ID="TextBox5_CalendarExtender" runat="server" Enabled="True"
TargetControlID="leave_start" Format="yyyy-MM-dd">
</asp:CalendarExtender>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("leave_start") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Days" SortExpression="leave_days">
<EditItemTemplate>
<asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("leave_days") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="leave_days" runat="server" Text='<%# Bind("leave_days") %>' AutoPostBack="True"
OnTextChanged="leave_days_TextChanged"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="RangeValidator"
ControlToValidate="leave_days" MaximumValue="120" MinimumValue="1" Type="Integer"
SetFocusOnError="True">Enter a Valid Number</asp:RangeValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator"
ControlToValidate="leave_days" SetFocusOnError="True">Enter a Valid Number</asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%# Bind("leave_days") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="End Date" SortExpression="leave_end">
<EditItemTemplate>
<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("leave_end") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="leave_end" runat="server" Text='<%# Bind("leave_end") %>' Enabled="False"
AutoPostBack="True"></asp:TextBox>
<asp:CalendarExtender ID="TextBox6_CalendarExtender" runat="server" Enabled="True"
TargetControlID="leave_end" Format="yyyy-MM-dd">
</asp:CalendarExtender>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Bind("leave_end") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Resume Date" SortExpression="leave_resume">
<EditItemTemplate>
<asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("leave_resume") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="leave_resume" runat="server" Text='<%# Bind("leave_resume") %>'
Enabled="False" AutoPostBack="True"></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Bind("leave_resume") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Leave Details" SortExpression="leave_details">
<EditItemTemplate>
<asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("leave_details") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="leave_details" runat="server" Text='<%# Bind("leave_details") %>'
Rows="2" TextMode="MultiLine" Width="250px" AutoPostBack="True"></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%# Bind("leave_details") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Approved" SortExpression="approved">
<EditItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("approved") %>' />
</EditItemTemplate>
<InsertItemTemplate>
<asp:CheckBox ID="approved" runat="server" Checked='<%# Bind("approved") %>' Enabled="False" />
</InsertItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("approved") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Approved Date" SortExpression="approved_date">
<EditItemTemplate>
<asp:TextBox ID="TextBox10" runat="server" Text='<%# Bind("approved_date") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="approved_date" runat="server" Text='<%# Bind("approved_date") %>'
Enabled="False" AutoPostBack="True"></asp:TextBox>
<asp:CalendarExtender ID="TextBox10_CalendarExtender" runat="server" Enabled="True"
TargetControlID="approved_date" Format="yyyy-MM-dd">
</asp:CalendarExtender>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%# Bind("approved_date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Approval Comments" SortExpression="approved_comments">
<EditItemTemplate>
<asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("approved_comments") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="approved_comments" runat="server" Text='<%# Bind("approved_comments") %>'
Enabled="False"></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label11" runat="server" Text='<%# Bind("approved_comments") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Entered By" SortExpression="entered_by">
<EditItemTemplate>
<asp:TextBox ID="TextBox12" runat="server" Text='<%# Bind("entered_by") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="entered_by" runat="server" Text='<%# Bind("entered_by") %>' Enabled="False"></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label12" runat="server" Text='<%# Bind("entered_by") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Entered Date" SortExpression="entered_date">
<EditItemTemplate>
<asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("entered_date") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="entered_date" runat="server" Text='<%# Bind("entered_date") %>'
Enabled="False"></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label13" runat="server" Text='<%# Bind("entered_date") %>' Enabled="False"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" InsertText="Submit Leave" NewText="Enter Leave"
ShowInsertButton="True">
<ControlStyle Font-Bold="True" Height="30px" Width="160px" />
</asp:CommandField>
</Fields>
<FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />
<FooterTemplate>
<br />
</FooterTemplate>
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
</asp:DetailsView>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<br />
</asp:Content>
这里可能是什么问题?任何帮助将不胜感激
此致
布莱恩