开发者

ontextchanged event problem

Does anyone know what is here wrong? Something with ontextchanged which i do not understand

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

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

<asp:TemplateField HeaderText="Dinamična vsebina">
    <ItemTemplate>
        <asp:TextBox ID="txtDynamicValue" runat="server" 
            Text='<%#Eval("DynamicValue")%>' AutoPostBack="True" 
            ontextchanged="txtDynamicValue_TextChanged"></asp:TextBox>
开发者_StackOverflow中文版    </ItemTemplate>
</asp:TemplateField>

CODE BEHIND:

protected void txtDynamicValue_TextChanged(object sender, EventArgs e)
{
    /*TextBox txt = (TextBox)sender;
    RulesManagerPresenter.OnDynamicValueChanged(txt.Text, GetTagName(txt.NamingContainer), QueryStringRuleGroup);

    presenter.OnLoadTagsAndValues4Presentation(ConnectionString);*/
}

EDIT:

solved. VS 2010 problem. Changing debug from x86 to any CPU solve my problem if anyone else has this problems...


Does your event handler need to be public?


According to the documentation, the handler has only one argument which is the EventArgs.

So, change the function signature to:

protected void txtDynamicValue_TextChanged(EventArgs e)


try putting <% and %> around the code like so:

   <asp:TemplateField HeaderText="Dinamična vsebina">
        <ItemTemplate>
            <asp:TextBox ID="txtDynamicValue" runat="server"
                 Text='<%#Eval("DynamicValue")%>' AutoPostBack="True"
                 ontextchanged="txtDynamicValue_TextChanged"></asp:TextBox>
        </ItemTemplate>
    </asp:TemplateField>
    <%protected void txtDynamicValue_TextChanged(object sender, EventArgs e)
    {
        /*TextBox txt = (TextBox)sender;
        RulesManagerPresenter.OnDynamicValueChanged(txt.Text, GetTagName(txt.NamingContainer), QueryStringRuleGroup);
        presenter.OnLoadTagsAndValues4Presentation(ConnectionString);*/
    }%>

You could also have a look at this which does something very similar in VB

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