Getting data value in GridView.RowDeleting


D

David C

I am trying to get the DataKey value from the GridView during a RowDeleting
event but I am getting nothing returned in my strid variable. Below is part
of my code if someone can help. Thanks.
-David

Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeleteEventArgs)
Dim strSQL As String = ""
Dim strText As String = ""
Dim row As GridViewRow = GridView1.Rows(e.RowIndex)

Dim strid As String = Convert.ToString(DataBinder.Eval(row.DataItem,
"AssigneeID"))

End Sub

Below is first part of my GridView


<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" BackColor="White"
BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
CellPadding="4" DataKeyNames="AssigneeID"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no Assignee records to display."
AllowSorting="true"
onrowdeleting="GridView1_RowDeleting">
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<Columns>
<asp:CommandField ShowEditButton="True" >
<ItemStyle Width="70px" />
</asp:CommandField>
<asp:BoundField DataField="AssigneeID" HeaderText="ID"
ReadOnly="True" SortExpression="FileTypeID" Visible="False" />
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top