CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2001
    Location
    UK
    Posts
    308

    Change DataGrid value while associating DataSet

    In Windows application, in DataSet, I hv one column “Status”. This will have the value ranging from 1 to 5.
    While displaying content of this DataSet in DataGrid, “Status” value should be converted into meaningful text like
    1 = “New”, 2 = “Open” … 5 = “Closed”

    Can you please shed any light on achieving this.

    thanks

    Venu
    Venu Bharadwaj
    "Dream it. U can do it!"

  2. #2
    Join Date
    Feb 2005
    Location
    "The Capital"
    Posts
    5,306

    Thumbs up Re: Change DataGrid value while associating DataSet

    Try modifying the information in your dataset with the appropriate string values before binding it with the datagrid.

  3. #3
    Join Date
    Dec 2001
    Location
    UK
    Posts
    308

    Re: Change DataGrid value while associating DataSet

    DataSet is associted with the XML schema (i'm reading the data from XML source) and it 'll not allow me to change the content to different datatype
    Venu Bharadwaj
    "Dream it. U can do it!"

  4. #4
    Join Date
    Jun 2005
    Location
    Maryland,USA
    Posts
    20

    Re: Change DataGrid value while associating DataSet

    write that logic inside the ItemDataBound event of the datagrid which is called before the data is bound to the grid.
    This event is called once for every record bound to the grid.So check for the value in the required column,if it is 1 then set it to "one" or whatever text you want to.When the record is bound to the grid it will have this text value insetad of the previous number.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured