473,800 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Switching Context From HTML to Code Behind

Hey guys,

Apologies if this is in the wrong thread, whenever I search for <% or
"switching context" I get no results.

What I am trying to do is set the value of a html text box to a server side
value but I need to do it in the HTML and not the code behind. Has to do
with custom javascript events and what not.

In 1.1 I have this and it works fine:
<input id="myTextBox" name="myTextBox " type="text" value="myContro l.Value" />

In 2.0 this doesn't work. The HTML editor seems to know what the <% and %>
are for as it highlights them but when I run the page and "View Source" i see
the following:
<input id="myTextbox" name="myTextBox " type="text" value="<%=myCon trol.Value
%>" />

So obviously it's not handling the tags properly.

Any ideas? This is driving me crazy!

Thanks
Jan 19 '06 #1
2 1411

Michael Raczynski wrote:
Hey guys,

Apologies if this is in the wrong thread, whenever I search for <% or
"switching context" I get no results.

What I am trying to do is set the value of a html text box to a server side
value but I need to do it in the HTML and not the code behind. Has to do
with custom javascript events and what not.

In 1.1 I have this and it works fine:
<input id="myTextBox" name="myTextBox " type="text" value="myContro l.Value" />

In 2.0 this doesn't work. The HTML editor seems to know what the <% and %>
are for as it highlights them but when I run the page and "View Source" i see
the following:
<input id="myTextbox" name="myTextBox " type="text" value="<%=myCon trol.Value
%>" />

So obviously it's not handling the tags properly.

Any ideas? This is driving me crazy!

Thanks


Try this:

<input id="myTextbox" type="text" value='<%= myControl.Value %>' />

Notice the single quote around the <%= %>

Jan 19 '06 #2
Also make sure the value you are getting from the server is declared as
a Public or Protected Method or Property in your code behind class.

Make sure that you have the <%@ Page %> directive at the top of the
aspx page. This is all I can thing of.

Jan 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2404
by: Johann Blake | last post by:
The following is a bug I have discovered using tab pages and threads and I am looking for a workaround. Create a new Windows Forms application and add a tab control with two tab pages. Add a label to each tab page. On the first tab page add a button. When the button is pressed the code behind the button creates a thread and starts that thread. The only thing that the thread is to do is to switch from the first tab page to the 2nd tab...
5
2037
by: JRB | last post by:
Hi, I'm creating a small C#program that communicates through the serial port. I have a separate thread that continuously takes in data from an external device in a while loop. The problem is that when I try and run another program, open a menu, or anything, I miss getting bytes. If I set the threads priority to above normal it works fine, but the rest of the program slows down dramatically. Is there any command or way to ensure that a block...
6
5519
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp; DataBinder.Eval(Container.DataItem,"StoreEmail") &amp; "&amp;Subject=" &amp; DataBinder.Eval(Container.DataItem,"ProductName") ....
1
5742
by: garry.oxnard | last post by:
Can anyone help me to solve a problem which involves switching from Access to Excel (then back to Access) programatically please? I have an Excel template which, on open, also opens an Access database - containing a list of addresses. Sequence of events is = (1) Excel template opens in its default XXX.xls filename. (2) Code runs to save the spreadsheet as XXX.xls. (3) User clicks a button to open an Access database containing an
3
11637
by: Michael | last post by:
Hi, I am getting a strange error. Last night when I left work this was working perfectly. This morning when I try to run this code in VS2005, it comes up with an error saying "The name 'UserName' does not exist in the current context". I don't know what to do about it. The field is there. It worked yesterday. Any ideas? HTML CODE: <%@ Master Language="C#" EnableTheming="false" AutoEventWireup="true"...
8
29837
by: rn5a | last post by:
I have a user control named Enter.ascx which has 2 TextBoxes. The 2 TextBoxes are named txt1 & txt2. The entire logic of this user control (like the properties of the 2 TextBoxes using set/get etc.) is encapsulated in a code behind page named Enter.ascx.vb. The code-behind also creates TextChanged events for the 2 TextBoxes. This is the code in Enter.ascx.vb: Namespace Details Public Class EnterCB : Inherits UserControl Public...
2
5655
by: jobs | last post by:
stupid question which I once think I had the answer to I'm sure. I create webform page with no codebehind. I then decide I want to create a codebehind for it. How can I do it so that it falls under the aspx page and does give met hat context error> I tried creating the .vb file, and making sure the directive on the
4
554
by: K Viltersten | last post by:
We have a project working well today and it's developed on VS2005. Since we're planing to switch to VS2008 in a soon future, i've been trying to move the project to VS2008 Express (Web Developer). After i've moved over all the files, i run into problems compiling and running it. Both versions of VS are run on the same computer (with the sam settings, of course). Still, when i try to run index.aspx, i get error message as follows:
4
2142
by: adlloyd | last post by:
Hi all, I've got an application that's written in C++ making use of MFC (VS6). Its purpose is to process SMS messages received from a GSM modem connected via a serial port (USB connection). The serial communications are handled entirely in their own thread. For the most part this works perfectly.However, there appears to be a problem where multiple instances of the application are running in different Windows XP environments. It seems...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10251
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.