I have radPanel bar on a page to which I am adding panel items dynamically with user controls. I want to Ajaxify the radpanel item. When user clicks on Save button on the user control I just want to post that current PanelItem. I am trying to do this by following code. I get Error Assertion failed length of elements and json must be the same.
This is the code to Add item dynamically:
With radPanelNew
.Text = account.Name.ToString
.Value = account.Id.ToString
.Font.Italic = True
.Font.Underline = True
.Font.Size = 10
'.ID = account.Id.ToString
End With
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 = "SA" & account.Id.ToString
acct = DirectCast(ucSavings.FindControl("acct1"), SubscriberSetupPages_UserControls_Account)
radPanelNewChild.Controls.Add(ucSavings)
radPanelNew.Items.Add(radPanelNewChild)
With radParentItem
.Items.Add(radPanelNew)
.DataBind()
.Expanded = True
End With
This is the code to Ajaxify radpanelitem:
Private Sub pnlBarAccounts_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Handles pnlBarAccounts.ItemCreated
' Following code is to Ajaxify RadPanelItem
Dim acct As UserControl
If e.Item.Controls.Count > 0 Then
If Not IsNothing(e.Item.Controls(0)) Then
If Not IsNothing(e.Item.Controls(0).ID) Then
Select Case (e.Item.Controls(0).ID.ToString).Substring(0, 2)
Case "SA"
acct = DirectCast(e.Item.Controls(0), SubscriberSetupPages_UserControls_SavingsAccount)
End Select
End If
End If
End If
If Not IsNothing(acct) Then
Dim btnSave As ImageButton = DirectCast(acct.FindControl("btnSave"), ImageButton)
If Not IsNothing(btnSave) Then
RadAjaxManagerProxyAcctSetup.AjaxSettings.AddAjaxSetting(btnSave, e.Item)
End If
End If
End Sub