Page does not contain a definition for 'btn_Click' and no extension method

Hi everyone Surprise

Im quite new here. I hav a webpage in Visual Web Developer 2008 with the following error 

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

Source Error:

Line 50:                   <tr> 
Line 51:                     <td class="main" style="width: 135px"></td> 
Line 52:                     <td class="main" style="width: 278px"><input type="Submit" id="btnSubmit" OnServerClick="btn_Click" 
                                 value="Send" runat="server" onclick="return btn_onclick()" /></td> 
Line 53:                  </tr> 
Line 54:               </table> 


Source File: c:\website_cs\page.aspx    Line: 52

 I have the code behind

public void btn_Click(object sender, EventArgs eArgs)

{

try

{

TcpClient objTCPC = new TcpClient(Request.Form["Form"], 43);

string strDomain = Request.Form["Form"] + "\r\n"; byte[] arrDomain = Encoding.ASCII.GetBytes(strDomain);

 

Stream objStream = objTCPC.GetStream();

objStream.Write(arrDomain, 0, strDomain.Length);

StreamReader objSR =
new StreamReader(objTCPC.GetStream(), Encoding.ASCII); lblResponse.Text = "<b>" + Request.Form["Form"] + "</b><br><br>" + Regex.Replace(objSR.ReadToEnd(),"\n","<br>");

 

objTCPC.Close();

}

catch(Exception ex)

{

lblResponse.Text = ex.ToString();

}

}

 

Please help

1
xara
4/24/2009 2:39:59 PM
asp.net.web-forms 93655 articles. 4 followers. Follow

4 Replies
5940 Views

Similar Articles

[PageSpeed] 3

You are using this in your aspx


onclick="return btn_onclick()
and you c# function name is  btn_Click
so change your c# function name to  
btn_onclick
and remove return from you aspx 
as:" 
C#: 
public void btn_onclick(object sender, EventArgs eArgs) 
and aspx:
onclick="btn_onclick() 

Thanks,
Karan

~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
-1
karan
4/24/2009 3:00:44 PM
use this onclick="btn_Click" instead of onclick="return btn_Click()". In case of client on click you can use "return btn_Click()"

Mohsin Naeem
"Please mark as answer if it helped you"
-1
mohsinaeem
4/24/2009 3:05:17 PM

tnx :-)

1
xara
4/25/2009 8:25:18 PM

 Well I posted the same answer before as you notice.


Thanks,
Karan

~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
1
karan
4/27/2009 2:00:35 PM
Reply:

Similar Artilces:

'System.Windows.Forms.DataGridView' does not contain a definition for 'databind' and no extension method 'databind' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be foun
 Error    1    'System.Windows.Forms.DataGridView' does not contain a definition for 'databind' and no extension method 'databind' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be found (are you missing a using directive or an assembly reference?) how to solve this Are you using a web applictaion or windows application. If web aplictaion then you should not use 'System.Windows.Forms.DataGridView'  Try using system.web.ui.control.datagridVikram www.vikramlakhotia.comPlease ma...

'System.Web.HttpRequest' does not contain a definition for 'form'
Hello all. .NET 2.0 newbie here.... What I'm trying to do is learn how to use the LoadVars() in actionscript. Here is the .NET / C#/ html code  1 <form id="form1" runat="server"> 2 <div> 3 <% 4 if (Request.form("userName") == "Cameron") 5 { 6 Response.Write("&aspvar=it is You!"); 7 } 8 else 9 { 10 Response.Write("&aspvar=you are not Cameron&"); 11 } 12 13 %> ...

'System.Web.Mvc.HtmlHelper' does not contain a definition for 'GridView'
Hi,Using this article http://weblogs.asp.net/stephenwalther/archive/2008/06/24/asp-net-mvc-tip-8-create-an-asp-net-mvc-gridview-helper-method.aspxi have created gridview based on that but, the error follows  Compiler Error Message: CS1928: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'GridView' and the best extension method overload 'VMLBlogsite.Helpers.GridExtensions.GridView(System.Web.Mvc.HtmlHelper, System.Data.Linq.ITable)' has some invalid arguments Source Error: Line 8: Simple Grid Line 9: Line 10: <%= Html.GridV...

'System.Web.UI.Control' does not contain a definition for 'DataItem'
Hi, I am recieving this error: 'System.Web.UI.Control' does not contain a definition for 'DataItem' What iam trying to do is when a user clicks the hyperlink column in the datagrid then the ID of that user is send to another page and I need to run the Query or something and bind the Label on the page 2 with the name of the Person. So I am using the HTML view and writing something like this : '<%# DataBinder.Eval(Container.DataItem,"Name") %> ' here is my code behind file so how can i bind the Name of the person with the label: private void Page_Lo...

