各位老师和朋友:
    我做的带有combobox窗体控件挂到网页上,运行程序进入该控件窗体页面,点击combobox自动收回。如果先点击其他,该combobox使用正常。请各位老师和朋友不吝赐教!谢谢!

解决方案 »

  1.   

    从没遇到过,仔细看看html代码看看有什么问题。
      

  2.   

    借用别人写的一段代码填充combobox:
       public class ComboBoxItem
    {
    private string _text=null;
    private object _value=null;
    public string Text{get{return this._text;} set{this._text=value;}}
    public object Value{get {return this._value;} set{this._value=value;}}
    public override string ToString()
    {
    return this._text;
    }
    }
      

  3.   

    在控件的load事件中:
       DataTable t_bumen=new DataTable();
    SqlDataAdapter my_ada=new SqlDataAdapter("select id,BuMenMing from BuMenBiao ",sqlConnection1);
    my_ada.Fill(t_bumen);
    sqlConnection1.Close();
    for(int i=0;i<t_ZhanSuo.Rows.Count;i++)
    {
    ComboBoxItem newItem = new ComboBoxItem();
    newItem.Text=t_bumen.Rows[i]"BuMenMing"].ToString();
    newItem.Value=t_bumen.Rows[i]["id"].ToString();
    cob_gds.Items.Add(newItem);
    }
      

  4.   

    这个ComboBox是否有PostBack?在网页加载的时候有没有用!Page.IsPostBack?
      

  5.   

    估计是js的问题,你看看执行后生成的html代码
      

  6.   

    在网页上挂控件的代码如下:
    <HTML>
    <HEAD>
    <title>BuMen_INFO</title>
    <META http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
    <form id="Form1" method="post" runat="server" scroll="yes">
    <OBJECT id="Flow" height="100%" width="100%" classid='Http://<%@ Page Language="vb"%><%=System.Configuration.ConfigurationSettings.AppSettings.Item("OcxPath")%>/BuMen_INFO.dll#BuMen_INFO.BuMen_INFO' VIEWASTEXT></OBJECT>
    <script language=javascript>Form1.Flow.BuMen_INFO_Load();</script><br>
    </form>
    </body>
    </HTML>
      

  7.   

    Form1.Flow.BuMen_INFO_Load();这个里面有没有使用ispostback之类的东西?看看有没有问题