Solved

Using SessionParameter

Posted on 2009-06-27
6
241 Views
Last Modified: 2013-11-07
I have a gridview with an sqldatasource as follows:
     
<asp:SqlDataSource ID="SqlDataSourceLocationList" runat="server"
      ConnectionString="<%$ ConnectionStrings:SOME_DSN %>"
      SelectCommand="select (FName + '.' + LName) as ContactName, C.Email, P.Phonenumber, P.LocationGuid from ClientLogin C, Phones P Where C.PhoneNumberGuid=P.PhoneNumberGuid and C.ClientGuid=@pClientGUID"
      SelectCommandType="Text"
    >
     
    <SelectParameters>
    <asp:SessionParameter  Name="pClientGUID" Direction="Input" SessionField="SessionInfo.ClientGUID" Size="36" />
    </SelectParameters>      

</asp:SqlDataSource>
 
On page load and unload I keep passing a class called "SessionInfo" that I manipulate and store/load.  I pass the ClientGuid as SessionInfo and cast it to my class type and access the various properties...

The associated grid comes back with 0 rows and I know that for the clientguid passed to the page via a session variable, there should be one row returned and have run the sql in management studio express.

Also note that the ClientGuid is of type uniqueidentifier. And that when I remove the parameter ( "and C.ClientGuid=@pClientGUID" ) and return all the table rows, the grid populates with data.

It might have to do with the Session

Thanks.
0
Comment
Question by:hbash
  • 3
  • 2
6 Comments
 
LVL 15

Accepted Solution

by:
jinal earned 250 total points
ID: 24730049
<asp:SessionParameter Name="pClientGUID" SessionField=SessionField="SessionInfo.ClientGUID"
 Type="String" />

I hope that this will help you and your SessionInfo.ClientGUID return some valid value.


 
0
 
LVL 15

Expert Comment

by:jinal
ID: 24730050
<asp:SessionParameter Name="pClientGUID" SessionField="SessionInfo.ClientGUID"
 Type="String" />
0
 
LVL 15

Expert Comment

by:jinal
ID: 24730053
I forgot to mention in my previous comment that
you also have to specify DefaultValue="".
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 1

Author Comment

by:hbash
ID: 24730068
I have tried your suggestion and still no rows returned...

Do you know of the routines/events to break in to see the sql before execution and the sessionparamter value ?

0
 
LVL 15

Assisted Solution

by:NazoUK
NazoUK earned 250 total points
ID: 24731416
I think SessionParameter only allows simple types, it won't evaluate a property of an object. If you want to use a SessionParameter you should store the value of ClientGUID on its own in a session variable.
0
 
LVL 1

Author Comment

by:hbash
ID: 24731885
That works.  Great.  It's unfortunate that I cannot use my SessionInfo class directly...  But it works.  Thanks.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now