Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 24, 2012 12:09 AM by Decker Dong - MSFT
Dec 23, 2012 02:05 AM|LINK
I'm trying to loop through every formview page in the ModeChanging event but it's not working right. Do you see anything wrong?
Integer = fvApplicantComments.PageCount
fvApplicantComments.PageIndex = i - 1
insertEmployeeIDLabel = fvApplicantComments.FindControl("employee_idLabel")
If insertEmployeeIDLabel.Text = Session("user_employee_id")
Then e.Cancel =
Dec 23, 2012 02:19 AM|LINK
You dont need to loop all pages. Manipulate current page only, use page changed event or mode changed event.
Can you explaint what you want with that?
Dec 23, 2012 02:53 AM|LINK
I'm trying to cancel the insert template if there already is a form for the user. I want each user to have only one form page.
Dec 23, 2012 03:08 AM|LINK
I dont understand why you find employeeid label inside insert template, because Insert template is blank form (not from db)
I think you will get employee id in itemtemplate or edititemtemplate only.
Dec 23, 2012 03:15 AM|LINK
That's right I'm looking for the employee_id in the item template. Trying to stop the load of the insert template if I already have a record for the user.
Dec 23, 2012 06:02 AM|LINK
<asp:SqlDataSource ID="SqlDataSourceCheckUser" runat="server"
ConnectionString="<%$ ConnectionStrings:TESTConnectionString %>"
SelectCommand="SELECT * FROM [Yourtable] WHERE ([employee_id] = @employee_id)">
<asp:SessionParameter Name="employee_id" SessionField="user_employee_id"
DataTable dt = ((DataView)SqlDataSourceCheckUser.Select(DataSourceSelectArguments.Empty)).Table;
if (dt.Rows.Count > 0)
//disable inserting here
Dec 23, 2012 10:18 AM|LINK
Thanks, I took a similar approach:
As Label = fvOnlyOne.FindControl("theCountLabel")
If theOnlyOne.Text =
Then e.Cancel =
Dec 23, 2012 10:47 AM|LINK
Dec 24, 2012 12:09 AM|LINK
I come here and see the state of your issue has been marked as an answer, so I'll close your issue.
If you got anything feedback, please feel free to tell us by creating another new thread to continue,