<asp:DataGrid ID="dgResetPassword" DataKeyField="user_id" OnItemCommand="resetSelect" CellPadding="10" HeaderStyle-BorderStyle="none" AutoGenerateColumns="False" runat="server" ForeColor="#333333" GridLines="None" Width="550px">
<Columns>
<asp:ButtonColumn DataTextField="sap_id" HeaderText="SAP ID" />
<asp:BoundColumn DataField="lastname" HeaderText="Last Name" />
<asp:BoundColumn DataField="firstname" HeaderText="First Name"/>
<asp:BoundColumn DataField="username" HeaderText="User Name"/>
<asp:BoundColumn DataField="jobtitle" HeaderText="Job Title"/>
<asp:BoundColumn DataField="orgunit" HeaderText="Organization Unit"/>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditItemStyle BackColor="#999999" />
<SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<AlternatingItemStyle BackColor="White" ForeColor="#284775" />
<ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" BorderStyle="None" Font-Bold="True" ForeColor="White" />
</asp:DataGrid>
那是网格,这里是函数...
Sub resetSelect(ByVal s As Object, ByVal e As DataGridCommandEventArgs)
lblResponse.Text = [want to access text of username here]
lblResponse.Visible = True
lblID.Text = dgResetPassword.DataKeys.Item(e.Item.ItemIndex)
End Sub
如何为用户名引用所选项目的 DataField 文本?