Does this look OK: ContextKey='<%# Session.SessionID %>'

A

AAaron123

The contextKey in GetSlides returns Nothing.

Maybe the ContextKey='<%# Session.SessionID %>' is not correct. See below -
the element in the aspx file.

Maybe ByVal contextKey As String should be ByRef.

Maybe something else.

I've been looking and can't find a definite answer to my maybe ByRef above.

Does ContextKey='<%# Session.SessionID %>' look right - I'm a little shaky
about this syntax.

Got any idea what might be wrong.

Thanks



<ajaxToolkit:SlideShowExtender ID="SlideShowExtender1" runat="server"
TargetControlID="Image1"

SlideShowServicePath="../WebServiceGetSlides.asmx"
SlideShowServiceMethod="GetSlides"

ImageDescriptionLabelID="ImageLabel1" NextButtonID="NextButton"
PlayButtonText="Play"

StopButtonText="Stop" PreviousButtonID="PrevButton"
PlayButtonID="PlayButton"

Loop="true" BehaviorID="AdjustTimingBehaviorID" AutoPlay="False"

UseContextKey="true" ContextKey='<%# Session.SessionID %>' />







Public Function GetSlides(ByVal contextKey As String) As
AjaxControlToolkit.Slide()
 
A

AAaron123

Mark said:
ContextKey='<%=Session.SessionID%>'


I see now that the # should have been an =
So changed it and was supprised by the result.

In the GetSlides function contextKey equaled the string:
Session.SessionID

Not the value of Session.SessionID.

1) I need it to be the value so I have to figure out how to accomplish that.

2)I'd like very much to understand why Session.SessionID (not enclosed on
quotes) was treated like a string instead of like a property. Can you
explain that?


Thanks


Public Function GetSlides(ByVal contextKey As String) As
AjaxControlToolkit.Slide()
 
A

AAaron123

Mark said:
What happens if you try '<%=Session.SessionID.ToString()%>'

If I use:
ContextKey='<%=Session.SessionID.ToString()%>'

Then in:

GetSlides(ByVal contextKey As String)


I get from add watch:

contextKey "<%=Session.SessionID.ToString()%>" String

Could it have anything to do with the fact that SlideShowExtender1 is an
ajaxToolkit Extender?

It looks like <%= %> is never worked by Asp.Net (or whoever normally does
that)



Besides, I THINK Session.SessionID returns a string and I THINK adding
ToString() to a string gives an error.


However, in Page_Load I tried
SlideShowExtender1.ContextKey = Session.SessionID which works.



I also tried:

SlideShowExtender1.Attributes.Add("ContextKey", "Session.SessionID")

but got the message that Attributes is not a member of SlideShowExtender1.



I need to learn when I can simply reference an element ID, when I to use
Attributes and when to use FindControl.



Thanks a lot
 
A

AAaron123

Mark said:
You're using VB.NET...?
yes

I wasn't sure if it should be ByVal.
The MS doc I saw gave a C# example and as I remembered it it had neither Val
nor Ref.
I don't know what C# defaults to so I tried both and got an error when I ran
with ByRef.
I've read that but at a break at "If Not IsPostBack Then"
watch shows:

Session.SessionID "epmji3454mqqzq55mqznsnmd" String

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load



SlideShowExtender1.ContextKey = Session.SessionID

If Not IsPostBack Then



So I'm confused (again :))



Thanks



In web.config I have

<compilation debug="true"

strict="true"

explicit="true">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top