Probelm For Runing This Code

Discussion in 'Software' started by farhad13841384, Aug 3, 2006.

  1. farhad13841384

    farhad13841384

    Joined:
    Aug 3, 2006
    Messages:
    1
    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)
    dopaging()
    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=shona200;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

    Try
    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
    theDataList.DataBind()
    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
    </script>

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

    <form runat="server">

    <font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><asp:label id="pageNumber" runat="server" /></font>
    <asp:DataList id="theDataList" runat="server">
    <ItemTemplate>
    <table border="0" cellpadding="0" cellspacing="0" width="500">
    <tr>
    <td width="140"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Company Name</strong>:</font></td>
    <td><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><%# DataBinder.Eval(Container.DataItem, "companyname") %></font></td>
    </tr>
    <tr>
    <td width="110"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Contact Name</strong>:</font></td>
    <td><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><A Href="detail.aspx?id=<%# DataBinder.Eval(Container.DataItem, "contactname") %> "> <%# DataBinder.Eval(Container.DataItem, "contactname") %></a></td>
    </tr>
    <tr>
    <td width="110"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Contact Title</strong>:</font></td>
    <td><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><%# DataBinder.Eval(Container.DataItem, "contacttitle") %></font></td>
    </tr>
    </table>
    </ItemTemplate>
    <separatortemplate>
    <hr color="#0099FF" />
    </separatortemplate>
    </asp:DataList>

    <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" />
    </form>
    </body>
    </html>


    -------------end paging.aspx file-----------
     
    farhad13841384, Aug 3, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Hodgson
    Replies:
    4
    Views:
    588
  2. tidbits@concentric.net

    Help. Can't get email or web pages after runing Ad-aware

    tidbits@concentric.net, Oct 20, 2003, in forum: Computer Support
    Replies:
    6
    Views:
    558
    °Mike°
    Oct 21, 2003
  3. lmasczko

    computer runing slow

    lmasczko, Oct 26, 2003, in forum: Computer Support
    Replies:
    2
    Views:
    616
    trout
    Oct 27, 2003
  4. shrikant.vm@gmail.com

    problem in updating kernel in HP proliant G380 server runing RHEL 4ES

    shrikant.vm@gmail.com, Nov 1, 2007, in forum: Computer Support
    Replies:
    2
    Views:
    1,251
  5. Giuen
    Replies:
    0
    Views:
    1,068
    Giuen
    Sep 12, 2008
Loading...

Share This Page