不包含针对的定义 [英] does not contain a definition for

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

问题描述

我有以下表单代码可以在运行时注册帐单,但始终会给我错误.....任何人都知道如何修复它???谢谢

错误4"ASP.view_profile_aspx"不包含"LinkBut​​ton1_Click"的定义,找不到扩展方法"LinkBut​​ton1_Click"接受类型为"ASP.view_profile_aspx"的第一个参数(是您是否缺少using指令或程序集引用?)C:\ work \ xxxx1 \ view_profile.aspx 16

I have following code for form to sign up for billing when i run it it keeps giving me the error ..........anyone know how to fix it??? thanks

Error 4 ''ASP.view_profile_aspx'' does not contain a definition for ''LinkButton1_Click'' and no extension method ''LinkButton1_Click'' accepting a first argument of type ''ASP.view_profile_aspx'' could be found (are you missing a using directive or an assembly reference?) C:\work\xxxx1\view_profile.aspx 16

<legend>Payment Information</legend>
                    <asp:LinkButton ID="LinkButton2" runat="server" Font-Underline="False" 

                        onclick="LinkButton2_Click1">Edit
        <br />
        <table style="width:100%;">
            <tr>
                <td class="style2">
      Payment Method
                </td>
                <td class="style1">
                    <asp:DropDownList ID="paymeent_method" runat="server" Visible="False">
                        <asp:ListItem>--Select--
                        <asp:ListItem>PayPal
                        <asp:ListItem>Credit Card
                        <asp:ListItem>
                    </td></tr></table>

推荐答案

因为您的后台代码不包含事件LinkButton1_Click.要解决此问题,请以该名称创建事件,或从HTML源代码中删除LinkButton1_Click.
检查后面的代码是否包含类似的方法(偶然地,您可能会被重命名)
Because your code-behind doesn''t contain the event LinkButton1_Click. To solve this issue create the event in that name or remove the LinkButton1_Click from your HTML source.
Check the code-behind if it contains any methods like that(Accidentally you might be renamed that)


它们可能是您遇到问题的两种可能性.

1)您的后台代码不包含LinkButton2_Click1事件的定义.

解决方案:在代码隐藏项中添加以下事件.
Their can be two possibilities of your problem.

1) Your code-behind does not contain definition of LinkButton2_Click1 Event.

Resolution: Add below event in you code-behind.
void LinkButton2_Click1(Object sender, EventArgs e)
{
  Label1.Text="You clicked the link button"
}



2)您的后台代码可能包含默认的事件定义,如下所示.
注意-不带" 1 ".



2) Your code-behind might contain default Event definition as below.
Note - without "1".

void LinkButton2_Click(Object sender, EventArgs e)
{

}



解决方案:请确保您的代码隐藏事件名称应与您在设计中指定的名称匹配. -onclick="LinkButton2_Click1"



Resolution: Make sure your code-behind Event name should match with the one which you specified in design. - onclick="LinkButton2_Click1"


这篇关于不包含针对的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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