Dear All,
Recently i face a problem, it report that it can't found the specific controls
when post back the form to server side.
The error code is ""Could not find control 'rbtnlst_Reason'
in ControlParameter 'Reason'."
However, i explicitly declare the control
inside the InsertedItemTemplate of the FormView. Does anyone know what's going
on here? Are there any alternative routes to solve the problem? Thanks for all
who reply this post.
The page Code are listed as below, the
word which is in red are the problem code:
<%@ Page Language="VB"
MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
CodeFile="Attendance_Register.aspx.vb"
Inherits="Attendance_Apply_Attendance_Register" title="Attendance Register"
%>
<asp:Content ID="Content1"
ContentPlaceHolderID="bodyContentPlaceHolder" Runat="Server">
<h2>Attendance - Register</h2>
<asp:FormView
ID="AttendanceRegisterFormView" runat="server"
DataSourceID="AttendanceRegisterSQL" DefaultMode="Insert">
<InsertItemTemplate>
<table cellpadding="0"
cellspacing="0" BorderColor="#ffffc0" border="1"
class="style2">
<tr>
<td colspan="2" style="height: 30px"
bgcolor="#ffffc0">
<asp:Button
id="GeneralUpdateButton" text="Submit Application" commandname="Insert"
runat="server" SkinID="Btn-8" />
</td>
</tr>
<tr><td colspan="2" style="height: 30px"
bgcolor="#ffffc0"><strong><span style="text-decoration:
underline">Attendance Support
Form</span></strong></td></tr>
<tr>
<th style="text-align: left">Date
(mm/dd/yyyy) </th>
<td><asp:TextBox
ID="txt_Date" runat="server" Text='<%# Bind("Att_Date") %>' />
</td>
</tr>
<tr>
<th style="text-align: left">Time in
(HH:MIN)</th>
<td><asp:TextBox
ID="txt_TimeIn" runat="server" Text='<%# Bind("TimeIn") %>'
/></td>
</tr>
<tr>
<th style="text-align: left">Time
Out (HH:MIN)</th>
<td><asp:TextBox
ID="txt_TimeOut" runat="server" Text='<%# Bind("TimeOut") %>'
/></td>
</tr>
<tr>
<th style="text-align: left">Reason
for not sliding my staff curd</th>
<td>
<asp:RadioButtonList ID="rbtnlst_Reason"
runat="server" AutoPostBack="false">
<asp:ListItem Text = "new staff - first day of report duty" Value ="0"
/>
<asp:ListItem Text = "forgot to bring staff card." Value ="1"
/>
<asp:ListItem Text = "forgot to clock in and/or out." Value ="2"
/>
<asp:ListItem Text = "outdoor work
in Hong Kong or PRC." Value ="3" />
<asp:ListItem Text = "name of toy fair."
Value ="4" />
<asp:ListItem Text = "other reason." Value ="5"
/>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<th style="text-align:
left">Description</th>
<td><asp:TextBox ID="txt_Desc" runat="server" Text='<%#
Bind("Description") %>'/></td>
</tr>
</table>
</InsertItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="AttendanceRegisterSQL" runat="server"
ConnectionString="<%$ ConnectionStrings:eLeaveConnectionString
%>"
InsertCommand="INSERT INTO [WEBeLeave]..[eLeave_Attendance](
[StaffNo], [Dept], [Att_Date], [TimeIn], [TimeOut], [Reason], [AppliedBy],
[Description], [RegisterStatus])
VALUES
(@StaffNo,@Dept,@Att_Date,@TimeIn,@TimeOut,@Reason, @AppliedBy,@Description,
@RegisterStatus)"
>
<InsertParameters>
<asp:SessionParameter
Name="StaffNo" SessionField="StaffNo" Type="String" />
<asp:SessionParameter Name="Dept" SessionField ="Dept"
Type="String"/>
<asp:Parameter Name="Att_Date"
Type="DateTime" />
<asp:Parameter Name="TimeIn"
Type="String" Size="5" />
<asp:Parameter Name="TimeOut"
Type="String" Size="5" />
<asp:ControlParameter Name="Reason"
ControlID="rbtnlst_Reason" PropertyName="SelectedValue"
/>
<asp:SessionParameter Name="AppliedBy" SessionField="StaffNo" Type="String"
/>
<asp:Parameter Name="Description" Type="String"
/>
<asp:Parameter Name="RegisterStatus" Type="String"
DefaultValue="pending" />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>