View Full Version : [CLOSED] ComboBox SelectedItem in UserControl

Apr 25, 2013, 3:32 PM
I am still going around in circles on UserControlLoader and ComponentLoader. So I thought I would try something simple with UserControlLoader, but I can not retrieve the SelectedItem.Value of a combobox in the user control. What am I not remembering?


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void ClickBuildDescription(object sender, DirectEventArgs e)
Options05 uc = (Options05)this.uclOptions.UserControls[0];

String description = uc.BuildDescription();
X.Msg.Alert("Description from user control", description).Show();
<!DOCTYPE html >
<head id="Head1" runat="server">
<title>Load UserControls</title>
<ext:ResourceManager runat="server" />
<ext:Panel runat="server" Layout="BorderLayout" Height="100" Width="400">
<ext:Panel runat="server" Title="Center" Region="Center">
<ext:UserControlLoader ID="uclOptions" runat="server" Path="Options05.ascx" />
<ext:Button runat="server" Text="Description" OnDirectClick="ClickBuildDescription" />


<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Options05.ascx.cs" Inherits="Options05" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<ext:FieldSet ID="OptionFieldSet" runat="server" ClientIDMode="Static" Title="Options"
<ext:Container ID="OptionsCat01" runat="server" ClientIDMode="Static">
<ext:ComboBox ID="Cat01Type" runat="server" FieldLabel="Option01 Types" AllowBlank="false"
Editable="false" IndicatorIcon="BulletRed">
<ext:ListItem Value="F" Text="Full" />
<ext:ListItem Value="P" Text="Partial" />


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Options05 : System.Web.UI.UserControl
public String BuildDescription()
String description = Cat01Type.SelectedItem.Value;
return description;

Apr 25, 2013, 5:20 PM
Hi Chris,

I think you have to define:

<form runat="server">

Otherwise nothing is automatically submitted.