Adf.Web.UI.SmartView.BaseButton.ItemDataBinding C# (CSharp) Method

ItemDataBinding() protected method

Provides the data binding to TableCell.
protected ItemDataBinding ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        protected virtual void ItemDataBinding(object sender, EventArgs e)
        {
            if (DataField.IsNullOrEmpty()) return;

            var cell = sender as TableCell;
            if (cell == null) return;

            var item = cell.NamingContainer as GridViewRow;
            if (item == null || item.DataItem == null) return;

            var value = PropertyHelper.GetValue(item.DataItem, DataField);

            var control = cell.Controls.Cast<Control>().OfType<IButtonControl>().FirstOrDefault();
            if (control != null) control.Text = FormatHelper.ToString(value);
            //            cell.Controls.Add(new LinkButton { Text = FormatHelper.ToString(value) });

            if (value is Enum) cell.ToolTip = (value as Enum).GetDescription();
            else if (!ToolTipField.IsNullOrEmpty()) cell.ToolTip = FormatHelper.ToString(PropertyHelper.GetValue(item.DataItem, ToolTipField));
        }