tags:

views:

1742

answers:

6

Hey guys,

I'm having a bit of a pain here and I just can't figure out what's wrong.

I have an ASP.net project which I deployed on a server. At first everything seemed allright, no Errors whatsoever. However, as a last adition I wanted to add a search function to a fairly large list so I added the following syntax to my mark-up:

<td>
    Search Server:
    <asp:TextBox ID="txtSearch" runat="server" />
    <asp:Button ID="btnLookup" runat="server" OnClick="btnLookup_Clicked" Text="Search" />
    <asp:Label ID="lblFeedback" runat="server" />
</td>

and the following in code behind:

protected void btnLookup_Clicked(object sender, EventArgs e)
{
    lblFeedback.Text = "";
    Session["IsSearch"] = true;
    LoadServerList();
}

When I run this locally it works just fine as I expect. HOWEVER!

When I copy these files to the server I get a compilation error:

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

it says there is nothing that handles my Clicked event although it does work when I run it through Visual studio.

any ideas?

EDIT: What I tried myself is

  • renaming button
  • deleting and readding the button
  • add through designer
  • renaming click event
  • removing the event from markup allows normal execution ... :/
A: 

Do you set

<%@ Page ... Language="C#" CodeBehind="... .aspx.cs" Inherits="..." .../>

in your page directive correctly?

ArsenMkrt
yes, because there is a lot more on that page that works as it should be. it's purely the click event that freaks out. I just checked. When I remove the OnClick from the markup page it works ....
Jan W.
+1  A: 

Did you deploy the dll?

jeroenh
+2  A: 

Is your project a web site or a web application? I would guess that it's a web application project and that perhaps you don't have the latest DLL deployed from the bin folder. Check the versions between your machine and the server to verify that they are the same.

Tuzo
it was my first time deploying something. I didn't know the site itsefl was also compiled seperately. it works now, I copied the latest website dll to the server :D THX
Jan W.
A: 

This should fix it if you did everything else right:

Try to make an entirely new click event (using the split view, just to be sure you get the method signature right.)

Then copy your code from your previous clicked event into the newly created event, copy the new event's method name to your original button and see if it works.

Alex
A: 

Try renaming the event handler to some thing OnClick="buttonLookup_Clicked"... and changing the event handler signature to match it.

S M Kamran
A: 

hello

i have the same problem and i am using asp.net mvc.

first question from me is where and how i have to add this:

protected void btnLookup_Clicked(object sender, EventArgs e) { lblFeedback.Text = ""; Session["IsSearch"] = true; LoadServerList(); }

and which dlls i have to register?

best regards

bladepit

bladepit