FindControl with GridView

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sck10

    #1

    FindControl with GridView

    Hello,

    I have the following GridView. I need to be able to get to the DataFields
    and set the Visible property. Any help with this would be appreciated.

    Thanks, sck10


    <!-- Grid: List of all the Services from the Textbox -->
    <asp:GridView ID="gvSearchDat a" runat="server"
    DataSourceID="d sSearchData"
    DataKeyNames="H andle"
    Width="100%">
    <Columns>
    <asp:BoundFie ld DataField="strF ullName"
    Visible="true"
    HeaderText="Nam e"
    SortExpression= ""
    HeaderStyle-Cssclass="BlkB"
    HeaderStyle-VerticalAlign=" Bottom"
    ItemStyle-HorizontalAlign ="left"
    ItemStyle-Width="15%" />

    <asp:CheckBoxFi eld DataField="IsAc tive"
    Visible="true"
    HeaderText="Act ive"
    SortExpression= ""
    HeaderStyle-Cssclass="BlkB"
    HeaderStyle-VerticalAlign=" Bottom"
    ItemStyle-HorizontalAlign ="center"
    ItemStyle-Width="7%" />
    </Columns>
    </asp:GridView>


  • Brandon Driesen

    #2
    Re: FindControl with GridView

    if it is the column that you wish to set globally, then
    [C#]
    gvSearchData.Co lumns[1].Visible = false;

    [VB.NET]
    gvSearchData.Co lumns(1).Visibl e = False



    "sck10" <sck10@online.n ospamwrote in message
    news:%23a5Jk$th HHA.3412@TK2MSF TNGP02.phx.gbl. ..
    Hello,
    >
    I have the following GridView. I need to be able to get to the DataFields
    and set the Visible property. Any help with this would be appreciated.
    >
    Thanks, sck10
    >
    >
    <!-- Grid: List of all the Services from the Textbox -->
    <asp:GridView ID="gvSearchDat a" runat="server"
    DataSourceID="d sSearchData"
    DataKeyNames="H andle"
    Width="100%">
    <Columns>
    <asp:BoundFie ld DataField="strF ullName"
    Visible="true"
    HeaderText="Nam e"
    SortExpression= ""
    HeaderStyle-Cssclass="BlkB"
    HeaderStyle-VerticalAlign=" Bottom"
    ItemStyle-HorizontalAlign ="left"
    ItemStyle-Width="15%" />
    >
    <asp:CheckBoxFi eld DataField="IsAc tive"
    Visible="true"
    HeaderText="Act ive"
    SortExpression= ""
    HeaderStyle-Cssclass="BlkB"
    HeaderStyle-VerticalAlign=" Bottom"
    ItemStyle-HorizontalAlign ="center"
    ItemStyle-Width="7%" />
    </Columns>
    </asp:GridView>
    >
    >

    Comment

    • sck10

      #3
      Re: FindControl with GridView

      Thanks Brandon,

      Just what I was looking for...

      sck10


      "Brandon Driesen" <devplayer04@us er.comwrote in message
      news:132tl0idkr dje30@corp.supe rnews.com...
      if it is the column that you wish to set globally, then
      [C#]
      gvSearchData.Co lumns[1].Visible = false;
      >
      [VB.NET]
      gvSearchData.Co lumns(1).Visibl e = False
      >
      >
      >
      "sck10" <sck10@online.n ospamwrote in message
      news:%23a5Jk$th HHA.3412@TK2MSF TNGP02.phx.gbl. ..
      >Hello,
      >>
      >I have the following GridView. I need to be able to get to the
      >DataFields and set the Visible property. Any help with this would be
      >appreciated.
      >>
      >Thanks, sck10
      >>
      >>
      ><!-- Grid: List of all the Services from the Textbox -->
      ><asp:GridVie w ID="gvSearchDat a" runat="server"
      > DataSourceID="d sSearchData"
      > DataKeyNames="H andle"
      > Width="100%">
      > <Columns>
      > <asp:BoundFie ld DataField="strF ullName"
      > Visible="true"
      > HeaderText="Nam e"
      > SortExpression= ""
      > HeaderStyle-Cssclass="BlkB"
      > HeaderStyle-VerticalAlign=" Bottom"
      > ItemStyle-HorizontalAlign ="left"
      > ItemStyle-Width="15%" />
      >>
      > <asp:CheckBoxFi eld DataField="IsAc tive"
      > Visible="true"
      > HeaderText="Act ive"
      > SortExpression= ""
      > HeaderStyle-Cssclass="BlkB"
      > HeaderStyle-VerticalAlign=" Bottom"
      > ItemStyle-HorizontalAlign ="center"
      > ItemStyle-Width="7%" />
      > </Columns>
      ></asp:GridView>
      >>
      >>
      >

      Comment

      Working...