我有多视图问题 [英] Multi View Problem that I Have

查看:44
本文介绍了我有多视图问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下MultiView编码

 <   >  
< tr >
< td >
< asp:按钮 ID = bt1 runat = server 文本 = 选项卡1 BorderStyle < span class =code-keyword> = CssClass = 初始 OnClick = bt1_Click / >
< asp:按钮 < span class =code-attribute> ID = bt2 runat = server 正文 = 标签2 BorderStyle = CssClass = 初始 OnClick = bt2_Click / < span class =code-keyword>>
< asp:MultiView ID = mainView runat = server >
< asp:查看 ID = View1 runat = server >
< 样式 = width:100%; border-width:1px; border-color:#666; border-style:solid >
< tr > < td >
< h3 > < span > 查看1 < / span > < / h3 >
< / TD <温泉n class =code-keyword>> < / tr >
< / table < span class =code-keyword>>
< / asp:View >
< asp :查看 ID = View2 runat = 服务器 >
< ; table style < span class =code-keyword> = width:100%; border-width:1px; border-color:#666; border-style:solid >
< tr > < td > < h3 > < span > 查看2 < / span > < / h3 >
< / td > < / tr >
< span class =code-keyword>< / table >
< / asp:查看 >
< / asp:MultiView > ; < / td > < / tr > < / table >



和c#编码是

protected void Page_Load( object sender,EventArgs e)
{
if (!IsPostBack)
{
bt1.CssClass = 点击;
mainView.ActiveViewIndex = 0 ;
}
}
受保护 void bt1_Click( object sender,EventArgs e)
{
bt1.CssClass = 被点击;
bt1.CssClass = Initial;
bt3.CssClass = Initial;
mainView.ActiveViewIndex = 0 ; }
protected void bt2_Click( object sender,EventArgs e)
{
bt1.CssClass = Initial;
bt2.CssClass = 点击;
bt3.CssClass = Initial;
mainView.ActiveViewIndex = 1 ;
}



当我运行项目它给我的错误是(编译器错误消息:CS1061:'ASP.pages_default_aspx'不包含定义'bt1_Click'并没有扩展方法'bt1_Click'接受类型'ASP.pages_default_aspx'的第一个参数可以找到(你是否缺少using指令或汇编引用?)

解决方案

听起来你的代码所在的aspx页面没有继承你发布的代码绑定页面。这可能是因为Inherits标签是错误的,或者你的代码中有些东西没有告诉我们这样因为你正在使用母版页,控件在主页上,而代码在客户页面上,反之亦然。


i have the following MultiView coding

<table>
               <tr>
                   <td>
                       <asp:Button ID="bt1" runat="server" Text="Tab 1" BorderStyle="None" CssClass="Initial" OnClick="bt1_Click" />
                       <asp:Button ID="bt2" runat="server" Text="Tab 2" BorderStyle="None" CssClass="Initial" OnClick="bt2_Click" />
                       <asp:MultiView ID="mainView" runat="server">
                           <asp:View ID="View1" runat="server">
                               <table style="width: 100%; border-width: 1px; border-color: #666; border-style: solid">
                                   <tr><td>
                                       <h3><span>View 1 </span></h3>
                                     </td></tr>
                               </table>
                           </asp:View>
                           <asp:View ID="View2" runat="server">
                               <table style="width: 100%; border-width: 1px; border-color: #666; border-style: solid">
                                   <tr><td><h3><span>View 2 </span></h3>
                                     </td></tr>
                               </table>
                           </asp:View>
                       </asp:MultiView></td></tr></table>


and c# coding is

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bt1.CssClass = "Clicked";
                mainView.ActiveViewIndex = 0;                
            }
        }
protected void bt1_Click(object sender, EventArgs e)
        {
            bt1.CssClass = "Clicked";
            bt1.CssClass = "Initial";
            bt3.CssClass = "Initial";
            mainView.ActiveViewIndex = 0;        }
        protected void bt2_Click(object sender, EventArgs e)
        {
            bt1.CssClass = "Initial";
            bt2.CssClass = "Clicked";
            bt3.CssClass = "Initial";
            mainView.ActiveViewIndex = 1;
        }


when i run the project it give me the error which are (Compiler Error Message: CS1061: 'ASP.pages_default_aspx' does not contain a definition for 'bt1_Click' and no extension method 'bt1_Click' accepting a first argument of type 'ASP.pages_default_aspx' could be found (are you missing a using directive or an assembly reference?)

解决方案

It sounds like the aspx page your code is on does not inherit the code-bind page you have posted. This could be because the Inherits tag is wrong, or there is something about your code you haven't told us such as you're using master pages and the control is on a master page and the code on the client page or vice versa.


这篇关于我有多视图问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