settting up Control properties in between postbacks is not working
I am settting up control propertis on page load. Like visiblilty of control depending on loaded data. And very simple setting up images to button controls. For page load it works fine but on postback these values are not set back. This is my code. When it’s a postback btnSecurityQA image is missing and visibility of all following controls is not set accordingly.
If Not IsPostBack Then
ButtonImage.SetPath(btnSecurityQA, GetLocalResourceObject(btnSecurityQA.ID & "BaseName").ToString())
' following control's visibility is set by the view interface
Dim accountsPresenter = New AccountsPresenter
accountsPresenter.SetAccountVisibility(Me, m_Account)
chkMoneyMarket.Visible = _moneyMarketVisible
lblRoutingNumber.Visible = _routingNumberVisible
txtRoutingNumber.Visible = _routingNumberVisible
lblSubType.Visible = _loanSubTypeVisible
cboLoanSubType.Visible = _loanSubTypeVisible
If Not IsNothing(m_Account) Then
If m_Account.Id <> Guid.Empty Then
Cal开发者_C百科l PopulateLoanAccountSubTypes()
Call PopulateData()
End If
End If
End If
The code you have posted there will only run the first time the page is loaded due to the fact that it is inside a "If Not IsPostback Then" conditional statement. This code won't execute on a postback as that is what you are checking for.
精彩评论