Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Earl Teigrob #1
DataGrid Custom Column Error when DataBinding "does not contain a definition for 'DataBinding'"
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.Ev al(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.Dat aGridColumn
{
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)||(itemTy pe==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;
}
}
}
}
Earl Teigrob Guest
-
BoundColumn does not contain a definition for databinding
Hi, I am trying to get a datagrid working, but it seems to have a problem with databinding in a boundcolumn. The error message I get is... -
Template Column Controls DataBinding
Hi I have designed a datagrid control that is inherited from the base datagrid control. The main problem I have is when the grid is in edit mode... -
Datagrid button column gives BC30456: "not a member" error
Hi, Relatively new to asp.net and having some trouble wiring up a button column in a datagrid. I keep getting the error: BC30456: 'AddToCart' is... -
Databinding array of custom classes to DataGrid
I can't seem to bind an array of custom classes to my DataGrid. I get the following error "A field or property with the name 'dcAbbreviation' was... -
Databinding to a custom control...
Hi, I've written a control that consists of a few textboxes, a dropdown box and two radiobuttons. They make up the details of a contact, I want... -
Shravan #2
Re: DataGrid Custom Column Error when DataBinding "does not contain a definition for 'DataBinding'"
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.
"Earl Teigrob" <earlt777@hotmail.com> wrote in message news:<ePJvvC15DHA.2412@TK2MSFTNGP09.phx.gbl>...> 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.Ev al(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.Dat aGridColumn
> {
> 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)||(itemTy pe==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;
> }
> }
>
> }
> }Shravan Guest



Reply With Quote

