PDA

View Full Version : [CLOSED] Multicomo fill list and selected items code behind



jstifel
May 21, 2014, 11:10 PM
Dear Sir, I would to be able to fill list and selected items for a multicombo in code behind with no success. Nothing gets displayed.
Please find attached vb code i have written for this purpose. Can you tell me what am I doing wrong?



<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>

<!DOCTYPE html>

<script runat="server">

Private Sub FillBranchMultiCombo(ByVal mc As Ext.Net.MultiCombo)
mc.Items.Clear()
mc.SelectedItems.Clear()
For i As Integer = 1 To 10
mc.Items.Add(New Ext.Net.ListItem With {.Value = i.ToString, .Text = "valor -> " & i.ToString})
If i > 4 And i < 6 Then
mc.SelectedItems.Add(New Ext.Net.ListItem With {.Value = i.ToString, .Text = "valor -> " & i.ToString})
End If
Next
End Sub

Protected Sub btn1click(ByVal sender As Object, ByVal args As DirectEventArgs)
FillBranchMultiCombo(mc1)
End Sub

Protected Sub btn2click(ByVal sender As Object, ByVal args As DirectEventArgs)
FillBranchMultiCombo(mc2)
End Sub

Protected Sub Page_Load(sender As Object, e As EventArgs)

End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<extnet:ResourceManager ID="resourceManager" runat="server" />
<extnet:FormPanel runat="server" ID="formpanel1" Layout="FormLayout" Region="Center">
<Items>
<extnet:MultiCombo runat="server" ID="mc1" />
<extnet:MultiCombo runat="server" ID="mc2" />
</Items>
<Buttons>
<extnet:Button runat="server" ID="btn1" Text="mc1">
<DirectEvents>
<Click OnEvent="btn1click" >

</Click>
</DirectEvents>
</extnet:Button>
<extnet:Button runat="server" ID="btn2" Text="mc2">
<DirectEvents>
<Click OnEvent="btn2click" >

</Click>
</DirectEvents>
</extnet:Button>
</Buttons>
</extnet:FormPanel>
</form>
</body>
</html>

Daniil
May 22, 2014, 6:20 AM
Hi @jstifel,

Changing a MultiCombo's Items doesn't affect on a client side representation of that MultiCombo. You can re-render a MultiCombo.


Protected Sub btn1click(ByVal sender As Object, ByVal args As DirectEventArgs)
FillBranchMultiCombo(mc1)
mc1.Render()
End Sub

Protected Sub btn2click(ByVal sender As Object, ByVal args As DirectEventArgs)
FillBranchMultiCombo(mc2)
mc2.Render()
End Sub