Boundfield display value

Discussion in 'ASP .Net' started by Peter, Jun 26, 2009.

  1. Peter

    Peter Guest

    Hi

    I have a <asp:Boundfield> which returns the value of a datasource field. Can I have the text display something else depending on
    the value of the field ? Let's say


    Field Contents Display
    1 a
    2 b
    3 c
    4 d
    5 e

    Thanks
    Peter
     
    Peter, Jun 26, 2009
    #1
    1. Advertising

  2. Peter

    Peter Guest

    Thanks Mark but what's the subsitute for RowDataBound in DetailsView

    "Mark Rae [MVP]" <> wrote in message news:...
    > "Peter" <> wrote in message news:%...
    >
    >> I have a <asp:Boundfield> which returns the value of a datasource field. Can I have the text display something else depending on
    >> the value of the field?

    >
    > http://forums.asp.net/p/1190117/2058828.aspx#2058828
    > http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    Peter, Jun 27, 2009
    #2
    1. Advertising

  3. Peter

    Peter Guest

    Thanks Mark.. I got it both in my Gridview and DetailsView. But one last question, in a GridView, I need to use Cells[0], Cells[1],
    Cells[3], etc.... to refer to the cell contents in displayed order. .. What if I add or remove a boundfield later on, I need to
    chagne the reference number all over the place.. Can I refer to the Field name directly somehow ?

    Regards,
    Peter


    "Mark Rae [MVP]" <> wrote in message news:...
    > "Peter" <> wrote in message news:Of36%...
    >
    > [please don't top-post]
    >
    >>>> I have a <asp:Boundfield> which returns the value of a datasource field. Can I have the text display something else depending
    >>>> on the value of the field?
    >>>
    >>> http://forums.asp.net/p/1190117/2058828.aspx#2058828
    >>> http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx

    >>
    >> Thanks Mark but what's the substitute for RowDataBound in DetailsView

    >
    > http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.itemcreated.aspx
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    Peter, Jun 27, 2009
    #3
  4. Peter

    Peter Guest

    Gotcha...that seems to be a pretty good solution.

    Thanks again
    Peter

    "Mark Rae [MVP]" <> wrote in message news:...
    > "Peter" <> wrote in message news:...
    >
    > *** [please don't top-post] ***
    > http://www.caliburn.nl/topposting.html
    >
    >>>>>> I have a <asp:Boundfield> which returns the value of a datasource field. Can I have the text display something else depending
    >>>>>> on the value of the field?
    >>>>>
    >>>>> http://forums.asp.net/p/1190117/2058828.aspx#2058828
    >>>>> http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx
    >>>>
    >>>> Thanks Mark but what's the substitute for RowDataBound in DetailsView
    >>>
    >>> http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.itemcreated.aspx

    >>
    >> in a GridView, I need to use Cells[0], Cells[1], Cells[3], etc.... to refer to the cell contents in displayed order. ..

    >
    > That's correct.
    >
    >
    >> What if I add or remove a bound field later on, I need to change the reference number all over the place..

    >
    > That's correct.
    >
    >
    >> Can I refer to the Field name directly somehow?

    >
    > Not directly. You can do something like this:
    > http://forums.asp.net/p/1079673/1594202.aspx#1594202
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    Peter, Jun 27, 2009
    #4
  5. Peter

    Peter Guest

    Peter, Jun 27, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGFiYmxlcg==?=
    Replies:
    6
    Views:
    13,381
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Apr 4, 2006
  2. hazz
    Replies:
    0
    Views:
    808
  3. sloan
    Replies:
    3
    Views:
    6,152
    sloan
    Jun 14, 2006
  4. David C
    Replies:
    2
    Views:
    14,550
    David C
    Jan 14, 2008
  5. sjsean
    Replies:
    0
    Views:
    1,055
    sjsean
    Feb 7, 2009
Loading...

Share This Page