locked
BC30456 error with VB.Net RRS feed

  • Question

  • Hi.

    i getting this error:

    Errormessage: BC30456: 'gridFileList_SelectedIndexChanged' is not a member of 'ASP.default_aspx'.

    Error:

    Linje 26: </Columns>
    Linje 27: </asp:GridView>
    Linje 28: <asp:GridView ID="gridFileList" runat="server" AutoGenerateColumns="False"
    Linje 29: OnSelectedIndexChanged="gridFileList_SelectedIndexChanged"
    Linje 30: GridLines="None" CellPadding="0" CellSpacing="1" DataKeyNames="FullName">


    its funny bc the name it point at, i have in my code_behind, but here is my code hope someone can help me out.
    its long time since i have played with VB.Net so cant remember all.....



    .:: Default.aspx ::.
    <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="DefaultVB" title="Untitled Page" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <asp:GridView ID="gridDirList" runat="server" AutoGenerateColumns="False"
    OnSelectedIndexChanged="gridDirList_SelectedIndexChanged"
    GridLines="None" CellPadding="0" CellSpacing="1"
    DataKeyNames="FullName">
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <img alt="" src="folder.jpg" originalAttribute="src" originalPath="folder.jpg" />
    </ItemTemplate>
    </asp:TemplateField>
    <asp:ButtonField DataTextField="Name" CommandName="Select"
    HeaderText="Name" />
    <asp:BoundField HeaderText="Size" />
    <asp:BoundField DataField="LastWriteTime" HeaderText="Last Modified" />
    </Columns>
    </asp:GridView>
    <asp:GridView ID="gridFileList" runat="server" AutoGenerateColumns="False"
    OnSelectedIndexChanged="gridFileList_SelectedIndexChanged"
    GridLines="None" CellPadding="0" CellSpacing="1" DataKeyNames="FullName">
    <SelectedRowStyle BackColor="#C0FFFF" />
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <img alt="" src="file.jpg" originalAttribute="src" originalPath="file.jpg" />
    </ItemTemplate>
    </asp:TemplateField>
    <asp:ButtonField DataTextField="Name" CommandName="Select" />
    <asp:BoundField DataField="Length" />
    <asp:BoundField DataField="LastWriteTime" />
    </Columns>
    </asp:GridView>
        </div>
        </form>
    </body>
    </html>

    .:: Default.aspx.vb ::.
    Imports System
    Imports System.Collections
    Imports System.ComponentModel
    Imports System.Data
    Imports System.Drawing
    Imports System.IO
    Imports System.Net
    Imports System.Web.Mail
    Imports System.Web
    Imports System.Web.SessionState
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.Web.UI.HtmlControls
    Imports System.Data.OleDb
    Imports System.Configuration
    Imports Microsoft.VisualBasic

    Partial Public Class DefaultVB
        Inherits System.Web.UI.Page

        Private Sub ShowDirectoryContents(ByVal strPath As String)
            ' Define the current directory.
            Dim dir As New DirectoryInfo(Path)
            ' Get the DirectoryInfo and FileInfo objects.
            Dim files As FileInfo() = dir.GetFiles()
            Dim dirs As DirectoryInfo() = dir.GetDirectories()
            ' Show the directory listing.
            lblCurrentDir.Text = "Currently showing " & Path
            gridFileList.DataSource = files
            gridDirList.DataSource = dirs
            Page.DataBind()
            ' Clear any selection.
            gridFileList.SelectedIndex = -1
            ' Keep track of the current path.
            ViewState("CurrentPath") = Path
        End Sub

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If (Not Page.IsPostBack) Then
                ShowDirectoryContents(Server.MapPath("."))
            End If
        End Sub

        Protected Sub cmdUp_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim strPath As String = CStr(ViewState("CurrentPath"))
            strPath = Path.Combine(strPath, "..")
            strPath = Path.GetFullPath(strPath)
            ShowDirectoryContents(strPath)
        End Sub

        Protected Sub gridDirList_SelectedIndexChanged(ByVal source As Object, ByVal e As EventArgs)
            ' Get the selected directory.
            Dim dir As String = CStr(gridDirList.DataKeys(gridDirList.SelectedIndex).Value)
            ' Now refresh the directory list to
            ' show the selected directory.
            ShowDirectoryContents(dir)
        End Sub
    End Class
    • Moved by nobugz Friday, September 26, 2008 11:14 AM forums.asp.net (Moved from Common Language Runtime to Off-Topic Posts (Do Not Post Here))
    Friday, September 26, 2008 8:57 AM

Answers