Sep 01, 2011, 6:30 PM
[CLOSED] Always selected Item is nothing for combobox as menu item
Hi,
I am not sure why any value selected from combobox showing as menu item in toolbar always returns "Nothing". Please check the sample code. While debugging I have placed break point at cboRoles direct event. After selecting either branch or role, the controls are always showing selectedItem.value is nothing. Please let me know where I need to modify.
I am not sure why any value selected from combobox showing as menu item in toolbar always returns "Nothing". Please check the sample code. While debugging I have placed break point at cboRoles direct event. After selecting either branch or role, the controls are always showing selectedItem.value is nothing. Please let me know where I need to modify.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ToolbarMenuCheck.aspx.vb"
Inherits="Testing_ToolbarMenuCheck" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
<Items>
<ext:Panel ID="pnlProfile" runat="server" Region="Center" Border="false"
BodyStyle="background-color:#ffffff">
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="btnLoanFilter" runat="server" Text="Loan Filters">
<Menu>
<ext:Menu ID="mnuLoanFilter" runat="server">
<Items>
<ext:ComponentMenuItem ID="mnuItemBranches" runat="server">
<Component>
<ext:ComboBox runat="server" ID="cboBranches" Width="200">
<DirectEvents>
<Select OnEvent="LoadUsersAndLoansForBranch">
<EventMask ShowMask="true" />
</Select>
</DirectEvents>
</ext:ComboBox>
</Component>
</ext:ComponentMenuItem>
<ext:MenuSeparator />
<ext:ComponentMenuItem ID="mnuItemRoles" runat="server">
<Component>
<ext:ComboBox runat="server" ID="cboRoles" Width="200">
<DirectEvents>
<Select OnEvent="LoadUsersAndLoansForRole">
<EventMask ShowMask="true" />
</Select>
</DirectEvents>
</ext:ComboBox>
</Component>
</ext:ComponentMenuItem>
<ext:MenuSeparator />
</Items>
</ext:Menu>
</Menu>
</ext:Button>
<ext:ToolbarFill />
</Items>
</ext:Toolbar>
</TopBar>
<Items>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
Code behind...
Imports Ext.Net
Partial Class Testing_ToolbarMenuCheck
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Ext.Net.X.IsAjaxRequest Then
Call SetDefaultInfo()
End If
End Sub
Public Sub LoadUsersAndLoansForBranch(ByVal sender As Object, ByVal e As DirectEventArgs)
Call LoadBranchUsers(cboRoles.SelectedItem.Value, cboBranches.SelectedItem.Value)
End Sub
Public Sub LoadUsersAndLoansForRole(ByVal sender As Object, ByVal e As DirectEventArgs)
If Not cboRoles.SelectedItem.Value Is Nothing And Not cboBranches.SelectedItem.Value Is Nothing Then
Call LoadBranchUsers(cboRoles.SelectedItem.Value, cboBranches.SelectedItem.Value)
End If
End Sub
Public Sub SetDefaultInfo()
cboBranches.Items.Add(New Ext.Net.ListItem("Select branch", "0"))
cboBranches.Items.Add(New Ext.Net.ListItem("branch1", "1"))
cboBranches.Items.Add(New Ext.Net.ListItem("branch2", "2"))
cboBranches.Items.Add(New Ext.Net.ListItem("branch3", "3"))
cboBranches.SelectedIndex = 0
cboRoles.Items.Add(New Ext.Net.ListItem("Select Role", "0"))
cboRoles.Items.Add(New Ext.Net.ListItem("Role1", "1"))
cboRoles.Items.Add(New Ext.Net.ListItem("Role2", "2"))
cboRoles.Items.Add(New Ext.Net.ListItem("Role3", "3"))
cboRoles.SelectedIndex = 0
End Sub
Public Sub LoadBranchUsers(ByVal roleid As Integer, ByVal branchid As Integer)
End Sub
End Class