Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old May 21st, 2006, 03:54 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form View Controls Unaccessable

I have seen many posts, but never found a solution. My basic problem is accessing the controls inside the formview. 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, so what I am doing is during mode-changed event, i am trying to access a control in edit mode. But irony is, although it detects the mode has been changed to edit, but it still has readonly mode's editmode's controls in memory, instead of edit mode;s, which become available after 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?

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

  #2 (permalink)  
Old May 21st, 2006, 04:02 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Correction to the sentence:

"but it still has readonly mode's controls in memory"



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to view picture by using form view? mysecondlove ASP.NET 2.0 Basics 1 April 8th, 2008 07:17 AM
View an ado recordset in a form feets Access VBA 5 June 20th, 2007 06:19 AM
Chapter 6: Templated Controls In Design View geomar BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 1 February 20th, 2007 12:23 PM
Resizing of form view - problem lmadhavi Visual C++ 2 October 1st, 2004 06:18 AM





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