Re: DataGrid [Attribute] ???

From: Manohar Kamath (mkamath_at_TAKETHISOUTkamath.com)
Date: 12/24/04

  • Next message: Manohar Kamath: "Re: Dataview in another assembly"
    Date: Fri, 24 Dec 2004 02:30:25 -0600
    
    

    Why not use a DataGridTableStyle?

    -- 
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com
    "Bret Pehrson" <bret@classicade.com> wrote in message
    news:41C88A51.928DC825@classicade.com...
    > Question/issue:
    >
    > I'm using a custom data source for my (WinForms) datagrid:
    >
    > public class MyDataSource : IList
    > {
    >   public void AddRow(string firstName, string lastName);
    >   // ...
    > }
    >
    > each row is a:
    >
    > public class MyDataRow
    > {
    >   public string FirstName
    >   {
    >     get { return firstName; }
    >   }
    >   private string firstName;
    >   //...
    > }
    >
    > Then:
    >
    >   MyDataSource data = new MyDataSource();
    >   data.AddRow("Bret", "Pehrson");
    >   //...
    >
    >   grid.DataSource = data;
    >
    >
    > Now, everything displays fine in the DataGrid.  I'm not using any designer
    or
    > other parameters to set up the columns, just letting the data source and
    grid
    > figure that out.  The only problem that I have is that I want the DataGrid
    to
    > display "First name" as the column header and not "FirstName" as is
    currently
    > happening.
    >
    > What I'd hope would be possible is some attribute on the FirstName
    property
    > that would specify the column name, something like
    >
    >   [HeaderText("First name")]
    >   public string FirstName
    >   {
    >     get { return firstName; }
    >   }
    >
    > Is there such a beast?  I've looked and looked, and can't find anything.
    I
    > want all of this to be done in the code for the MyDataRow/MyDataSource
    class.
    >
    > Thanks
    

  • Next message: Manohar Kamath: "Re: Dataview in another assembly"

    Relevant Pages

    • Re: DataGrid [Attribute] ???
      ... > I'm using a custom data source for my datagrid: ... > public class MyDataSource: IList ... > public string FirstName ... everything displays fine in the DataGrid. ...
      (microsoft.public.dotnet.framework.windowsforms)
    • Re: DataGrid [Attribute] ???
      ... > I'm using a custom data source for my datagrid: ... > public class MyDataSource: IList ... > public string FirstName ... everything displays fine in the DataGrid. ...
      (microsoft.public.dotnet.framework.windowsforms.controls)
    • Need pointer on DataGrid custom data attribute
      ... I'm using a custom data source for my datagrid: ... public class MyDataSource: IList ... public string FirstName ... everthing displays fine in the datagrid. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: DataGrid [Attribute] - $10 for answer
      ... > descriptor information which the grid will pick up and use to display it's ... > the data grid column styles first, and then bind your data source to the ... trivial to have originally implemented the DataGrid in such a way as to query ... >> public string FirstName ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: DataGrid [Attribute] ???
      ... it seems that it would be appropriate if the DataGrid control ... >>> public class MyDataSource: IList ... >>> public string FirstName ... >>> other parameters to set up the columns, just letting the data source ...
      (microsoft.public.dotnet.framework.windowsforms.databinding)

    Loading