</asp:TemplateField>
                <asp:TemplateField HeaderText="System Manager" SortExpression="sysaccount">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("sysaccount") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("sysaccount") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Password" SortExpression="syspw">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("syspw") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("syspw") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Log" SortExpression="log">
                    <EditItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("log") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("log") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            BindGridView()
        End If
    End Sub
    Private Sub BindGridView()
        ' Code to retrieve records from database and fill it in a DataTable and Bind it to GridView
        Dim dt As DataTable = New DataTable()
        Dim conn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        Dim da As OleDbDataAdapter = New OleDbDataAdapter("SELECT * FROM Sysdep", conn)
        conn.Open()
        da.Fill(dt)
        da.Dispose()
        conn.Close()

        GridView1.DataSource = dt
        GridView1.DataBind()
    End Sub
Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
        Dim dtSortTable As DataTable = TryCast(GridView1.DataSource, DataTable)

        If dtSortTable IsNot Nothing Then
            Dim dvSortedView As New DataView(dtSortTable)
            dvSortedView.Sort = e.SortExpression + " " + getSortDirectionString(e.SortDirection)

            GridView1.DataSource = dvSortedView
            GridView1.DataBind()
            'BindGridView()
        End If
    End Sub
    Private Function getSortDirectionString(ByVal sortDireciton As SortDirection) As String
        Dim newSortDirection As String = [String].Empty
        If sortDireciton = SortDirection.Ascending Then
            newSortDirection = "ASC"
        Else
            newSortDirection = "DESC"
        End If

        Return newSortDirection
    End Function

This sorting is not working. How to fix? Thanks.

Recommended Answers

All 7 Replies

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            BindGridView()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            BindGridView()
End Sub

Thanks, it is working.

@nmges - I'm glad you got it working. Please mark this thread as solved if you have found an answer to your question and good luck!

@nmges - I'm glad you got it working. Please mark this thread as solved if you have found an answer to your question and good luck!

You know what one side was solved, but the edit, update, delete are not working, I got
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

How to solve it? Thanks.

You know what one side was solved, but the edit, update, delete are not working, I got
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

How to solve it? Thanks.

It is sorting working, but rest buttons got errors as above, someone knows how to fix it? Thanks.

It is sorting working, but rest buttons got errors as above, someone knows how to fix it? Thanks.

just want to post my code here, if someone really can help me to fix? I have either one is working, if sorting working, because I took off the code - "NOT ISPOSTBACK", but I will get the rest buttons error - as I mentioned on the above. If I don't mark out the "not ispostback",the rest buttons will work, but the sorting is not working.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'If Not IsPostBack Then
            BindGridView()
        'End If
    End Sub

Here is my original code:

Imports System.Data
Imports System.Data.OleDb
Partial Class SystemManager
Inherits System.Web.UI.Page
Dim con1 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'If Not IsPostBack Then
        BindGridView()
        'End If

    End Sub

Private Sub BindGridView()
' Code to retrieve records from database and fill it in a DataTable and Bind it to GridView
        Dim dt As DataTable = New DataTable()
        Dim conn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        Dim da As OleDbDataAdapter = New OleDbDataAdapter("SELECT * FROM Sysdep", conn)
        conn.Open()
        da.Fill(dt)
        da.Dispose()
        conn.Close()

        GridView1.DataSource = dt
        GridView1.DataBind()
    End Sub

Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
        GridView1.EditIndex = e.NewEditIndex
        BindGridView()
    End Sub

Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit
        GridView1.EditIndex = -1
        BindGridView()
    End Sub

Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
        GridView1.PageIndex = e.NewPageIndex
        BindGridView()
    End Sub

Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Dim sqlupdate As String

sqlupdate = "UPDATE sysdep SET sysaccount= @sysaccount, syspw= @syspw WHERE id= @id"

Dim cmd1 As New OleDbCommand(sqlupdate, con1)


cmd1.Parameters.Add(New OleDbParameter("@sysaccount", CType(GridView1.Rows(e.RowIndex).FindControl("TextBox1"), TextBox).Text.ToString()))
cmd1.Parameters.Add(New OleDbParameter("@syspw", CType(GridView1.Rows(e.RowIndex).FindControl("TextBox2"), TextBox).Text.ToString()))
cmd1.Parameters.Add(New OleDbParameter("@id", GridView1.DataKeys(e.RowIndex).Value.ToString()))



        Try
            con1.Open()
            cmd1.ExecuteNonQuery()
        Catch ex As OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As InvalidOperationException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        End Try

        con1.Close()


        GridView1.EditIndex = -1
        BindGridView()


    End Sub

Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting

        Dim sqldelete As String

