E
Earl Teigrob
I am creating a custom column that inherits from DataColumnGrid. When I
attempt Databind to a property of the custom column, I get the the error:
CS0117: 'DownloadManager3.CustomBuittonOrText2' does not contain a
definition for 'DataBinding'
Is there some interface I need to impliment or something I need to override
to get databinding working???
Thanks for your help
Earl
The DataGrid code is:
<cc:CustomBuittonOrText2 ShowButton='<%#
csCommonLibrary.Common.IsStringEmpty(DataBinder.Eval(Container.DataItem,"Dow
nloadDate")) %>' Text="Download" AltText="Done" HeaderText="Download"
Visible="True" CommandName="Download" />
and the custom column code is:
(BTW, I know that the databinding event handler does not do anything...yet)
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace DownloadManager3
{
/// <summary>
/// Summary description for CustomBuittonOrText.
/// </summary>
public class CustomBuittonOrText2:System.Web.UI.WebControls.DataGridColumn
{
public CustomBuittonOrText2()
{
//
// TODO: Add constructor logic here
//
}
public override void InitializeCell(TableCell cell, int columnIndex,
ListItemType itemType)
{
base.InitializeCell (cell, columnIndex, itemType);
if
((itemType==ListItemType.AlternatingItem)||(itemType==ListItemType.Item))
{
System.Web.UI.WebControls.Button b = new Button();
b.Text = this._Text;
b.Visible=_ShowButton;
b.CommandName=_CommandName;
cell.Controls.Add(b);
System.Web.UI.WebControls.Label l = new
System.Web.UI.WebControls.Label();
l.Text=_AltText;
l.Visible=!_ShowButton;
cell.Controls.Add(l);
cell.DataBinding +=new EventHandler(cell_DataBinding);
}
}
public void cell_DataBinding(object sender, EventArgs e)
{
}
private bool _ShowButton=true;
public bool ShowButton
{
get
{
return _ShowButton;
}
set
{
_ShowButton=value;
}
}
private string _AltText="";
public string AltText
{
get
{
return _AltText;
}
set
{
_AltText=value;
}
}
private string _Text="";
public string Text
{
get
{
return _Text;
}
set
{
_Text=value;
}
}
private string _CommandName=String.Empty;
public string CommandName
{
get
{
return _CommandName;
}
set
{
_CommandName=value;
}
}
}
}
attempt Databind to a property of the custom column, I get the the error:
CS0117: 'DownloadManager3.CustomBuittonOrText2' does not contain a
definition for 'DataBinding'
Is there some interface I need to impliment or something I need to override
to get databinding working???
Thanks for your help
Earl
The DataGrid code is:
<cc:CustomBuittonOrText2 ShowButton='<%#
csCommonLibrary.Common.IsStringEmpty(DataBinder.Eval(Container.DataItem,"Dow
nloadDate")) %>' Text="Download" AltText="Done" HeaderText="Download"
Visible="True" CommandName="Download" />
and the custom column code is:
(BTW, I know that the databinding event handler does not do anything...yet)
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace DownloadManager3
{
/// <summary>
/// Summary description for CustomBuittonOrText.
/// </summary>
public class CustomBuittonOrText2:System.Web.UI.WebControls.DataGridColumn
{
public CustomBuittonOrText2()
{
//
// TODO: Add constructor logic here
//
}
public override void InitializeCell(TableCell cell, int columnIndex,
ListItemType itemType)
{
base.InitializeCell (cell, columnIndex, itemType);
if
((itemType==ListItemType.AlternatingItem)||(itemType==ListItemType.Item))
{
System.Web.UI.WebControls.Button b = new Button();
b.Text = this._Text;
b.Visible=_ShowButton;
b.CommandName=_CommandName;
cell.Controls.Add(b);
System.Web.UI.WebControls.Label l = new
System.Web.UI.WebControls.Label();
l.Text=_AltText;
l.Visible=!_ShowButton;
cell.Controls.Add(l);
cell.DataBinding +=new EventHandler(cell_DataBinding);
}
}
public void cell_DataBinding(object sender, EventArgs e)
{
}
private bool _ShowButton=true;
public bool ShowButton
{
get
{
return _ShowButton;
}
set
{
_ShowButton=value;
}
}
private string _AltText="";
public string AltText
{
get
{
return _AltText;
}
set
{
_AltText=value;
}
}
private string _Text="";
public string Text
{
get
{
return _Text;
}
set
{
_Text=value;
}
}
private string _CommandName=String.Empty;
public string CommandName
{
get
{
return _CommandName;
}
set
{
_CommandName=value;
}
}
}
}