0

Hello,
I am having an issue with the FindControl looking for a textbox in the Insert mode.
I am doing this in the ItemCommand.

I have a "Copy" button that is on the ReadOnly mode. I then change over to the Insert mode and start working with filling in some of the data that is not bound (splitting the date and time into their own fields).

I check to see if the CurrentMode is in Insert mode before I do the FindControl. Here is my code.

        Dim tbCallBackDate As TextBox

        If fvMailout.CurrentMode <> FormViewMode.ReadOnly Then
            If e.CommandName = "Cancel" Then
                GoBack()
            End If

            tbCallBackDate = fvMailout.Row.FindControl("CallBackDateTextBox")

            If IsDate(tbCallBackDate.Text) Then
                If tbCallBackDate.Text = dtDefault Then
                    tbCallBackDate.Text = Nothing
                End If
            Else
                tbCallBackDate.Text = Nothing
            End If
            Session("OrigCallBackDate") = tbCallBackDate.Text
        End If

Here is the Textbox Coding:

<asp:TextBox ID="CallBackDateTextBox" runat="server" 
CssClass="Textbox" TabIndex="17" Text='<%# Bind("CallBackDate", "{0:d}") %>' 
Visible="False" Width="100px" AutoPostBack="True" />

Any help would be greatly appreciated.
Eddi Rae

1
Contributor
1
Reply
8
Views
4 Years
Discussion Span
Last Post by EddiRae
0

I found the issue. I had this in the ItemCommand. Once I moved this code to the Page's PreRenderComplete, the item was found.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.