有什么原因会出现这种情况呢?

解决方案 »

  1.   

    以前听人说过什么pushButton,不过应该是事件丢失吧。
      

  2.   

    <asp:datagrid id="MasterDataGrid" runat="server" BackColor="White" Font-Size="XX-Small" Width="760px"
    Font-Names="Arial" BorderStyle="Double" BorderWidth="3px" BorderColor="#336666" EnableViewState="False" AllowSorting="True"
    CellPadding="4" AutoGenerateColumns="False" DataKeyField="SHIP_NOXX">
    <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#339966"></SelectedItemStyle>
    <ItemStyle ForeColor="#333333" BackColor="White"></ItemStyle>
    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="White" BackColor="#336666"></HeaderStyle>
    <FooterStyle ForeColor="#333333" BackColor="White"></FooterStyle>
    <Columns>
    <asp:BoundColumn DataField="SHIP_INDX" HeaderText="Index"></asp:BoundColumn>
    <asp:BoundColumn DataField="RELE_CODE" HeaderText="Release"></asp:BoundColumn>
    <asp:BoundColumn DataField="ORDR_QNTY" HeaderText="Sched Qty"></asp:BoundColumn>
    <asp:BoundColumn DataField="ORDR_DATE" HeaderText="Sched Date"></asp:BoundColumn>
    <asp:BoundColumn DataField="ORDR_MODE" HeaderText="Sched Method"></asp:BoundColumn>
    <asp:BoundColumn DataField="SHIP_DATE" HeaderText="Shpd Qty"></asp:BoundColumn>
    <asp:BoundColumn DataField="SHIP_DATE" HeaderText="Shpd Date"></asp:BoundColumn>
    <asp:BoundColumn DataField="SHIP_MODE" HeaderText="Shpd Method"></asp:BoundColumn>
    <asp:BoundColumn DataField="INVO_NOXX" HeaderText="Invoice#"></asp:BoundColumn>
    <asp:BoundColumn DataField="ITED_REMK" HeaderText="Re"></asp:BoundColumn>
    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit">
    <HeaderStyle Width="60px"></HeaderStyle>
    </asp:EditCommandColumn>
    </Columns>
    <PagerStyle NextPageText="Next&amp;gt;" PrevPageText="&amp;lt;Prev" HorizontalAlign="Center"
    ForeColor="White" BackColor="#336666" Mode="NumericPages"></PagerStyle>
    </asp:datagrid>
      

  3.   

    Private Sub MasterDataGrid_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles MasterDataGrid.ItemCommand
            Dim Sqlstring As String        If e.CommandName.ToString = "Update" Or e.CommandName.ToString = "Split" Then
                If CheckInsert.Text = "T" Then                Sqlstring = "INSERT INTO AV_ITED (SHIP_INDX,ITEM_NOXX,RELE_CODE,ORDR_QNTY,ORDR_DATE,ORDR_MODE,SHIP_QNTY,SHIP_DATE,SHIP_MODE,INVO_NOXX,ITED_REMK,WORK_USER,UPDT_DATE) VALUES"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(0).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & " VALUES ('" & GetNoxx("SELECT ISNULL(Max(SHIP_NOXX),'00000') As Val FROM AV_ITED Where SHIP_NOXX LIKE", Now()) & "','"
                    Sqlstring = Sqlstring & Item_no & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(1).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(2).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(3).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(4).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(5).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(6).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(7).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(8).Controls(0), TextBox).Text & "','"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(9).Controls(0), TextBox).Text & "','YANG',Getdate())"            Else
                    Sqlstring = "UPDATE AV_ITED set SHIP_INDX='"
                    Sqlstring = Sqlstring & CType(e.Item.Cells(0).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "RELE_CODE='" & CType(e.Item.Cells(1).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "ORDR_QNTY='" & CType(e.Item.Cells(2).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "ORDR_DATE='" & CType(e.Item.Cells(3).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "ORDR_MODE='" & CType(e.Item.Cells(4).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "SHIP_QNTY='" & CType(e.Item.Cells(5).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "SHIP_DATE='" & CType(e.Item.Cells(6).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "SHIP_MODE='" & CType(e.Item.Cells(10).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "INVO_NOXX='" & CType(e.Item.Cells(11).Controls(0), TextBox).Text & "',"
                    Sqlstring = Sqlstring & "ITED_REMK='" & CType(e.Item.Cells(12).Controls(0), TextBox).Text & "'"
                    Sqlstring = Sqlstring & "WHERE SHIP_NOXX='" & MasterDataGrid.DataKeys(CInt(e.Item.ItemIndex)) & "'"            End If            If ExecSqlCommand(Sqlstring) Then
                    Response.Write("<Script>window.alert('Successfull saved.')</Script>")
                Else
                    Response.Write("<Script>window.alert( 'Save failed.')</Script>")
                End If        End If        MasterDataGrid.EditItemIndex = -1
            DataGridBind("")
        End Sub
      

  4.   

    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit">已经是LinkButton
    我如果按Update 时,得到的值还是Edit,这是为什么?
      

  5.   

    请关注:http://community.csdn.net/Expert/topic/4340/4340026.xml?temp=.1422846
      

  6.   

    是IsPostBack的问题吗?那里面该写什么?
      

  7.   

    if (!IsPostBack) 
    {
       DataBind();
    }
      

  8.   

    我如果按Update 时,得到的值还是Edit,这是为什么?是不是沒有將editindex設為-1
      

  9.   

    换成模板列,将CommandName设为edit,(小写)
    执行MasterDataGrid_UpdateCommand事件