Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 30th, 2006, 06:39 PM
Registered User
 
Join Date: May 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please I need help!!

I have seen many posts, but never found a solution. My basic problem is accessing the controls inside the formview when mode is being changed. As I understand, you can only access currentMode's controls. So lets say I want to access edit mode's control and I am in readonly mode, in that case what I am doing is during mode-changed event, i am trying to access a control in edit mode. But the problem is, although it detects the mode has been changed to edit, but it still has readonly mode's controls in memory, instead of edit modes, and edit mode's control do not seem to be available till the page is rendered. So they are only available during page unload event (not even at prerender), when it becomes useless to access and modify control property, because it has already been rendered.

So does anybody know the solution to the problem? I will appreciate if you could help in this regard.

Following is a function in which I am trying to access a couple of controls and I am calling it during mode-changed event:


Protected Sub addValueAttributeToPasswordTextBoxes()

        Dim cntrl1 As Control
        If fvContactDetail.CurrentMode = FormViewMode.Edit Then
            For Each cntrl1 In fvContactDetail.Row.Controls
                Dim SSN As TextBox = CType(cntrl1.FindControl("SSN"), TextBox)
                Dim SSN_PWD As TextBox = CType(cntrl1.FindControl("SSN_PWD"), TextBox)
                Dim SSN_Confirm_PWD As TextBox = CType(cntrl1.FindControl("SSN_Confirm_PWD"), TextBox)
                If Not (SSN Is Nothing Or SSN_PWD Is Nothing Or SSN_Confirm_PWD Is Nothing) Then

                    Dim SSN_PWD_Value As String = SSN_PWD.Attributes.Item("Value")
                    Dim SSN_PWD_Confirm_Value As String = SSN_Confirm_PWD.Attributes.Item("Value")

                    If SSN_PWD_Value Is Nothing Then
                        SSN_PWD.Attributes.Add("Value", SSN.Text)
                    Else
                        SSN_PWD.Attributes.Item("Value") = SSN.Text
                    End If
                    If SSN_PWD_Confirm_Value Is Nothing Then
                        SSN_Confirm_PWD.Attributes.Add("Value", SSN.Text)
                    Else
                        SSN_Confirm_PWD.Attributes.Item("Value") = SSN.Text
                    End If

                    SSN = Nothing
                    SSN_PWD = Nothing

                End If
            Next
        End If
    End Sub


Thanks
Mehranian










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.