'System.Web.UI.Control' does not contain a definition for 'DataItem'
Hi, I am getting this error does anyone knows how to solve this :DHighOnCodingWanna get high! Show us the code that produces this error. Other than the exactness of the error, which explains what is exactly happening, we can't see why this is happening without seeing your code.David WierMCP/ASPInsiderASPNet101.com - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(Please 'Mark as Answer' when i...

'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Calendar'
Hi, Please anybody tell me what this error. I use asp.net MVC Beta. This error showing in gridview too how to rectify it?Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Calendar' and no extension method 'Calendar' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?) Source Error: Line 8: Line 9: Mvc Calendar 1: Simplest Calendar Line 10: <%= Html.Calendar() %> Line 11: Line 12:   &nbs...

CS0117: 'System.Web.Security.MembershipUser' does not contain a definition for 'UserName'
Hi, I export my dataBase1 on others dataBase2. But , now, I have this errors.   Compilation Error 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: CS0117: 'System.Web.Security.MembershipUser' does not contain a definition for 'UserName'Source Error: Line 77: { Line 78: MembershipUser memberUser = Membership.GetUser(); Line 79: if (memberUser.UserName != null && ...

'System.Web.UI.WebControls.Panel' does not contain a definition for 'drpData'
Hi i have the following problem: Compiler Error Message: CS0117: 'System.Web.UI.WebControls.Panel' does not contain a definition for 'drpData' Source Error: Line 59: strvBilled = filepath.ToString(); Line 60: strvPris = tbvPris.Text; Line 61: strvKategori = tbvKategori.drpData.SelectedItem.Value.ToString(); Line 62: strSQL = "INSERT INTO varelist (vNummer, vNavn, vBeskriv, vBilled, vPris, vKategori) Values ("; Line 63: strSQL += strvNummer + ", '"; It should come from this list: <asp:panel ID="tbvKategori" r...

'System.Web.UI.WebControls.TextBox' does not contain a definition for 'InnerHtml' and ...
Hi,I have the problems (the following is one of those) with the codes below.Error 4 'System.Web.UI.WebControls.TextBox' does not contain a definition for 'InnerHtml' and no extension method 'InnerHtml' accepting a first argument of type 'System.Web.UI.WebControls.TextBox' could be found (are you missing a using directive or an assembly reference?)  Here is the markup file of 'Start.aspx' <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Start.aspx.cs" Inherits="Newsite._Default" %...

'System.Web.UI.WebControls.Label' does not contain a definition for 'Invoke'
I am making an asyncronous call to a web service. When the callback happens and my delegate is called, I want to set a text value on a label on my page. In order to do this I need to use Label1.Invoke -- However, when I compile this I get an error'System.Web.UI.WebControls.Label' does not contain a definition for 'Invoke'I thought all controls should have an Invoke method on it.. I don't understand why I get this error? Any one experience the same thing or have any clue as to what is going on? // we must invoke to get back to the UI thread...this.Label1.Invoke(new La...

Error after adding a textfield to a form: 'Registration_Form' does not contain a definition for 'urlAddress'
Hi, I'm working on a little project, exploring VisualStudio 2005 and C#. I am currently updating a simple registration form: a few fields for username, password, email, etc.. I took the existing form and I am now trying to add a UrlAddress field so the user can put in a link to a personnal web site. I am using a HtmlTextInput control. Here's the line from the .Aspx file: <input id="urlAddress" style="width: 409px" runat="server"/> And this is the code from the Code-Behind file executed by the submit button: protected void Register() {    User usr = null;&nb...

Can any one help due to this problem Error 1 'System.Web.UI.Page.Application' is a 'property' but is used like a 'method'
Hi all ! while creating application,session variables i am getting this problem can u suggest any one. Error 1 'System.Web.UI.Page.Application' is a 'property' but is used like a 'method'  lokesh   As a general guideline for seeking help, always show the code that is not working for you.  Your description alone is not enough for us to be able to help you. Alister kplokesh: Hi all ! while creating application,session variables i am getting this problem can u suggest any one. Error 1 'System.Web.UI.Page.Application' is a 'property' but is us...

CS0117: 'System.Web.UI.WebControls.Calendar' does not contain a definition for 'SelectedValue'
am I missing some class info somewhere perhaps?Any ideas or suggestions would be appreciated!error being thrown here:Line 16:                   Calendar1.SelectedValue = ("DueDate"); here is my current code:<%@ Page EnableViewState="true" Language="C#" AutoEventWireup="true" Inherits="CommunityServer.Controls.CSThemePage" MasterPageFile="tasks.Master" %><%@ Import Namespace="CommunityServer.Components" %><%@ Register T...

System.Web.UI.Page.Request' denotes a 'property' where a 'method; was expected
i have create a datalist that displays book titles once click the hiperlink takes you to an edit page. the hyperlink looks like this. <asp:hyperlink id="link" Runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Title" )%>' NavigateURL='<%# Request.ApplicationPath + "/edit.aspx?id=" + DataBinder.Eval(Container.DataItem, "ref_id" ) %>'/> my problem is as follow when i get to the edit page. instead of displaying one record at a time it displays all records one after the other one. I have tried to use the follow...

System.Web.UI.Page.Cache is a 'property' but is used like a 'method'
if (Cache("MyData") == null){ds = myclasslibrary.lookupIDs();  <<filling datasetif (ds != null){if (ds.Tables[0].Rows.Count > 0){ddl.DataTextField = "Text";ddl.DataValueField = "ID";ddl.DataSource = ds;ddl.DataBind();Cache.Insert("MyData", ds, null,DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration);} }else{ds = ((DataSet) (Cache("MyData")));} error: System.Web.UI.Page.Cache is a 'property' but is used like a 'method'Its all about coding! Change the 2 lines that say Cache("MyData") to be Cache["MyData"] instead.If this post answered your question please remember to ...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Error 1 The type 'System.Web.UI.WebControls.LinqDataSource' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll' and 'c:\WINDOWS\asse
Once I build project. I encounter this error. Does someone experience this error?Error    1    The type 'System.Web.UI.WebControls.LinqDataSource' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll' and 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.6.0.0__31bf3856ad364e35\System.Web.Extensions.dll'    D:\Source Code\Linq_Lesson5\Default.aspx    1    1    D:\Source Code\Linq_Lesson5\  It appears tha...

Error Message CS0117: 'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'Text'
I get this Error Message: ( CS0117: 'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'Text' ) from my Register.aspx when I try to open it. I've added a DropDownList to the Register.aspx page and it throws me this (CS0117 Error message). Could use some help on this. Don't know where and how to correct this problem. If I remove the Dropdownlist and recompile the CustomersDB.cs file, and run the Register.aspx page again then it opens up. But as soon as I add the DropdownList I receive this (Error CS0117). Would appreciate any help. Thank You. TIA. Here is the co...

'object' does not contain a definition for 'Reaction'
Hi,,the following code shows the error, 'object' does not contain a definition for 'Reaction' if (objError.Reaction==0) { throw; } plz solve this issue Thanks   Post the code of objError. Looks like reaction is not defind there.ASP.NET Hosting (HostingFest)...

'SiteMap' does not contain a definition for 'CurrentNode'?
Not sure what happens but I can't access all SiteMap's properties. I'm using Ajax-enabled site and applied a Master Page.  What I'm trying to do is change current node title at run time and I saw some posts: SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);SiteMapNode tempNode = currentNode; tempNode.Title = "xx";tempNode.Description = "xx"; Thanks in advance, Frank   The following is the error message: Description: An error occurred during the compilation of a resource required to service this request. Please review the followin...

'_Master' does not contain a definition for 'Context'
 its first time happening to me. i have only one file in my asp.net website. the Master pagethis is the code behind class of this master pagenamespace Asif.Website{    public partial class _Master : System.Web.UI.MasterPage    {                    }}  when i publish this website it reports an error '_Master' does not contain a definition for 'Context' When i remove the "Namespace" and class is without namespace it works fin...

'type' does not contain a definition for 'length'
Could anybody help me with this, thanks so much //Copyright (C) 2000 Microsoft Corporation. All rights reserved. // Hello1.cs public class Hello1 { int OneToZero(int[] args) { int iCount = 0; for (int i=0; i < args.length ; i++) { if (args[i] == 1) { iCount++; args[i] = 0; } } return iCount; } public static void Main(string[] args) { int[] iArr = {1, 3, 4, 5, 1, 1, 7}; Hello1 test = new Hello1(); int iNumOnes; System.Console.WriteLine("Values of the array: [ "); ...

'_Default' does not contain a definition for 'lblLogIn'
I have few lables in my page,when compile it gives error that _Default' does not contain a definition for 'lblAdminPath' .Though It run ok.part of codebehind code is as follow.Rest of the label work fine except few.All the tag in codebehind is closed.<asp:Content ID="DefaultContent" ContentPlaceHolderID="RDContentPlaceHolder" Runat="Server"> <table width="723" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff"> <tr> <table width="90...

'CreditCard' does not contain a definition for 'GetCreditCardDetails'
In my Confirm.aspx page I am using a method from a dll. In VS 2005 sometimes when I compile my project(web site) in which the dll is a part of the solution it gives me following error,Confirm.aspx.cs(220): error CS0117: 'CreditCard' does not contain a definition for 'GetCreditCardDetails' I verified many times that the method exists. To solve the errror I have to remove the dll from the bin and give reference again. Yesterday I deployed the dll and didn't receive any error while compilation. But received error after accessing Confirm.aspx. Can someone please hel...

Web resources about - Page does not contain a definition for 'btn_Click' and no extension method - asp.net.web-forms

Resources last updated: 2/17/2016 8:42:41 PM