senzacionale
senzacionale

Reputation: 20936

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>
    </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...

Upvotes: 0

Views: 1676

Answers (3)

Shadow Wizzard
Shadow Wizzard

Reputation: 66398

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)

Upvotes: 1

BenCr
BenCr

Reputation: 6052

Does your event handler need to be public?

Upvotes: 1

harryovers
harryovers

Reputation: 3138

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

Upvotes: 0

Related Questions