Inheritance: IComponent, IDisposable, IServiceProvider
コード例 #1
0
        /// <summary>
        /// DataBind user control to the specified source and column
        /// </summary>
        /// <param name="ADataSource">The source to bind to</param>
        /// <param name="AColumnName">The column to bind to</param>
        public void PerformDataBinding(System.ComponentModel.MarshalByValueComponent ADataSource, String AColumnName)
        {
            if (!FUserControlInitialised)
            {
                InitialiseUserControl();
            }

            // MessageBox.Show((ADataSource as DataView).Count.ToString );
            cmbCountry.cmbCombobox.DataBindings.Add("SelectedValue", ADataSource, AColumnName);
        }
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            string[] textArray1 = null;
            ArrayList list1 = new ArrayList();
            if (context != null)
            {
                IComponent component1 = context.Instance as IComponent;
                if (component1 != null)
                {
                    MarshalByValueComponent teste = new MarshalByValueComponent();

                    GridViewCustom.GridView view1 = component1 as GridViewCustom.GridView;
                    if (view1 != null)
                    {

                        foreach (Control control in util.ObterControle<WebControlCustomColection>(view1.Page.Controls))
                        {
                            string text1 = control.ID;
                            if (!list1.Contains(text1))
                            {
                                list1.Add(text1);
                            }
                        }
                        list1.Sort();
                        //foreach (Control control in view1.Page.Controls)
                        //{
                        //    if(control is WebControlCustomColection)
                        //    {
                        //        string text1 = control.ID;
                        //        if (!list1.Contains(text1))
                        //        {
                        //            list1.Add(text1);
                        //        }
                        //    }
                        //}
                        list1.Sort();
                        textArray1 = new string[list1.Count];
                        list1.CopyTo(textArray1, 0);
                    }
                }
            }
            return new TypeConverter.StandardValuesCollection(textArray1);
        }