Results 1 to 2 of 2

Thread: GridView - .net 2.0

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    GridView - .net 2.0

    Hi,
    In a DataGrid I have placed a comandField select button. This field sometimes shows a text value and should sometimes show the select button instead (Depending on the business rule).
    How can I make the select button to appear?
    I basically want to put the code where the question mark is to show the button instead of the text.

    i.e.
    in grid_RowDataBound event


    If (e.Row.RowType = DataControlRowType.DataRow) Then
    If Not (e.Row.DataItem("c_start_date").ToString() Is Nothing) Then
    e.Row.Cells(9).Text = e.Row.DataItem("c_clinic_code").ToString() 'Change ur text here
    Else
    'show the accept(select) button as there is no start date...
    ??????????????????????
    End If
    End If




    Thanks

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: GridView - .net 2.0

    VB Code:
    1. '...
    2. Else
    3. Dim btn As New System.Web.UI.Controls.Button  ' Find out the exact syntax.
    4. e.Row.Cells(9).Controls.Add(btn)

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