Try setting a breakpoint within the grdPOs_RowEditing method and see if it is
invoked.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Michael" wrote:
> Actually, I'm using a dataset to work with the screen. I have setup two
> columns to handle the Delete and Edit functions for the grid:
> <asp:CommandField ShowEditButton="True" />
> <asp:ButtonField CommandName="Delete" Text="Delete" />
>
> Here is the code for the class(Code-Behind) minus a few saving functions to
> save some space. Here is the code:
> Imports System.Data
> imports System.Data.SqlClient
>
>
> Partial Class EnterPOrder
> Inherits System.Web.UI.Page
>
> Private NetCon as SqlConnection
> Private dsPO as New DataSet
> Private dsPrograms as New DataSet
>
>
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
> Handles Me.Load
> if not IsPostBack then
> BindData()
> End If
> End Sub
>
>
> Private Sub BindData()
> Dim mCommand As SqlCommand
> Dim cnSQL as SqlConnection
> Dim da as new SqlDataAdapter
> try
> cnSQL = OpenConnection()
> mCommand = New SqlCommand
> mCommand.CommandType = CommandType.StoredProcedure
> mCommand.Connection = cnSQL
> mCommand.CommandText = "Admin_GetPurchaseOrders"
> da.SelectCommand = mCommand
> da.Fill(dsPO, "POS")
> grdPOs.DataSource = dsPO.Tables("POS")
> grdPOs.DataBind
> cnSQL.Close
> 'SqlDataPOs.DataBind
>
> 'Setup the Programs Listbox.
> cnSQL = OpenConnection()
> mCommand = New SqlCommand
> mCommand.CommandType = CommandType.StoredProcedure
> mCommand.Connection = cnSQL
> mCommand.CommandText = "Admin_GetPrograms"
> da.SelectCommand = mCommand
> da.Fill(dsPrograms, "Programs")
> cmbPrograms.DataSource = dsPrograms.Tables("Programs")
> cmbPrograms.DataTextField = "ProgramName"
> cmbPrograms.DataValueField = "ProgramId"
> cmbPrograms.DataBind
> Catch ex As Exception
> msgbox(ex.Message )
> Finally
> cnSQL.Dispose
> mCommand.Dispose
> da.Dispose
> End Try
>
> End Sub
>
> Private Function OpenConnection() as SqlConnection
> try
> NetCon = New SqlConnection
> With NetCon
> .ConnectionString = "packet size=4096;integrated security=SSPI;data
> source=Backupsvr\bkupexec;persist security info=False;initial
> catalog=PurchaseOrders"
> .Open()
> End With
> return NetCon
> Catch ex As Exception
> msgbox(ex.Message )
> return nothing
> End Try
> End Function
>
>
> Protected Sub grdPOs_RowEditing(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.GridViewEditEventArgs) Handles grdPOs.RowEditing
> grdPOs.EditIndex = e.NewEditIndex
> DataBind()
> End Sub
>
> Protected Sub grdPOs_RowCancelingEdit(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.GridViewCancelEditEventA rgs) Handles
> grdPOs.RowCancelingEdit
> grdPOs.EditIndex = -1
> DataBind()
> End Sub
>
> Protected Sub grdPOs_RowUpdating(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdPOs.RowUpdating
> Dim POid as Integer
> Dim CatalogId as string, Description as string
> Dim Qty as Integer , UnitPrice as Double , Page as Integer
> Dim mCommand As SqlCommand
> Dim cnSQL as SqlConnection
> Dim records(e.NewValues.Count - 1) As DictionaryEntry
> Dim entry As DictionaryEntry
> Dim DataKeyId as DataKey
> try
> 'Copy the new values into the fields
> e.NewValues.CopyTo(records, 0)
> For Each entry In records
>
> e.NewValues(entry.Key) = Server.HtmlEncode(entry.Value.ToString())
>
> Next
> DataKeyId = grdPOs.DataKeys(e.RowIndex )
> 'IntId = DataKeyId.Values("ItemId")
>
> POid = DataKeyId("ItemId") 'grdPOs.DataKeys(e.RowIndex).Value
> CatalogId = DataKeyId("CatalogId").ToString
> 'e.NewValues.Item(1).ToString
> Description = DataKeyId("ItemDescription").ToString
> 'CType(e.Item.Cells(2).Controls(0), TextBox).Text
> Qty = DataKeyId("Qty") 'CType(e.Item.Cells(3).Controls(0),
> TextBox).Text
> UnitPrice = DataKeyId("UnitPrice")
> 'CType(e.Item.Cells(4).Controls(0), TextBox).Text
> Page = DataKeyId("Page") 'CType(e.Item.Cells(6).Controls(0),
> TextBox).Text
> cnSQL = OpenConnection()
> mCommand = New SqlCommand
> mCommand.CommandType = CommandType.StoredProcedure
> mCommand.Connection = cnSQL
> mCommand.CommandText = "Admin_UpdatePOItem"
> mCommand.Parameters.add("@ItemID", SqlDbType.Int ).Value = POid
> mCommand.Parameters.add("@CatalogeId", SqlDbType.Int ).Value = CatalogId
> mCommand.Parameters.add("@ItemDescription", SqlDbType.VarChar ,250).Value =
> Description
> mCommand.Parameters.add("@Qty", SqlDbType.Int).Value = Qty
> mCommand.Parameters.add("@UnitPrice", SqlDbType.Money ).Value = UnitPrice
> mCommand.Parameters.add("@Page", SqlDbType.int).Direction = Page
> mCommand.ExecuteNonQuery
> grdPOs.EditIndex = -1
> BindData()
> Catch ex As Exception
> msgbox(ex.Message )
> End Try
> End Sub
>
>
> Protected Sub grdPOs_RowDataBound(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdPOs.RowDataBound
> If e.Row.RowType =DataControlRowType.DataRow then
> e.Row.Cells(5).Text = format(convert.ToInt16(e.Row.Cells(3).Text) *
> convert.ToDouble(e.row.Cells(4).Text), "0.00")
> end if
> End Sub
> End Class
>
> Does this help any.
> Thanks again for the reply.
> Michael
>
>
> "Christopher Reed" wrote:
>
> > Where is RowEditing being invoked in your GridView declarative statement?
> > Plus, where's the data source?
> > --
> > Christopher A. Reed
> > "The oxen are slow, but the earth is patient."
> >
>