sqldelete = "DELETE FROM sysdep WHERE id=" & GridView1.DataKeys(e.RowIndex).Value.ToString()

        Dim cmd2 As New OleDbCommand(sqldelete, con1)

        Try
            con1.Open()
            cmd2.ExecuteNonQuery()
        Catch ex As OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As InvalidOperationException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        End Try

        con1.Close()
        BindGridView()


    End Sub

Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
        Dim dtSortTable As DataTable = TryCast(GridView1.DataSource, DataTable)

        If dtSortTable IsNot Nothing Then
            Dim dvSortedView As New DataView(dtSortTable)
            dvSortedView.Sort = e.SortExp<B></B>ression + " " + getSortDirectionString(e.SortDirection)

            GridView1.DataSource = dvSortedView
            GridView1.DataBind()
        End If
    End Sub
    Private Function getSortDirectionString(ByVal sortDireciton As SortDirection) As String
        Dim newSortDirection As String = [String].Empty
        If sortDireciton = SortDirection.Ascending Then
            newSortDirection = "ASC"
        Else
            newSortDirection = "DESC"
        End If

        Return newSortDirection

    End Function
   
Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click

        Dim sqlinsert As String

        sqlinsert = "INSERT INTO sysdep (sysaccount,syspw)" & _
          "VALUES(@sysaccount, @syspw)"

        Dim cmd As New OleDbCommand(sqlinsert, con1)

        cmd.Parameters.Add(New OleDbParameter("@sysaccount", TextBox1.Text))
        cmd.Parameters.Add(New OleDbParameter("@syspw", TextBox2.Text))

        Try
            con1.Open()
            cmd.ExecuteNonQuery()
        Catch ex As OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As InvalidOperationException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        End Try
        con1.Close()

        BindGridView()

    End Sub

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
        TextBox1.Text = ""
        TextBox1.Focus()
        TextBox1.Text = ""
    End Sub
    Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
    End Sub

End Class

This is front:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
        BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
        DataKeyNames="id"  GridLines="Vertical" Width="739px"  >
        <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
        <Columns>
            <asp:TemplateField ShowHeader="False" HeaderText="Edit">
                <EditItemTemplate>
                    <asp:Button ID="Button1" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="Update" />
                    &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="Cancel" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Button ID="Button2" runat="server" CausesValidation="False" 
                        CommandName="Select" Text="Select" />
                     &nbsp;<asp:Button ID="Button1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="Edit" />
                   
                    &nbsp;<asp:Button ID="Button3" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure to Delete the record?')"/>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="id" InsertVisible="False" SortExp<B></B>ression="id" 
                Visible="False">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="System Manager" SortExp<B></B>ression="sysaccount">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("sysaccount") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("sysaccount") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Password" SortExp<B></B>ression="syspw">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("syspw") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("syspw") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Log/Time" SortExp<B></B>ression="log">
                <EditItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("log") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("log") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#DCDCDC" />
    </asp:GridView>
    <br />
    <asp:Label ID="Label2" runat="server" 
        style="font-family: Times New Roman; font-size: large; font-weight: 700" Text="System Manager"></asp:Label>
&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Label ID="Label3" runat="server" Text="Password"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
&nbsp;<br />
    <br />
    <br />
    <asp:Button ID="Button4" runat="server" 
        style="font-family: Time New Roman; font-size: large; font-weight: 700" Text="Add" />
&nbsp;<asp:Button ID="Button5" runat="server" 
        style="font-family: Time New Roman; font-size: large; font-weight: 700" Text="Cancel" />
&nbsp;<asp:Button ID="Button6" runat="server" 
        style="font-family: Time New Roman; font-size: large; font-weight: 700" Text="Save" />
    </form>

just want to post my code here, if someone really can help me to fix? I have either one is working, if sorting working, because I took off the code - "NOT ISPOSTBACK", but I will get the rest buttons error - as I mentioned on the above. If I don't mark out the "not ispostback",the rest buttons will work, but the sorting is not working.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'If Not IsPostBack Then
            BindGridView()
        'End If
    End Sub

Here is my original code:

Imports System.Data
Imports System.Data.OleDb
Partial Class SystemManager
Inherits System.Web.UI.Page
Dim con1 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'If Not IsPostBack Then
        BindGridView()
        'End If

    End Sub

Private Sub BindGridView()
' Code to retrieve records from database and fill it in a DataTable and Bind it to GridView
        Dim dt As DataTable = New DataTable()
        Dim conn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        Dim da As OleDbDataAdapter = New OleDbDataAdapter("SELECT * FROM Sysdep", conn)
        conn.Open()
        da.Fill(dt)
        da.Dispose()
        conn.Close()

        GridView1.DataSource = dt
        GridView1.DataBind()
    End Sub

Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
        GridView1.EditIndex = e.NewEditIndex
        BindGridView()
    End Sub

Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit
        GridView1.EditIndex = -1
        BindGridView()
    End Sub

Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
        GridView1.PageIndex = e.NewPageIndex
        BindGridView()
    End Sub

Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Dim sqlupdate As String

