title: Error - Databinding methods such as Eval(), XPath(), and Bind()
body: <p>I have been getting this error after the submit button has been pressed on my detailsview which has two databound dropdownlists. I do not use Eval or XPath anywhere in my code, but use Bind often.</p>
  
  <pre><code>Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
  
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
  Exception Details: System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
  
  Source Error: 
  
  
  [No relevant source lines]
  
  Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9b1781c5\212dfe37\App_Web_newrequestform.aspx.1420f3bc.0khdma4p.0.cs    Line: 0 
  
  Stack Trace: 
  
  
  [InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.]
     System.Web.UI.Page.GetDataItem() +2802118
     ASP.authorized_leaverequest_newrequestform_aspx.__DataBinding__control69(Object sender, EventArgs e) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9b1781c5\212dfe37\App_Web_newrequestform.aspx.1420f3bc.0khdma4p.0.cs:0
     System.Web.UI.Control.OnDataBinding(EventArgs e) +91
     System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +14
     System.Web.UI.WebControls.ListControl.PerformSelect() +34
     System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
     System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
     System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +29
     System.Web.UI.Control.PreRenderRecursiveInternal() +103
     System.Web.UI.Control.PreRenderRecursiveInternal() +175
     System.Web.UI.Control.PreRenderRecursiveInternal() +175
     System.Web.UI.Control.PreRenderRecursiveInternal() +175
     System.Web.UI.Control.PreRenderRecursiveInternal() +175
     System.Web.UI.Control.PreRenderRecursiveInternal() +175
     System.Web.UI.Control.PreRenderRecursiveInternal() +175
     System.Web.UI.Control.PreRenderRecursiveInternal() +175
     System.Web.UI.Control.PreRenderRecursiveInternal() +175
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
  </code></pre>
  
  <p>Disassembly points to  ---> mov         dword ptr [ebp-58h],eax </p>
  
  <p>I have been searching this error for days without luck.  I already tried <a href="http://www.webswapp.com/categories/ASPNET2/Default.aspx" rel="nofollow">WEBSWAPP</a> as well as searched many forums.  Please help.</p>
  
  <p>I am trying to use dropdownlists to let a user select values to fill a database.  Every field in my form is a template and is databound. </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Configuration;
  using System.Data.SqlClient;
  using System.Data;
  using System.Web.Services;
  using System.Web.Services.Protocols;
  using AjaxControlToolkit;
  
  namespace TimeAndAttendanceUI.Authorized.LeaveRequest
  {
      public partial class newRequestForm : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
              {
                  DetailsView1.DataBind();
              }
          }
  
          protected void DetailsView1_DataBound(object sender, EventArgs e)
          {
              TextBox employeeID = (TextBox)(DetailsView1.FindControl("TextBox17"));
              DropDownList approverID = (DropDownList)(DetailsView1.FindControl("DropDownList4"));
  
              if (DetailsView1.CurrentMode == DetailsViewMode.Insert)
              {
                  var CurrUser = "";
  
                  Account.Login uusr = new Account.Login();
                  CurrUser = uusr.User.Identity.Name.ToString().ToUpper();
  
                  employeeID.Text = CurrUser.Substring(3, 3);
  
                  string supusrid = "";
  
                  DataHandler.DataHandler Dt = new DataHandler.DataHandler();
                  supusrid = Dt.SelectRequestApproverForm(supusrid);
  
                  approverID.SelectedValue = supusrid;
              }
          }
  
          protected void DropDownList6_SelectedIndexChanged(object sender, EventArgs e)
          {
              DropDownList lvtype = (DropDownList)(DetailsView1.FindControl("DropDownList6"));
              string selectedValue = lvtype.SelectedValue.ToString().ToUpper();
              if (selectedValue == "4 " || selectedValue == "1F")
              {
                  DropDownList lvreason = (DropDownList)(DetailsView1.FindControl("DropDownList5"));
                  SqlDataSource1.SelectParameters["LEAVECODE"].DefaultValue = selectedValue;
  
                  lvreason.Visible = true;
              }
  
          }
  
          protected void Button2_Click(object sender, EventArgs e)
          {
              DetailsView1.DataSource = null;
              DetailsView1.DataBind();
          }
  
          protected void Button2_Click1(object sender, EventArgs e)
          {
              Button3.Visible = true;
          }
  
          protected void Button3_Click(object sender, EventArgs e)
          {
              DetailsView1.Visible = true;
              DetailsView1.ChangeMode(DetailsViewMode.Insert);
              if (DetailsView1.CurrentMode.Equals(DetailsViewMode.Insert))
              {
                  Button3.Visible = false;
                  Button4.Visible = false;
                  DetailsView2.Visible = true;
                  DetailsView3.Visible = true;
              }
          }
  
      }
  }
  </code></pre>
  
  <p>Sorry for bombarding with code.</p>
  
  <pre><code>    &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;
      &lt;asp:Label ID="HoursLabel" runat="server"&gt;&lt;/asp:Label&gt;
      &lt;br /&gt;
      &lt;table class="style1"&gt;
          &lt;tr&gt;
              &lt;td class="style2" colspan="2"&gt;
                  &lt;asp:DetailsView ID="DetailsView1" runat="server" 
                  DataSourceID="ObjectDataSource1" DataKeyNames="bwrequestid"
                  Height="29px" Width="928px" AutoGenerateRows="False" CellPadding="4" ForeColor="#333333"
                  GridLines="None" Style="margin-right: 0px; text-align: left; margin-top: 0px;" 
                      ondatabound="DetailsView1_DataBound" 
                      oniteminserted="DetailsView1_ItemInserted" 
                      onitemcommand="DetailsView1_ItemCommand" &gt;
                  &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
                  &lt;CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /&gt;
                  &lt;EditRowStyle BackColor="#999999" /&gt;
                  &lt;FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" Width="180px" /&gt;
                  &lt;Fields&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Request ID" HeaderText="Leave Request ID" Visible="False"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:Label ID="Label18" runat="server" Text='&lt;%# Bind("bwrequestid") %&gt;'&gt;&lt;/asp:Label&gt;
                              &lt;asp:TextBox ID="TextBox169" runat="server" Text='&lt;%# bind("bwrequestid") %&gt;'&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:Label ID="Label19" runat="server" Text='&lt;%# Bind("bwrequestid") %&gt;'&gt;&lt;/asp:Label&gt;
                              &lt;asp:TextBox ID="TextBox165" runat="server" Text='&lt;%# bind("bwrequestid") %&gt;'&gt;&lt;/asp:TextBox&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("bwrequestid") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Employee ID" HeaderText="Employee ID" &gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:Label ID="Label20" runat="server" Text='&lt;%# bind("emppid") %&gt;'&gt;&lt;/asp:Label&gt;           
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:Label ID="Label21" runat="server" Text='&lt;%# bind("emppid") %&gt;'&gt;&lt;/asp:Label&gt;
                              &lt;asp:TextBox ID="TextBox17" runat="server" Text='&lt;%# bind("emppid") %&gt;' 
                                 &gt;&lt;/asp:TextBox&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# bind("emppid") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Approver ID" HeaderText="Approver ID"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox3" runat="server" Text='&lt;%# Bind("approverid") %&gt;' Height="21px"
                                  Width="68px"&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:DropDownList ID="DropDownList4" runat="server" style="text-transform:uppercase;" DataSourceID="SqlDataSourceApprover"
                                  DataTextField="APPROVNAME" DataValueField="APPROVERID" 
                                  SelectedValue='&lt;%# Bind("approverid") %&gt;'&gt;
                              &lt;/asp:DropDownList&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label3" runat="server" Text='&lt;%# Bind("approverid") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Leave Type" SortExpression="reqleavecode"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:DropDownList ID="DropDownList7" runat="server" AppendDataBoundItems="True" 
                                  AutoPostBack="True" DataSourceID="SQLLEAVECODE" 
                                  style="text-transform:uppercase;" DataTextField="LEAVETYPE" 
                                  DataValueField="LEAVECODE" 
                                  onselectedindexchanged="DropDownList6_SelectedIndexChanged" 
                                  SelectedValue='&lt;%# BIND("REQLEAVECODE") %&gt;' ViewStateMode="Enabled" 
                                  Width="165px" Height="19px"&gt;
                                  &lt;asp:ListItem&gt;&lt;/asp:ListItem&gt;
                              &lt;/asp:DropDownList&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:DropDownList ID="DropDownList6" runat="server" DataSourceID="SQLLEAVECODE" 
                                  DataTextField="LEAVETYPE" style="text-transform:uppercase;"  DataValueField="LEAVECODE"
                                  onselectedindexchanged="DropDownList6_SelectedIndexChanged" 
                                  AppendDataBoundItems="True" ViewStateMode="Enabled" AutoPostBack="True" 
                                  SelectedValue='&lt;%# BIND("REQLEAVECODE") %&gt;' Width="166px" Height="19px"&gt;&lt;asp:ListItem&gt;&lt;/asp:ListItem&gt;
                              &lt;/asp:DropDownList&gt;
                              &lt;br /&gt;
                              &lt;asp:Label ID="Label26" runat="server" Text='&lt;%# bind("reqleavecode") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label9" runat="server" Text='&lt;%# Bind("reqleavecode") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Leave Type" HeaderText="Leave Reason" 
                          Visible="False"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label4" runat="server" Text='&lt;%# Bind("leavetype") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox4" runat="server" Text='&lt;%# Bind("leavetype") %&gt;' Height="21px"
                                  Width="43px"&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:DropDownList ID="DropDownList5" runat="server" AppendDataBoundItems="True" 
                                  AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="REASON" 
                                  DataValueField="REASON" Height="19px" 
                                  onselectedindexchanged="DropDownList5_SelectedIndexChanged1" 
                                  SelectedValue='&lt;%# Bind("leavetype") %&gt;' Width="163px"&gt;
                              &lt;/asp:DropDownList&gt;
                              &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1Reason" runat="server" 
                                  ControlToValidate="DropDownList5" ErrorMessage="*Leave Reason Required" 
                                  ForeColor="Red"&gt;&lt;/asp:RequiredFieldValidator&gt;
                          &lt;/InsertItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="start date" HeaderText="Leave Date"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox5" runat="server" 
                                  Text='&lt;%# Bind("lstdate",  "{0:MM/dd/yyyy}") %&gt;' Height="21px"
                                  Width="72px"&gt;&lt;/asp:TextBox&gt;
                              &lt;asp:CalendarExtender ID="TextBox5_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox5"&gt;
                              &lt;/asp:CalendarExtender&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox5" runat="server" 
                                  Text='&lt;%# Bind("lstdate",  "{0:MM/dd/yyyy}") %&gt;' Height="21px"
                                  Width="67px"&gt;&lt;/asp:TextBox&gt;
                              &lt;asp:CalendarExtender ID="TextBox5_CalendarExtender" runat="server" Enabled="True"
                                  TargetControlID="TextBox5"&gt;
                              &lt;/asp:CalendarExtender&gt;
                              &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                  ControlToValidate="TextBox5" ErrorMessage="*Leave Date Required" 
                                  ForeColor="Red"&gt;&lt;/asp:RequiredFieldValidator&gt;
                              &lt;br /&gt;
                              &lt;asp:CompareValidator ID="CompareValidator18" runat="server" 
                                  ControlToCompare="TextBox7" ControlToValidate="TextBox5" 
                                  ErrorMessage="Leave date cannot be after start date" ForeColor="Red" 
                                  Operator="LessThanEqual" ToolTip="Must choose start date before end date"&gt;&lt;/asp:CompareValidator&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label7" runat="server" Text='&lt;%# Bind("lenddate") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="lenddate" HeaderText="Return Date"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox7" runat="server" 
                                  Text='&lt;%# Bind("lenddate",  "{0:MM/dd/yyyy}") %&gt;' Height="21px" Width="67px"&gt;&lt;/asp:TextBox&gt;
                              &lt;asp:CalendarExtender ID="TextBox7_CalendarExtender" runat="server" Enabled="True"
                                  TargetControlID="TextBox7"&gt;
                              &lt;/asp:CalendarExtender&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox7" runat="server" 
                                  Text='&lt;%# Bind("lenddate",  "{0:MM/dd/yyyy}") %&gt;' Height="21px"
                                  Width="67px"&gt;&lt;/asp:TextBox&gt;
                              &lt;asp:CalendarExtender ID="TextBox7_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox7"&gt;
                              &lt;/asp:CalendarExtender&gt;
                              &lt;asp:CompareValidator ID="CompareValidator1" runat="server" 
                                  ControlToCompare="TextBox5" ControlToValidate="TextBox7" 
                                  ErrorMessage="Return date cannot be before start date" ForeColor="Red" 
                                  Operator="GreaterThanEqual"&gt;&lt;/asp:CompareValidator&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label15" runat="server" Text='&lt;%# Bind("lsttime") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Leave Time" HeaderText="Leave Time"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox15" runat="server" Height="21px" 
                                  Text='&lt;%# Bind("lsttime") %&gt;' ToolTip="Type 'A' or 'P' to switch AM/PM" 
                                  Width="85px"&gt;&lt;/asp:TextBox&gt;
                              &lt;asp:MaskedEditExtender ID="TextBox15_MaskedEditExtender" runat="server" 
                                  AcceptAMPM="True" CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" 
                                  CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                  CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                  ErrorTooltipEnabled="True" Mask="99:99" MaskType="Time" 
                                  TargetControlID="TextBox15" /&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox15" runat="server" Text='&lt;%# Bind("lsttime") %&gt;' Width="85px"
                                  Height="22px" ToolTip="Type 'A' or 'P' to switch AM/PM"&gt;&lt;/asp:TextBox&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label8" runat="server" Text='&lt;%# Bind("lendtime") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Return Time" HeaderText="Return Time"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox8" runat="server" Text='&lt;%# Bind("lendtime") %&gt;' Width="85px"&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox8" runat="server" Text='&lt;%# Bind("lsttime") %&gt;' Width="85px"
                                  Height="22px" ToolTip="Type 'A' or 'P' to switch AM/PM"&gt;&lt;/asp:TextBox&gt;
                              &lt;asp:MaskedEditExtender ID="TextBox8_MaskedEditExtender" runat="server" 
                                  AcceptAMPM="True" CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" 
                                  CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                  CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                  ErrorTooltipEnabled="True" Mask="99:99" MaskType="Time" 
                                  TargetControlID="TextBox8" /&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label10" runat="server" Text='&lt;%# Bind("standby") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Standby" HeaderText="On Standby"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox10" runat="server" Text='&lt;%# Bind("standby") %&gt;' MaxLength="1" Width="21px"&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource10"
                                  DataTextField="&amp;quot;Y/N&amp;quot;" DataValueField="&amp;quot;Y/N&amp;quot;" SelectedValue='&lt;%# BIND("standby") %&gt;'&gt;
                              &lt;/asp:DropDownList&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label12" runat="server" Text='&lt;%# Bind("rsndecline") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Reason Decline" 
                          HeaderText="Request Decline Reason" InsertVisible="False"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox12" style="text-transform:uppercase;" runat="server" Text='&lt;%# Bind("rsndecline") %&gt;' 
                                  Visible="False"&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox12" runat="server" Text='&lt;%# Bind("rsndecline") %&gt;' 
                                  Visible="False"&gt;&lt;/asp:TextBox&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label13" runat="server" Text='&lt;%# Bind("status") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="Status" HeaderText="Request Status" InsertVisible="False"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox13" runat="server" Text='&lt;%# Bind("status") %&gt;'&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox13" runat="server" Text='&lt;%# Bind("status") %&gt;' Visible="False"&gt;&lt;/asp:TextBox&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label14" runat="server" Text='&lt;%# Bind("empremarks") %&gt;' 
                                  ToolTip="Additional information pertaining to leave request"&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField AccessibleHeaderText="empremarks" HeaderText="Leave Request Remarks"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox14" runat="server" style="text-transform:uppercase;" Text='&lt;%# Bind("empremarks") %&gt;' 
                                  TextMode="MultiLine" Height="50px" Width="449px" 
                                  ToolTip="Additional information pertaining to leave request"&gt;&lt;/asp:TextBox&gt;
                              &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                  ControlToValidate="TextBox14" Display="Dynamic" Enabled="False" 
                                  ErrorMessage="*Leave Remarks Required for &amp;quot;Other&amp;quot; selection" 
                                  ForeColor="Red"&gt;&lt;/asp:RequiredFieldValidator&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox14" runat="server" style="text-transform:uppercase;" Text='&lt;%# Bind("empremarks") %&gt;' 
                                  TextMode="MultiLine" Height="47px" Width="452px" 
                                  ToolTip="Additional information pertaining to leave request."&gt;&lt;/asp:TextBox&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Button ID="Button1" runat="server" CausesValidation="False" 
                                  CommandName="Edit" Height="21px" Text="Edit" Width="65px" /&gt;
                              &amp;nbsp; &amp;nbsp;
                              &lt;asp:Button ID="Button2" runat="server" CausesValidation="False" 
                                  CommandName="New" Height="21px" Text="New" Width="65px" /&gt;
                              &amp;nbsp; &amp;nbsp;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField ShowHeader="False"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:Button ID="Button1" runat="server" CausesValidation="True" 
                                  CommandName="Update" Text="Update" /&gt;
                              &amp;nbsp;
                              &lt;asp:Button ID="Button2" runat="server" CausesValidation="False" 
                                  CommandName="Cancel" Text="Cancel" /&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;InsertItemTemplate&gt;
                              &lt;asp:Button ID="Button1" runat="server" CommandName="Insert" 
                                  Text="Submit Request" /&gt;
                              &amp;nbsp;
                              &lt;asp:Button ID="Button2" runat="server" CausesValidation="False" 
                                  CommandName="Cancel" Height="21px" onclick="Button2_Click1" Text="Cancel" /&gt;
                          &lt;/InsertItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Label5" runat="server" Text='&lt;%# Bind("lstdate") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                          &lt;/Fields&gt;
                          &lt;/asp:DetailsView&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
               &lt;/table&gt;
      &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
          ConnectionString="&lt;%$ ConnectionStrings:ConnectionStringEvent %&gt;" 
          ProviderName="&lt;%$ ConnectionStrings:ConnectionStringEvent.ProviderName %&gt;" 
          SelectCommand="SELECT REASON, LEAVECODE FROM BWLEAVRSN"&gt;
      &lt;SelectParameters&gt;
          &lt;asp:Parameter Name="LEAVECODE" Type="String" /&gt;
      &lt;/SelectParameters&gt;
      &lt;/asp:SqlDataSource&gt;
  
      &lt;asp:SqlDataSource ID="SQLLEAVECODE" runat="server" 
         ConnectionString="&lt;%$ ConnectionStrings:ConnectionStringEvent %&gt;" 
         ProviderName="&lt;%$ ConnectionStrings:ConnectionStringEvent.ProviderName %&gt;"                
         SelectCommand="SELECT LEAVETYPE, LEAVECODE FROM BWLVTYPE ORDER BY LEAVECODE"&gt;
      &lt;/asp:SqlDataSource&gt;
  
      &lt;asp:SqlDataSource ID="SqlDataSourceApprover" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ConnectionStringEvent %&gt;"
          ProviderName="&lt;%$ ConnectionStrings:ConnectionStringEvent.ProviderName %&gt;" 
          SelectCommand="SELECT APPROVERID, APPROVNAME FROM BWAPPROVER ORDER BY APPROVERID"&gt;
      &lt;/asp:SqlDataSource&gt;
  
      &lt;asp:SqlDataSource ID="SqlDataSource10" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ConnectionStringEvent %&gt;"
          ProviderName="&lt;%$ ConnectionStrings:ConnectionStringEvent.ProviderName %&gt;" 
          SelectCommand="SELECT * FROM BWYNSELECT ORDER BY ALPH"&gt;&lt;/asp:SqlDataSource&gt;
  
              &lt;asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"&gt;
              &lt;/asp:ToolkitScriptManager&gt;
      &lt;asp:Label ID="Label27" runat="server" &gt;&lt;/asp:Label&gt;
  &lt;/asp:Content&gt;
  </code></pre>