textchange方法出错 [英] error on textchange method

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

问题描述

这是子页面

This is the child page

<asp:TextBox ID="TextBox1" runat="server" BackColor="Bisque" Width="125"

                OnTextChanged="fun()"></asp:TextBox>





<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript" language="javascript">
        function fun()
       {
       alert('imran')
       }
        </script>
    <div id=" " style="height: 886px">




错误是




error is

CS1061: 'ASP.addcategory_aspx' does not contain a definition for 'fun' and no extension method 'fun' accepting a first argument of type 'ASP.addcategory_aspx' could be found (are you missing a using directive or an assembly reference?)

推荐答案

应用onchange="fun()"而不是OnTextChanged="fun()"
阅读以下TextBox.OnTextChanged方法的链接
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.ontextchanged.aspx [
Apply onchange="fun()" instead of OnTextChanged="fun()"
Read the following link for TextBox.OnTextChanged Method
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.ontextchanged.aspx[^]


删除fun()方法中的"this",因为该方法不包含任何参数.或反之亦然

Remove ''this'' inside fun() method because the method does not contain any parameter. or do vice versa

<asp:TextBox ID="TextBox1" runat="server" BackColor="Bisque" Width="125" onchange="javascript:fun()">



如果这解决了您的问题,请标记为答案并投票5

问候,
Eduard



Please mark as answer and vote 5 if this solved your problem

Regards,
Eduard


以有趣的方式删除此内容(this)
也不需要将其删除

Remove this in fun(this)
void is also not required remove it

报价:

< asp:textbox id ="TextBox1" runat ="server" backcolor ="Bisque" width ="125" xmlns:asp =#unknown" OnTextChanged ="fun()">

<asp:textbox id="TextBox1" runat="server" backcolor="Bisque" width="125" xmlns:asp="#unknown" OnTextChanged="fun()">


这篇关于textchange方法出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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