473,324 Members | 2,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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="myControl.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="<%=myControl.Value
%>" />

So obviously it's not handling the tags properly.

Any ideas? This is driving me crazy!

Thanks
Jan 19 '06 #1
2 1387

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="myControl.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="<%=myControl.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
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...
5
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...
6
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;...
1
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...
3
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'...
8
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...
2
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...
4
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...
4
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.