Question Getting data from a boundfield

knee_boarder

Member
Joined
Oct 5, 2009
Messages
5
Location
United Kingdom
Programming Experience
5-10
I have a gridview:

VB.NET:
asp:GridView id="gvMyServicesSummary" runat="server"
            DataSourceID="srcMyServiceRequests"
            AllowPaging="true"
            PageSize="20"
            AllowSorting="true"
            AutoGenerateColumns="False"
            GridLines="None"
            CssClass="gvTable">
            
            <AlternatingRowStyle CssClass="gvAltRow" />
            <HeaderStyle CssClass="gvHeader" />
            <RowStyle CssClass="gvRow" />
            <PagerStyle CssClass="gvPager" />
              
            <Columns>
                <asp:BoundField DataField="PostType" SortExpression="PostType" ReadOnly="True" HeaderText="Type" Visible="true" />
                <asp:BoundField DataField="PostedDate" SortExpression="PostedDate"  DataFormatString="{0:dd/MM/yyyy  hh:mm:ss}" HtmlEncode="false" ReadOnly="True" HeaderText="Received" Visible="true" />
                <asp:BoundField DataField="CompletionDate" SortExpression="CompletionDate"  DataFormatString="{0:dd/MM/yyyy  hh:mm:ss}" HtmlEncode="false" ReadOnly="True" HeaderText="Completion Date" Visible="true" />
                <asp:BoundField DataField="CompletionName" SortExpression="CompletionName" ReadOnly="True" HeaderText="By" Visible="true" />
                <asp:BoundField DataField="OfficerComments" HeaderStyle-Width="200" SortExpression="OfficerComments" ReadOnly="True" HeaderText="Comments" Visible="true" />
                <asp:BoundField DataField="strDescription" HeaderStyle-Width="100" SortExpression="strDescription" ReadOnly="True" HeaderText="Status" Visible="true" />
                <asp:HyperLinkField DataNavigateUrlFields="pkServiceID" DataNavigateUrlFormatString="{0}" HeaderText="" Text="Detail" />
            </Columns>
            
        </asp:GridView>

I can access the value in the HyperLinkField using
VB.NET:
Dim lnkTotal As HyperLink = e.Row.Cells(6).Controls(0)
and I'd like to access the the data held in PostType field.

It's someone else's code I'm having to tweak so I don't want to rewrite things very much!
 
Back
Top