This is a migrated thread and some comments may be shown as answers.

PanelBar item postback

0 Answers 84 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
A K
Top achievements
Rank 1
A K asked on 19 Apr 2010, 08:35 PM

I am dynamically loading RadpanelItems with diffenent user controls. When I click save button on one of the user controls, it sends postback to page and reloads all these panel items. Can I just postback current panel Item?

This is my code. Every time I click any button on the user controls reloads panelbar.

 

 

      Private Sub SetPanelItems(ByVal account As Account, ByVal radParentItem As RadPanelItem, ByVal focusAccountId As String)

 

            'This method selects user control for Panel according to account Type

 

            Dim radPanelNew As New RadPanelItem                                       'New items will be added to panel bar

            Dim radPanelNewChild As New RadPanelItem

            Dim acct As SubscriberSetupPages_UserControls_Account

           

            With radPanelNew

                  .Text = account.Name.ToString

                  .Value = account.Name

                  .Font.Italic = True

                  .Font.Underline = True

                  .Font.Size = 10

            End With

            If UCase(account.Id.ToString) = UCase(focusAccountId) Then                                                    'Trying to set expanded property to true to set focus to particular account. This is needed when this page is called from Alert set up to show account related to selected Alert

                  radPanelNew.Expanded = True

                  radPanelNewChild.Expanded = True

            End If

            'Depending on Account type or SubType User control is loaded in the panel item

            Select Case account.Type.Text

                  Case Entities.Account.AccountType.Bank.ToString

                        If account.SubType.Text = Entities.Account.SubAccountType.Savings.ToString Then

                              Dim ucSavings As SubscriberSetupPages_UserControls_SavingsAccount = CType(LoadControl("~/SubscriberSetupPages/UserControls/SavingsAccount.ascx"), SubscriberSetupPages_UserControls_SavingsAccount)

                              ucSavings.AccountID = account.Id

                              ucSavings.ID = account.Id.ToString

                              acct = DirectCast(ucSavings.FindControl("acct1"), SubscriberSetupPages_UserControls_Account)

                              radPanelNewChild.Controls.Add(ucSavings)

                        ElseIf account.SubType.Text = Entities.Account.SubAccountType.Checking.ToString Then

                              Dim ucChecking As ACDCA.MyFmNow.SubscriberSetupPages_UserControls_CheckingAccount = CType(LoadControl("~/SubscriberSetupPages/UserControls/CheckingAccount.ascx"), ACDCA.MyFmNow.SubscriberSetupPages_UserControls_CheckingAccount)

                              ucChecking.ID = account.Id.ToString

                              ucChecking.AccountID = account.Id

                              acct = DirectCast(ucChecking.FindControl("acct1"), SubscriberSetupPages_UserControls_Account)

                              radPanelNewChild.Controls.Add(ucChecking)

                        ElseIf account.SubType.Text = Entities.Account.SubAccountType.CreditLine.ToString Then

                              Dim ucCreditLine As ACDCA.MyFmNow.SubscriberSetupPages_UserControls_CreditLine = CType(LoadControl("~/SubscriberSetupPages/UserControls/CreditLine.ascx"), ACDCA.MyFmNow.SubscriberSetupPages_UserControls_CreditLine)

                              ucCreditLine.AccountID = account.Id

                              acct = DirectCast(ucCreditLine.FindControl("acct1"), SubscriberSetupPages_UserControls_Account)

                              radPanelNewChild.Controls.Add(ucCreditLine)

                        End If

                  Case Entities.Account.AccountType.CreditCard.ToString

                        Dim ucCreditCard As ACDCA.MyFmNow.SubscriberSetupPages_UserControls_CreditCard = CType(LoadControl("~/SubscriberSetupPages/UserControls/CreditCard.ascx"), ACDCA.MyFmNow.SubscriberSetupPages_UserControls_CreditCard)

                        ucCreditCard.AccountID = account.Id

                        acct = DirectCast(ucCreditCard.FindControl("acct1"), SubscriberSetupPages_UserControls_Account)

                        radPanelNewChild.Controls.Add(ucCreditCard)

                  Case Entities.Account.AccountType.Loan.ToString

                        Dim ucLoan As ACDCA.MyFmNow.SubscriberSetupPages_UserControls_Loan = CType(LoadControl("~/SubscriberSetupPages/UserControls/Loan.ascx"), ACDCA.MyFmNow.SubscriberSetupPages_UserControls_Loan)

                        ucLoan.AccountID = account.Id

                        acct = DirectCast(ucLoan.FindControl("acct1"), SubscriberSetupPages_UserControls_Account)

                        radPanelNewChild.Controls.Add(ucLoan)

                  Case Entities.Account.AccountType.Investment.ToString

                        Dim ucInvestment As ACDCA.MyFmNow.SubscriberSetupPages_UserControls_InvestmentAccount = CType(LoadControl("~/SubscriberSetupPages/UserControls/InvestmentAccount.ascx"), ACDCA.MyFmNow.SubscriberSetupPages_UserControls_InvestmentAccount)

                        ucInvestment.AccountID = account.Id

                        acct = DirectCast(ucInvestment.FindControl("acct1"), SubscriberSetupPages_UserControls_Account)

                        radPanelNewChild.Controls.Add(ucInvestment)

            End Select

            ' Setting up OnClient click for button on user control

            Dim btnSecurityQA As ImageButton = DirectCast(acct.FindControl("btnSecurityQA"), ImageButton)

           

            acct.Account = account ''This needs to set here to set control visibilities on Account user Control

            radPanelNew.Items.Add(radPanelNewChild)

            With radParentItem

                  .Items.Add(radPanelNew)

                  .DataBind()

                  .Expanded = True

            End With

 

      End Sub

No answers yet. Maybe you can help?

Tags
PanelBar
Asked by
A K
Top achievements
Rank 1
Share this question
or