注册 登录
编程论坛 ASP技术论坛

CS1061: “ASP.controlcache_aspx”不包含“SqlDataSource_Selected”的定义,

宸虞熙 发布于 2012-11-01 08:45, 1488 次点击
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ControlCache.aspx.cs" Inherits="ControlCache" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.

<html xmlns="http://www.
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    <asp:Literal ID="Literal1" runat="server"></asp:Literal>
    <asp:Literal ID="Literal2" runat="server"></asp:Literal>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        DataSourceID="SqlDataSource2">
        <Columns>
            <asp:BoundField DataField="username" HeaderText="username"
                SortExpression="username" />
            <asp:BoundField DataField="password" HeaderText="password"
                SortExpression="password" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
        ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString2 %>"
        SelectCommand="SELECT * FROM [Location]"
        CacheDuration="10"
        EnableCaching="true"
        OnSelecting="SqlDataSource2_Selecting"
        >
        </asp:SqlDataSource>
    </form>
</body>
</html>
1 回复
#2
yms1232012-11-02 14:39
某个变量未定义,另外LZ贴的是网页代码,不是出错的代码
ControlCache.aspx.cs
出错的代码在这个里面
1