p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
I forgot my password Register Now
Register | FAQ | Members List | Calendar | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 21st, 2006, 04: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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old May 21st, 2006, 05: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"

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 08:17 AM
View an ado recordset in a form feets Access VBA 5 June 20th, 2007 07: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
saving view state in dynamically created controls abinashpatra ASP.NET 1.1 1 June 20th, 2005 08:51 AM
Resizing of form view - problem lmadhavi Visual C++ 2 October 1st, 2004 07:18 AM



All times are GMT -4. The time now is 05:13 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc