Example #1
0
        public void RefreshValues()
        {
            if (!string.IsNullOrEmpty(Code) && ListControl != null)
            {
                var data = (DataSourceView)methodInfo.Invoke(ListControl, new object[0]);
                var view = data as TableDataSourceView;
                if (view == null)
                {
                    throw new Exception(
                              string.Format("Конрол '{0}' не использует TableDataSourceView в виде источника", ListControl.ID));
                }
                var dic = new Dictionary <string, string> {
                    { CodeField, Code }
                };
                DataRowView row = FindHelper.FindRow(dic,
                                                     new DataView(view.Table, view.GetFilterString(), "",
                                                                  DataViewRowState.CurrentRows));
                if (row != null)
                {
                    Value = row[ValueField].ToString();
                }
                else
                {
                    throw new Exception(string.Format("Table '{0}' not containt code in '{1}'", view.Table.TableName,
                                                      EnableControls.ID));
                }
            }

            if (!string.IsNullOrEmpty(Value) && BaseListDataBoundControl != null)
            {
                ClientID  = BaseListDataBoundControl.GetClientID(Value);
                ControlID = ClientID;
            }
        }