Getting data value in GridView.RowDeleting

Discussion in 'ASP .Net' started by David C, Jan 9, 2009.

  1. David C

    David C Guest

    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" />
     
    David C, Jan 9, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. keithb
    Replies:
    1
    Views:
    4,330
    PeterKellner
    Jun 10, 2006
  2. Replies:
    0
    Views:
    1,265
  3. jobs
    Replies:
    0
    Views:
    1,511
  4. Bart

    problem with Rowdeleting event

    Bart, Jan 31, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    505
  5. Marianne

    GridView rowdeleting - e.Values.Count = 0??

    Marianne, Apr 17, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    2,347
    matt_c
    May 11, 2007
Loading...

Share This Page