Oct 18, 2010, 8:56 AM
[CLOSED] Could not refresh the combobox data in the UI after I added the new item?
My Code:
After I click the "Button", the combobox items shoud be changed to
1,2,3
But the result is still
1,2
Please help me .
Thanks.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
<%@ 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:Panel ID="pa" runat="server">
<TopBar>
<ext:Toolbar ID="Tl1" runat="server">
<Items>
<ext:Button ID="b" runat="server" Text="OK">
<DirectEvents>
<Click OnEvent="AddItems">
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Items>
<ext:ComboBox SelectedIndex=0 ID="c1" runat="server">
<Items>
<ext:ListItem Text="0" Value="0" />
<ext:ListItem Text="1" Value="1" />
</Items>
</ext:ComboBox>
</Items>
</ext:Panel>
<div>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void AddItems(object sender, DirectEventArgs e)
{
Ext.Net.ListItem l = new Ext.Net.ListItem();
l.Text = "2";
l.Value = "2";
c1.Items.Add(l);
X.Msg.Alert("",c1.Items.Count.ToString()).Show();
}
}
My expection is that: After I click the "Button", the combobox items shoud be changed to
1,2,3
But the result is still
1,2
Please help me .
Thanks.
Last edited by Daniil; Oct 19, 2010 at 12:07 PM.
Reason: [CLOSED]