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

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139