I double click on a control and the code is put in the HTML file not in the code behind

for some reason when i I double click on a control. the code gets put in the HTML file and not in the code behind cs file

 how can I fix it so when ever I drag a countrol, double click on it, the code gets generated in the code behind

0
sean2020
12/28/2007 9:22:13 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

4 Replies
856 Views

Similar Articles

[PageSpeed] 17

 When you go to add a file to the project, there is a checkbox for if the code should be in a codebehind file. Did you check that box?


Please Mark As Answer posts that helped you.

"If we learn from our mistakes, I should be brilliant by now."

0
nikki_doer_of_things
12/28/2007 9:32:35 PM

Hi Sean,

Based on my understanding, you want to write the server code in the code behind class of asp.net page. If I have misunderstood you, please feel free to let me know.

ASP.NET supports two methods to author pages: In-line code and code behind.

In your case, the server code is embedded directly within the ASP.NET page. If we want the ASP.NET page to be contained within a separate class file, we can select the “Place code in separate file” checkbox when we create the new page.

 

Happy New Year!

I hope this helps. 


Thomas Sun
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Thomas
12/31/2007 1:41:20 AM

Thomas Sun – MSFT:

 we can select the “Place code in separate file” checkbox when we create the new page.

 

for some reason I don't have this checkbox :( 

0
sean2020
1/2/2008 2:43:36 PM

Hi,

Thanks for your response.

Usually, the “Place code in separate file” checkbox is in the Add New Item Window when we add the web form page.


To better understand your issue, could you please confirm the following information:

  • What version of Visual Studio or Visual Web Developer are you using?
  • What develop langue are you using?
  • Did you install the latest update for them?

 

I hope this helps. 


Thomas Sun
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Thomas
1/3/2008 2:07:27 AM
Reply:

Similar Artilces:

Get html code of aspx page from code behind
Hi all, Do you how we can do what I mention in the title?Example: aspx code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Header.aspx.cs" Inherits="Header" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!--js--> <script type='text/javascript'> alert('hello'); </script> <!--/js-->  Is there any way that in the code behind I can have the above string?. Actually I like to ge...

reusable code
 I have a page of code that instead of putting it in each pags code behind, I would like to be able to jsut include it in the code behind of each page so that it gets executed each time. This way I could jsut edit the one file and th changes woudl be site wide in thepages that have this as an include in the code behind file.What is the bet way to do that? Any examples?Thanks Hi, You could create a base class for the code-behind classes (put every code-behind class to derive from this common base class), when changes to the base class would apply to the derived classes.Thanks,Teemu Ke...

Method to handle a linkButton control is placed in my .aspx code and not the code behind file. Why?
    I have a web form and I want to use the linkButton control on my web form. I want a method to handle the event of  someone clicking on this linkButton control.   I performed the following steps: 1.) from the IDE controls toolbox I dropped a linkButton control on my web form 2.) I double clicked on the new control. (This automatically creates a method for the linkButton control)   Now my method to handle the linkButton click is created as I wish, but it is created in the .aspx code. And the method is emebeded in the <script runat="server"> t...

put html control to vb variable in code behind
Just wondering if there is any way to put a html control (e.g. textarea) in a vb.net variable in code behind. In addition, if I don't want to set the text area as server control, is that still possible to put the control in a vb variable in code behind? thanks alot. not sure what you mean by putting an html control in a vb.net variable, but if you want to read the value of an html control you can use Request.Form collection to get its value.Wessam Zeidan In the aspx page have the html look like this<TEXTAREA id="Textarea1" name="Textarea1" rows="2" cols="20" runat="server">...

How to get the reference of Content Control in the code behind file ?
I hava a default master page with only one ContentPlaceHolder control and leaves it empty.Then I create a new page, let it use this master page.The codes are as follows: <%@ Page Language="C#" MasterPageFile="~/MasterPage/Default/Default.master"  AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"></asp:Content> The question is that I can't get a ref...

getting html hidden controls value in code behind
hii need to get a value of html hidden control which is not set to runat server and i also dont have its id only name is getting.<input type=hidden name=refid value="1">Request.form["refid"] is not working. socan u sugges some idearegardsmax In asp.net, there is a control called a HiddenField control.Have you thought of using that?Also - is this posting to another page? if so - which post method?Many times, I've seen people use Request.form when they needed Request.QuerystringDavid WierMCP/ASPInsiderASPNet101.com - where to look first!Please Vote for ASPNet10...

How to register a CSS file to the page from code in the code-behind file?
Hello, all! How to register a CSS file to the page from code in the code-behind file? Thank you.                                                                                  Marcos I a...

