yechan
asked on
Server tag is not well formed
Hi,
I am getting a Server tag is not well formed. doesn't seem to like my eval expression.
Below is what I have
<asp:HyperLink NavigateUrl="javascript:sw itchViews( '<%# Eval("TimePeriodId") %>' )" ID="HyperLink1" runat="server" Text='<%# Eval("TimePeriodId") %>' />
Thank you
I am getting a Server tag is not well formed. doesn't seem to like my eval expression.
Below is what I have
<asp:HyperLink NavigateUrl="javascript:sw
Thank you
ASKER
heya,
i don't think the error code is inside the javascript. At this point, I can't even compile without even getting a ""The Server tag is not well formed". When I remove NavigateUrl=..... asp.net compiles just fine.
i don't think the error code is inside the javascript. At this point, I can't even compile without even getting a ""The Server tag is not well formed". When I remove NavigateUrl=..... asp.net compiles just fine.
so you need a hiddenfield...on the client side...
<asp:HiddenField runat="server" ID="sessionDuration" />
------------
..in the code behind...whatever you want...
If Session("session_duration" ) Is Nothing Then
Session("session_duration" ) = "20"
End If
sessionDuration.Value = Session("session_duration" ).ToString ()
-------
also in client side you need your javascript....in the head section ...something like this...
<script language="javascript" type="text/javascript">
var sessionDuration;
var showTimer;
var hideTimer;
window.onload = function () {
sessionDuration = document.getElementById("< %= sessionDuration.ClientID %>").value;
showTimer = setInterval('if(--sessionD uration>0) document.getElementById("< %= Label17.ClientID %>").innerHTML = document.getElementById("< %= attendant_name.ClientID %>").value + " is typing... ";else { clearInterval(showTimer);c learInterv al(hideTim er); }', Math.floor(Math.random() * 6000));
hideTimer = setInterval('document.getE lementById ("<%= Label17.ClientID %>").innerHTML = "";', 888);
}
</script>
<asp:HiddenField runat="server" ID="sessionDuration" />
------------
..in the code behind...whatever you want...
If Session("session_duration"
Session("session_duration"
End If
sessionDuration.Value = Session("session_duration"
-------
also in client side you need your javascript....in the head section ...something like this...
<script language="javascript" type="text/javascript">
var sessionDuration;
var showTimer;
var hideTimer;
window.onload = function () {
sessionDuration = document.getElementById("<
showTimer = setInterval('if(--sessionD
hideTimer = setInterval('document.getE
}
</script>
then make sure your code behind is in shape...put a breakpoint on the code behind..and trace/step thru..to see where it dies at...most likely you are missing smoething in your code behine...i dont know what 'TimePeriodId'..is trying to do...
try
<asp:HyperLink NavigateUrl='javascript:sw itchViews( "<%# Eval("TimePeriodId") %>" )' ID="HyperLink1" runat="server" Text='<%# Eval("TimePeriodId") %>' />
<asp:HyperLink NavigateUrl='javascript:sw
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi HainKurt and GlobalLevel,
I have tried both of your suggestions but to no avail.
The good news though is that if I try HainKurt's suggestion, I get an error message something like this:
Message: Expected ')'
Line: 1
Char: 25
Code: 0
URI: http://localhost:49216/DynmicGridView/Default.aspx
then I looked at the source code and I see the following:
it appears that the < > etc are being escaped by asp.net
I have tried both of your suggestions but to no avail.
The good news though is that if I try HainKurt's suggestion, I get an error message something like this:
Message: Expected ')'
Line: 1
Char: 25
Code: 0
URI: http://localhost:49216/DynmicGridView/Default.aspx
then I looked at the source code and I see the following:
it appears that the < > etc are being escaped by asp.net
<a id="MainGridView_ctl02_HyperLink1" href="javascript:switchViews( "<%# Eval("TimePeriodId") %>" );">50</a>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Heya,
yes I do because this code is being used inside a GridView and I have a JaveScript that toggles the visiblity on and off based on a unique id.
yes I do because this code is being used inside a GridView and I have a JaveScript that toggles the visiblity on and off based on a unique id.
ASKER
Time to close it out. Been playing with jQuery and it seems OK. thanks for all the input.
also,,if you are tyring to pull a value from the server side..you have use a hiddenfield...