Results 1 to 2 of 2

Thread: Retrieve data in a datagrid

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2002
    Posts
    80

    Question Retrieve data in a datagrid

    Does anyone know what property I can use to retrieve the value in a datagrid cell? Below I have a button column that has a "Select" link. When I click it I want to retrieve a value in one of the columns and assign it to a variable. Can someone help. Thanks

    James



    <aspataGrid id="lstResults" runat="server" Visible="False" PageSize="100" AutoGenerateColumns="False" Width="60%" HorizontalAlign="Center" CellPadding="0">
    <HeaderStyle Font-Bold="True" HorizontalAlign="Center"></HeaderStyle>
    <Columns>
    <asp:ButtonColumn Text="Select" CommandName="Select">
    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top"></HeaderStyle>
    <ItemStyle Wrap="False"></ItemStyle>
    </asp:ButtonColumn>
    <asp:BoundColumn DataField="twp" HeaderText="TWP">
    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="wbs" HeaderText="WBS">
    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="Resource" HeaderText="Resource">
    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="camname" HeaderText="CAM Name">
    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="boe" HeaderText="BOE Desc">
    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center" Wrap="True" VerticalAlign="Top"></ItemStyle>
    </asp:BoundColumn>
    </Columns>
    </aspataGrid>

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    e.item.cells(index).text

    You typically need to make the SELECT button spawn an EDIT command, though.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

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