Calling a method written in .cs page from aspx page

Can we able to call a method coded in aspx.cs page from an asp control?
This way:
aspx page
<asp:TextBox ID="txtbox1" runat="server"

aspx.cs page
public void GetText()
5/15/2007 11:49:53 AM 93655 articles. 6 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 22

Yes.  But the easiest way to set this up to ensure it works is to double-click the text box in Design View.  That will automatically add the OnTextChanged event handler to the text box, and create the beginnings of the method for your code:

<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>

protected void TextBox1_TextChanged(object sender, EventArgs e)


You can change the name of the method to whatever you want, so long as you change it to be the same in both the aspx and the aspx.cs. 

Regards Mike
My site
5/15/2007 1:00:44 PM

Similar Artilces:

Call public method on aspx page from a web control embedded in the page
I have a nut to crack. How do I call a public method on my aspx page from my web control, the web control is embedded into the page. The markup looks like this:-   1 <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 2 <ContentTemplate> 3 <asp:Xml ID="Xml1" runat="server"></asp:Xml> 4 <uc2:tier3menu ID="menu1" runat="server" /> 5 </ContentTemplate> 6 </asp:UpdatePanel> I wrote an itemcommand thingie in the web control that needs to set the Documentsource a...

Calling an aspx page on form submission in another aspx page
I have 2 aspx pages called say page1.aspx and page2.aspx, and I am calling the second aspx page on submission of a form in the first page. Thus, I have the following code in page1.aspx <form name="frmtest" id="frmtest" method="post" runat="server" action="page2.aspx"> Now, when I submit the form, I am getting the following error message: The viewstate is invalid for this page and might be corrupted. Could anyone help me in this? Thanx in advance. Himanshu Hi, currently ASP.NET sets the action back to itself (...

Calling a aspx.cs method in aspx page
Hi, How to call an aspx.cs defined method in an aspx page? This is the method i have in aspx.cs:   public void MyMethod(object sender, PrintPageEventArgs ev) { }   How to invoke this method through aspx ? Thank you   <script language="javascript">          function init()          {               <%SetData();%>;          }          </script> =============  public void SetData...

call method from aspx Page into ascx Page
Hi,I am having following code on Default.aspx which contains my User Control MenuTabs.ascxpublic void Test(){    //my working code} *******************************************************************************************************  My User Control Page MenuTabs.ascxprotected void imgmyrb_Click(object sender, ImageClickEventArgs e){       Here i want to call Test() method which is available in the Default.aspx }    protected void imgmyskills_Click(object sender, ImageClickEventArgs e){       H...

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: might ...

Call codebehind method from aspx page OR call javascript function of usercontrol control from page
Hi, I have a page which contains a user control.  When a user clicks on a submit button, I'd like to detect when elements in the user control have changed and popup a message box if changes have been detected to confirm if the user wants to save the changes. Obviously the message box is executed using javascript.  But I'd really like to be able to call a method in the code behind of the page which queries the user control if it has changed.  Is there a way of calling the code behind method from within a javascript function? Otherwise, if I make all the functions execut...

How to pass the form contents of aspx page in .Net to Jsp page
Hi,   I want to pass the login information from aspx page to jsp page. plz help me how to do it. Please reply asap. Thanks...

In a web page(c#), I want to call another page and come back to next instruction of calling page
In a web page(c#), I want to call another page and come back to next instruction of calling page. Called page have no web item , it has only c# codes. after executing of this page (by IExplore), I want the remaining lines of calling page to be executed. How can I do that? What are you trying to do? What is the second page accomplishing? Will the first page stay open and the second page closes? You might be able to use WebRequest and WebResponse to do what you want. Hey bro, since you say that the called page has no web items, why dont you put the code in the called pa...

i have given 2 link buttons in default.aspx page .....but how can i call these buttons in default2.aspx.cs page???please can u help me??
can u give any suggestions please???? Hi You can use the ID's of the two link buttons to call them in .cs file. If you want to call a method or fire an event when button is clicked you need to write an button click event for those two buttons.  the following link button can  be used in the code with "linkButton" object and when this button is clicked 'OnClick_Submit" event will fire in the .cs file <asp:LinkButton ID="linkButton" runat="server" OnClick="OnClick_Submit">  Shekar.Y(GGKTech)http://ggktech....

How to call web service method from aspx page.
Hi , I am new to Ajax. I am unable to call web service from aspx page. Can some one explain the what all the setting needs to be done inorder to call web service from aspx page step wise. I am trying to call but i am getting the error message as "Mywebservice" un defined. Here is the steps i followed 1) Installed the AJAX extension 1.0 2) Created web service Project As a "SampleWS" and web service class as "MyWebService" and method as "HelloWorld()" and returns string (I have added the  <ScriptService()> _ also) 3) build the projec...

Paging Paging Paging
I am trying to do paging with my search results and it isnt working very well. Here is what I've tried and I feel I've tried everything, lol, please help me out. Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs) DataGrid1.DataBind() End Sub Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) Dim ds as dataSet DataGrid1.CurrentPageIndex = e.NewPageIndex if Session("Search") is nothing then 'Session probably has expired, get the datasource from database Datagrid1.DataSource = ...