get html textbox value in C#.net(code behind)
  i am new to ASP.net. Can anybody say how to get Input textbox value in C#.net. b4 sending answer Thankx  string value = Resquest.Form["textboxname"].ToString(); Hi,There are two ways to access it. 1) Make it runat="server" and access it in code behind like textbox1.value2) Another way is by using     Request.Form["textbox1"].ToString(); I hope this will be helpful to you.Thanks, Alpesh DhaneshaPlease don't forget to "Mask as Answer" if it helped. just add runat =server to html  ...

what about the code-behind (code behind)
One MAJOR difference between AJAX.NET and Atlas.NET seems to be that AJAX.NET is able to expose methods in your codebehind to the client. Why doesn't Atlas do this? Or am I mistaken? With AJAX.NET it's just a simple line or two:  Ajax.Utility.RegisterTypeForAjax(GetType(myClass)) <Ajax.AjaxMethod()>Public Function myFunction PLEASE tell me Atlas has something comparable to this. I don't have the time to rewrite all my code-behind methods in javascript or atlas script. All you need to do in Atlas to expose a method on your page (or its code behind class) is to put a [WebMet...

Code Behind or not Code Behind
Ok i am confuse now.... A lot of books are showing pages without code behind (the code is integrated in the .aspx) Is it better to use the code behind or not. Is there any difference between using VB.NET or C#.NET except for the code synthax. Thank you and come again. A lot of samples show inline code just for simplicity.. i personally use code-behind because I like to seperate my code from presentation. As for VB.NET or C#, its your preference.. there is no difference really when its all said and done. From a purely mathematical sense, having everything in a single file would s...

Setting width for .net controls in code(.aspx) page using function call in code behind..
Hi,  Currently I am trying to set the width of the asp.net Table as follows. <asp:Table width="<%=GetWidth()%>" >   and code behind protected Unit GetWidth() { return Unit.Percentage(50); }     It's not working. I know that it works if I set the width complete on some page event(like page_load) of code behind....   Is there a way to maintain the same syntax like calling code behind function in design page...i.e. calling function of .aspx.cs in .aspx page and assign the width as shown above.   Thanks and regards, Giridhar...

difference between code inside a <script> tag and code in the code-behind file
What is the difference between code that exists inside the <html><script runat="server" > tag and code that exists in the code-behind file? Thanks, Keith There really isn't much of a difference other than the code inside the <script runat="server"> tag is part of the web form while code in a class file is part of the class file and inherited in the web form. HTH,RyanRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

Include Code-behind .js into another Code-behind .js file
I have a utility code-behind file in .js and I'm trying to add or reference to code in this file from another code-behind file in .js using the "import" feature. Anyone know how? Thanks... ...

Moving items from the page code behind to the user control code behind.
I am trying to setup a page with a user control specified as a header. Things work fine until the user control has to access dynamic content that is in the code behind of the main page. When I try to move these commands to the code behind for the user control I get errors saying items have not been declared. What is the best way to do this, I'm mainly trying to create some headers and footers for my asp.net project. if it belongs for the header move it to the headers code behind. It is probably saying items have not been declared because you moved the methods, but not the properties to...

Web resources about - I double click on a control and the code is put in the HTML file not in the code behind - asp.net.getting-started

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

The US needs gun control to protect children like my grandson, killed at Sandy Hook
Motives do not matter to the dead. They don't matter much to survivors, either.

Control traffic as a cat sheriff in Street Fever: City Adventure
... as you play Marty the cat sheriff in this new part arcade, part puzzle game from Meow Studio. In Street Fever: City Adventure you will control ...

The little box that controls half your home’s energy use
(credit: Nest Labs) A thermostat can be such a simple device—so dumb a device if we’re feeling 21 st Century snobby—that a strip of metal coiled ...

How to perform Jedi mind control tricks using neuroscience
... looking for..." With those words, Obi Wan Kenobi inspired a generation of nerdy young men to try their hands at performing Jedi mind control ...

Sandy Hook parents assess victories, defeats in gun control mission
CBS News Sandy Hook parents assess victories, defeats in gun control mission CBS News NEWTOWN, Conn. Three years ago on Monday, a gunman opened ...

How to use iOS or Apple Watch as remote controls with Apple TV
... new feature for Apple TV owners using Apple Watch, iPad or iPhones last week – the capacity to use your iOS device as a remote control for your ...

Hilarious: ‘Burglars For Gun Control’ Sums Up The Left’s Entire Argument
'As long as law abiding citizens have guns, it's that much harder for burglars like me to do my job.'

Bart & Fleming: Don’t Come To Year-End Movies To Get Laid; Time For Movies About Gun Control Debate?
Peter Bart and Mike Fleming Jr. worked together for two decades at Daily Variety . In this weekly Sunday column, two old friends get together ...

Halo 5 is getting advanced control options
... is a good day. There's more to next week's update for Halo 5: Guardians than Forge mode, maps, and REQs. The game is also expanding its control ...

Resources last updated: 12/15/2015 6:47:46 PM