Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 3rd, 2006, 01:37 AM
Registered User
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to farhad13841384
Default Probelm For Runing This Code

Hi to all.
i have some problem with this code.please if you know help me immediatly.

-----code paging8.vb begin--------
Imports System
Imports System.IO
Imports System.Data
Imports System.Data.SQLClient
Imports System.Web.HttpException
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.Webcontrols
Imports System.Xml
Imports System.Data.DataTable
Imports System.collections
Imports system.configuration
Imports System.Datetime
Imports system.Web.Caching
Imports System.Data.SqlClient.SqlDataAdapter
Imports Microsoft.VisualBasic

Namespace myclass1

public class myfunction2 : inherits page

    Public Sub New()

    End Sub

public sub page_load(sender as object,e as eventargs)
end sub

public btnPrev AS LinkButton
public btnNext AS LinkButton
public pagedData As New pagedDataSource
public DS As New DataSet()
public strConnect As New SQLConnection("server=localhost;uid=sa;pwd=shona20 0;Database=northwind")
public objSQLAdapter As New SQLDataAdapter("SELECT companyname , contactname , contacttitle FROM customers ", strConnect)
public pageNumber AS Label
public theDataList AS DataList

    public function getTheData() As DataTable

        objSQLAdapter.Fill(DS, "customers")

        Return DS.Tables("customers").Copy
    End function

    public Sub doPaging()
        pagedData.DataSource = getTheData().DefaultView
        pagedData.AllowPaging = True
        pagedData.PageSize = 5

            pagedData.CurrentPageIndex = Int32.Parse(Request.QueryString("Page")).ToString( )
        Catch ex As Exception
            pagedData.CurrentPageIndex = 0
        End Try

        btnPrev.Visible = ( NOT pagedData.IsFirstPage )
        btnNext.Visible = ( NOT pagedData.IsLastPage )

        pageNumber.Text = (pagedData.CurrentPageIndex + 1) & " of " & pagedData.PageCount

        theDataList.DataSource = pagedData
    End Sub

    public Sub Prev_Click(ByVal obj As Object, ByVal e As EventArgs)
        Response.Redirect(Request.CurrentExecutionFilePath & "?Page=" & (pagedData.CurrentPageIndex - 1))
    End Sub

    public Sub Next_Click(ByVal obj As Object, ByVal e As EventArgs)
        Response.Redirect(Request.CurrentExecutionFilePath & "?Page=" & (pagedData.CurrentPageIndex + 1))
    End Sub

End Class
End Namespace

----------end code-------------

I compile above code with asp.net 2 vbc.exe --> (vbc.exe /t:library /r:system.dll,system.data.dll,system.web.dll,system .xml.dll /out:bin/paging8.dll paging8.vb)
and everything is ok without any error and .dll create in /bin folder.
but when i call paging.aspx file in my browser then I give error

BC30456: 'Prev_Click' is not a member of 'ASP._2paging_aspx'.

Line 41: <asp:LinkButton id="btnPrev" Text="&lt; Previous Page" OnClick="Prev_Click" runat="server" />

how Can I resolve this problem ??? thanks a lot.this 2 file(paging.aspx and paging8.vb work without any problem , but when I compile .vb code and call paging.aspx in my browser error occured !)
I used winxp with asp.net 2 and sql2000

------------begin paging.aspx file--------------
<%@ Import Namespace="myclass1" %>
<%@ Page Explicit="True" %>

<Script runat="server">

' this is comment

<title>Paging with ASP.NET - DataSet Example - VB.NET</title>

<form runat="server">

<asp:label id="pageNumber" runat="server" />
<asp:DataList id="theDataList" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="500">
                    <td width="140"><strong>Company Name</strong>:</td>
                <td><%# DataBinder.Eval(Container.DataItem, "companyname") %></td>
                <td width="110"><strong>Contact Name</strong>:</td>
                <td><A Href="detail.aspx?id=<%# DataBinder.Eval(Container.DataItem, "contactname") %> "> <%# DataBinder.Eval(Container.DataItem, "contactname") %></a></td>
        <td width="110"><strong>Contact Title</strong>:</td>
         <td><%# DataBinder.Eval(Container.DataItem, "contacttitle") %></td>


        <asp:LinkButton id="btnPrev" Text="&lt; Previous Page" OnClick="Prev_Click" runat="server" />
        <asp:LinkButton id="btnNext" Text="Next Page &gt; " OnClick="Next_Click" runat="server" />

-------------end paging.aspx file-----------

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems runing a access project fbezede Access VBA 0 August 4th, 2006 03:24 PM
Application still runing even after Ending it PakXoxer Pro VB 6 4 March 9th, 2005 02:10 AM
error when runing application issam BOOK: ASP.NET Website Programming Problem-Design-Solution 6 December 22nd, 2004 04:45 PM
Runing Unix Job from VB.NET CTS General .NET 1 July 21st, 2004 08:20 AM
runing my app. melvik General .NET 10 May 12th, 2004 12:01 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.