how to call a aspx page inside anothe aspx page
HI, Can any one tell me. how can i call one aspx page insde anothe aspx page like iframe and partially update internal page.  You can use UpdatePanel control. Inside UpdatePanel you can place other asp controls and partially update them.Never Giveup. Keep trying...Nihar... You can use IFRAME or yo ucan use the below  Haissam Abdul MalakMCAD.NET| Blog |...

1 web method (page method) for multiple pages
I have a service that takes in a page method to do some stuff on the server and bring back to my client. The problem is that I have 3 more services that have to use this method... however I wish not to insert the same method each time for each service. How can I use this page method in multiple services?~Marty You can add this page web method ( its just like any other use cases for inheritance) to a base class and inherit all three pages from this, you have the web method available. HTHThajeer"Dont forget to click "Mark as Answer" on the post that helped you. This marks...

how to open a web page in form of a popup web page
Hello, I have two web pages, let say. Page A : With a Button on it. PAge B: with some info. Now I need to: When I click on the Button of page A.Page B must open in a pop up window.  I can do this but problem is this when I clicked on the button for first time it does not show me any thing and when I clicked on the button for second time then It shows me Page B .My code is as follow:  1 protected void Page_Load(object sender, EventArgs e) 2 { 3 if (!this.Page.IsPostBack) 4 { 5 6 } 7 else 8...

Web resources about - Calling a method written in .cs page from aspx page -

Calling Dr. Death - Wikipedia, the free encyclopedia
Calling Dr. Death (1943) is the first of the Universal Pictures Inner Sanctum mystery films . The "Inner Sanctum" franchise originated with a ...

List of country calling codes - Wikipedia, the free encyclopedia
This is a list of country calling codes defined by ITU-T recommendations E.123 and E.164 , also called IDD ( International Direct Dialling ) ...

Calling Batman: Bane Takes Over Ecko Unlimited Facebook Page
Bane, the villain in upcoming Batman feature film The Dark Knight Rises , turned his criminal mind toward the Ecko Unlimited Facebook page , ...

Facebook Video Calling - Facebook
Bring your conversations to life on Facebook. With face-to-face video calling, now you can watch your friends smile, wink and LOL. To get started, ...

Facebook’s Talktime program in India pays new mobile users in calling credit
... Facebook has launched its Talktime program in India which gives every new user who signs up with a mobile device 50 Rupees (almost $1) in calling ...

Berlin Calling (@neuraum) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Calling all foodies: Here comes @TwitterFood
There are many thousands of food-related Tweets people send on Twitter each day – Tweets about meals, ingredients, favorites, recipes and dining ...

Rounds Video Calling + Chat for iPhone 4, iPhone 4S, iPhone 5, iPhone 5c, iPhone 5s, iPad 2 Wi-Fi, iPad ...
Get Rounds Video Calling + Chat on the App Store. See screenshots and ratings, and read customer reviews.

Video Calling Coming to WhatsApp Soon: Report
... images show WhatsApp working on a prototype video call feature. Facebook Inc. ( NASDAQ:FB )-owned WhatsApp could soon introduce video calling ...

Resources last updated: 12/26/2015 7:14:35 AM