displaying a string 
Author Message
 displaying a string

Frustrating problem. This is a simple assignment of a string to a label
(which is then used in js on the client). If I hard code the string it will
display on the page in the label and in the js (a tickertape). If I assign
strResultOfGetLatestNewsHeadline  (a string ) to Label11.Text the assignment
is reflected in Label11's text on the page but the js will not work. The
only difference as far as I can see is that one is hard coded and the other
is a variable. The conversion .ToString () is no doubt unnecessary. I've
tried coding " + + " around strResultOfGetLatestNewsHeadline  but these are
really desperation measures. The string var should work in the same  way as
the hard coded string shouldn't it?

Thanks in advance,

Phil

string strResultOfGetLatestNewsHeadline;

wsSQLdbNewsInteract.wsSQLdbNewsInteract TalkToNewsDb = new
wsSQLdbNewsInteract.wsSQLdbNewsInteract();

strResultOfGetLatestNewsHeadline = TalkToNewsDb.GetLatestNewsHeadline();

//if (strResultOfGetLatestNewsHeadline != "")

strResultOfGetLatestNewsHeadline = strResultOfGetLatestNewsHeadline.ToString
();

Label11.Text = strResultOfGetLatestNewsHeadline;

//Label11.Text = "heres the news text";

The js is called with :

<script language="javascript">
     startTicker("<%=Label11.Text%>");
   </script>



Sun, 31 Oct 2004 23:30:00 GMT  
 displaying a string
Philip,

    Why not just make strResultOfGetLatestNewsHeadline a modular level
variable then do the following:

<script language="javascript">
    startTicker("<%=strResultOfGetLatestNewsHeadline %>");
</script>

    Hope this helps.

--
               - Nicholas Paldino [.NET MVP]


Quote:
> Frustrating problem. This is a simple assignment of a string to a label
> (which is then used in js on the client). If I hard code the string it
will
> display on the page in the label and in the js (a tickertape). If I assign
> strResultOfGetLatestNewsHeadline  (a string ) to Label11.Text the
assignment
> is reflected in Label11's text on the page but the js will not work. The
> only difference as far as I can see is that one is hard coded and the
other
> is a variable. The conversion .ToString () is no doubt unnecessary. I've
> tried coding " + + " around strResultOfGetLatestNewsHeadline  but these
are
> really desperation measures. The string var should work in the same  way
as
> the hard coded string shouldn't it?

> Thanks in advance,

> Phil

> string strResultOfGetLatestNewsHeadline;

> wsSQLdbNewsInteract.wsSQLdbNewsInteract TalkToNewsDb = new
> wsSQLdbNewsInteract.wsSQLdbNewsInteract();

> strResultOfGetLatestNewsHeadline = TalkToNewsDb.GetLatestNewsHeadline();

> //if (strResultOfGetLatestNewsHeadline != "")

> strResultOfGetLatestNewsHeadline =

strResultOfGetLatestNewsHeadline.ToString

- Show quoted text -

Quote:
> ();

> Label11.Text = strResultOfGetLatestNewsHeadline;

> //Label11.Text = "heres the news text";

> The js is called with :

> <script language="javascript">
>      startTicker("<%=Label11.Text%>");
>    </script>



Sun, 31 Oct 2004 23:52:20 GMT  
 displaying a string
Thanks Nicholas ,

I fixed it by re-formatting the string before sending it down to the client:
strResultOfGetLatestNewsHeadline =
strResultOfGetLatestNewsHeadline.Substring(1,
(strResultOfGetLatestNewsHeadline.Length - 1));

Regards,

Philip



Quote:
> Philip,

>     Why not just make strResultOfGetLatestNewsHeadline a modular level
> variable then do the following:

> <script language="javascript">
>     startTicker("<%=strResultOfGetLatestNewsHeadline %>");
> </script>

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET MVP]



> > Frustrating problem. This is a simple assignment of a string to a label
> > (which is then used in js on the client). If I hard code the string it
> will
> > display on the page in the label and in the js (a tickertape). If I
assign
> > strResultOfGetLatestNewsHeadline  (a string ) to Label11.Text the
> assignment
> > is reflected in Label11's text on the page but the js will not work. The
> > only difference as far as I can see is that one is hard coded and the
> other
> > is a variable. The conversion .ToString () is no doubt unnecessary. I've
> > tried coding " + + " around strResultOfGetLatestNewsHeadline  but these
> are
> > really desperation measures. The string var should work in the same  way
> as
> > the hard coded string shouldn't it?

> > Thanks in advance,

> > Phil

> > string strResultOfGetLatestNewsHeadline;

> > wsSQLdbNewsInteract.wsSQLdbNewsInteract TalkToNewsDb = new
> > wsSQLdbNewsInteract.wsSQLdbNewsInteract();

> > strResultOfGetLatestNewsHeadline = TalkToNewsDb.GetLatestNewsHeadline();

> > //if (strResultOfGetLatestNewsHeadline != "")

> > strResultOfGetLatestNewsHeadline =
> strResultOfGetLatestNewsHeadline.ToString
> > ();

> > Label11.Text = strResultOfGetLatestNewsHeadline;

> > //Label11.Text = "heres the news text";

> > The js is called with :

> > <script language="javascript">
> >      startTicker("<%=Label11.Text%>");
> >    </script>



Mon, 01 Nov 2004 21:27:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VC++ debugger stops displaying Unicode strings

2. How to display std::string in debugger

3. Displaying LONG strings in the watch window

4. Displaying non strings using MessageBox

5. Display Unicode string using cout

6. Displaying Chinese strings in Chinese windows

7. How to display a string vertically?

8. CListCtrl: how to display long strings

9. display Unicode Strings In .Net

10. How do I display MBCS strings?

11. How do I display hex string

12. How can I make commonctrls such as static, button to display uncode string?

 

 
Powered by phpBB® Forum Software