sqlupdate = "UPDATE sysdep SET sysaccount= @sysaccount, syspw= @syspw WHERE id= @id"

Dim cmd1 As New OleDbCommand(sqlupdate, con1)


cmd1.Parameters.Add(New OleDbParameter("@sysaccount", CType(GridView1.Rows(e.RowIndex).FindControl("TextBox1"), TextBox).Text.ToString()))
cmd1.Parameters.Add(New OleDbParameter("@syspw", CType(GridView1.Rows(e.RowIndex).FindControl("TextBox2"), TextBox).Text.ToString()))
cmd1.Parameters.Add(New OleDbParameter("@id", GridView1.DataKeys(e.RowIndex).Value.ToString()))



        Try
            con1.Open()
            cmd1.ExecuteNonQuery()
        Catch ex As OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As InvalidOperationException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        End Try

        con1.Close()


        GridView1.EditIndex = -1
        BindGridView()


    End Sub

Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting

        Dim sqldelete As String

sqldelete = "DELETE FROM sysdep WHERE id=" & GridView1.DataKeys(e.RowIndex).Value.ToString()

        Dim cmd2 As New OleDbCommand(sqldelete, con1)

        Try
            con1.Open()
            cmd2.ExecuteNonQuery()
        Catch ex As OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As InvalidOperationException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        End Try

        con1.Close()
        BindGridView()


    End Sub

Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
        Dim dtSortTable As DataTable = TryCast(GridView1.DataSource, DataTable)

        If dtSortTable IsNot Nothing Then
            Dim dvSortedView As New DataView(dtSortTable)
            dvSortedView.Sort = e.SortExpression + " " + getSortDirectionString(e.SortDirection)

            GridView1.DataSource = dvSortedView
            GridView1.DataBind()
        End If
    End Sub
    Private Function getSortDirectionString(ByVal sortDireciton As SortDirection) As String
        Dim newSortDirection As String = [String].Empty
        If sortDireciton = SortDirection.Ascending Then
            newSortDirection = "ASC"
        Else
            newSortDirection = "DESC"
        End If

        Return newSortDirection

    End Function
   
Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click

        Dim sqlinsert As String

        sqlinsert = "INSERT INTO sysdep (sysaccount,syspw)" & _
          "VALUES(@sysaccount, @syspw)"

        Dim cmd As New OleDbCommand(sqlinsert, con1)

        cmd.Parameters.Add(New OleDbParameter("@sysaccount", TextBox1.Text))
        cmd.Parameters.Add(New OleDbParameter("@syspw", TextBox2.Text))

        Try
            con1.Open()
            cmd.ExecuteNonQuery()
        Catch ex As OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As InvalidOperationException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Web")
        End Try
        con1.Close()

        BindGridView()

    End Sub

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
        TextBox1.Text = ""
        TextBox1.Focus()
        TextBox1.Text = ""
    End Sub
    Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
    End Sub

End Class

This is front:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
        BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
        DataKeyNames="id"  GridLines="Vertical" Width="739px"  >
        <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
        <Columns>
            <asp:TemplateField ShowHeader="False" HeaderText="Edit">
                <EditItemTemplate>
                    <asp:Button ID="Button1" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="Update" />
                    &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="Cancel" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Button ID="Button2" runat="server" CausesValidation="False" 
                        CommandName="Select" Text="Select" />
                     &nbsp;<asp:Button ID="Button1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="Edit" />
                   
                    &nbsp;<asp:Button ID="Button3" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure to Delete the record?')"/>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="id" InsertVisible="False" SortExp<B></B>ression="id" 
                Visible="False">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="System Manager" SortExpression="sysaccount">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("sysaccount") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("sysaccount") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Password" SortExpression="syspw">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("syspw") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("syspw") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Log/Time" SortExpression="log">
                <EditItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("log") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("log") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#DCDCDC" />
    </asp:GridView>
    <br />
    <asp:Label ID="Label2" runat="server" 
        style="font-family: Times New Roman; font-size: large; font-weight: 700" Text="System Manager"></asp:Label>
&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Label ID="Label3" runat="server" Text="Password"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
&nbsp;<br />
    <br />
    <br />
    <asp:Button ID="Button4" runat="server" 
        style="font-family: Time New Roman; font-size: large; font-weight: 700" Text="Add" />
&nbsp;<asp:Button ID="Button5" runat="server" 
        style="font-family: Time New Roman; font-size: large; font-weight: 700" Text="Cancel" />
&nbsp;<asp:Button ID="Button6" runat="server" 
        style="font-family: Time New Roman; font-size: large; font-weight: 700" Text="Save" />
    </form>

I just correct some errors on the previous post, IT STILL SAME - NOT WORKING, NEED HELP? Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.