0

how do i display the data for 1st page onwards? the allowpaging is set to true

this is the pageindexchanging code

Protected Sub solist_PageIndexChanging(ByVal sender As Object, _
           ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles solist.PageIndexChanging
        solist.PageIndex = e.NewPageIndex
        solist.DataBind()

    End Sub

this is the data code

Protected Sub solist_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles solist.RowCommand
        If e.CommandName = "SendEmail" Then
            Dim sendMail As New EmailModule
            Dim SO_No As String = e.CommandArgument.ToString()

            Dim dtTemp As New Data.DataTable
            Dim daTemp As New Data.SqlClient.SqlDataAdapter
            Dim cmd As New Data.SqlClient.SqlCommand
            cmd.Connection = New Data.SqlClient.SqlConnection(solist_SqlDataSource.ConnectionString)
            cmd.CommandText = "SELECT DISTINCT Master_Customer_PIC.CustPIC_Email FROM SO_Main, Master_Customer,Master_Customer_PIC WHERE SO_main.so_custid=master_customer.Cust_ID AND Master_Customer.Cust_ID=Master_Customer_Pic.CustPIC_CustID and SO_Main.SO_No=SO_No "
            Dim pic_email As String = ""
            cmd.Parameters.AddWithValue("CustPIC_Email", pic_email)
            daTemp.SelectCommand = cmd
            daTemp.Fill(dtTemp)

            Dim hfEmail As String = ""
            If dtTemp.Rows.Count = 1 Then
                hfEmail = dtTemp.Rows(0)("CustPIC_Email").ToString
            ElseIf dtTemp.Rows.Count > 1 Then
                For i As Integer = 0 To dtTemp.Rows.Count - 2
                    If i = 0 Then
                        hfEmail = dtTemp.Rows(i)("CustPIC_Email").ToString
                    Else
                        hfEmail &= "," & dtTemp.Rows(i)("CustPIC_Email").ToString
                    End If
                Next
                Response.Write("<script type='text/javascript'>alert('Email sent!');location='Outstanding.aspx'</script>")
            Else
                Response.Write("<script type='text/javascript'>alert('Invalid Request!');location='Outstanding.aspx'</script>")
            End If

            sendMail.send_email(hfEmail, "Your credit limit has exceeded. Please increase the credit limit or the SO cannot be process." & vbCrLf & "SO No: " & SO_No, "Infoline")


        ElseIf e.CommandName = "RejectSO" Then

            Dim SO_No As String = e.CommandArgument.ToString()

            Dim dtTemp As New Data.DataTable
            Dim daTemp As New Data.SqlClient.SqlDataAdapter
            Dim cmd As New Data.SqlClient.SqlCommand
            cmd.Connection = New Data.SqlClient.SqlConnection(solist_SqlDataSource.ConnectionString)



            cmd.CommandText = "UPDATE SO_Main SET SO_Status='REJECT' WHERE SO_No='" & SO_No & "' "

            If cmd.Connection.State = Data.ConnectionState.Closed Then
                cmd.Connection.Open()
            End If

            cmd.ExecuteNonQuery()

            If cmd.Connection.State = Data.ConnectionState.Open Then
                cmd.Connection.Close()
            End If

            Response.Write("<script type='text/javascript'>alert('SO has been rejected!');location='Outstanding.aspx'</script>")

        ElseIf e.CommandName = "ApproveSO" Then
            Dim SO_No As String = e.CommandArgument.ToString()

            Dim dtTemp As New Data.DataTable
            Dim daTemp As New Data.SqlClient.SqlDataAdapter
            Dim cmd As New Data.SqlClient.SqlCommand
            cmd.Connection = New Data.SqlClient.SqlConnection(solist_SqlDataSource.ConnectionString)

            cmd.CommandText = "UPDATE SO_Main SET SO_Status='APPROVE' WHERE SO_No='" & SO_No & "'"

            If cmd.Connection.State = Data.ConnectionState.Closed Then
                cmd.Connection.Open()
            End If

            cmd.ExecuteNonQuery()

            If cmd.Connection.State = Data.ConnectionState.Open Then
                cmd.Connection.Close()
            End If
            Response.Write("<script type='text/javascript'>alert('SO has been approved!');location='Outstanding.aspx'</script>")
        End If
    End Sub
2
Contributors
1
Reply
25
Views
4 Years
Discussion Span
Last Post by LastMitch
0

how do i display the data for 1st page onwards? the allowpaging is set to true

I'm not familiar with VB but the code you provided doesn't show any errors. What are you trying to do or displayed?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.