DataGrid Custom Column Error when DataBinding "does not contain a definition for 'DataBinding'"

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;
}
}

}
}
 
S

Shravan

Hi Teigrob,
I too am suffering from the same problem you were encountering,
can you suggest me any solution if you have found one.
In my case I am writing a custom combobox column in a fully
editable grid(where in every row every column would be editable by a
control).

<CustCol:ComboBoxColumn HeaderText="Designation" DataField="DesignId"
ComboDataSource='<%# GetDesignations() %>'
ComboTextField="Designation" ComboValueField="DesignId"
ColumnWidth=100 />

My code for declaring that column in the grid is as above.
the attribute declaration
ComboDataSource='<%# GetDesignations() %>'
is throwing the
ERROR "'GridCustomColumns.ComboBoxColumn' does not contain a
definition for 'DataBinding'"
Can you please help me out if you have a found a solution.
Thanks,
Shravan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top