Session Variable Problem

Discussion in 'ASP .Net Web Controls' started by Sam Solomon, Nov 25, 2005.

  1. Sam Solomon

    Sam Solomon Guest

    Dear All,

    I am trying to retrieve the value of a DataList cell in a label and assign
    it to a Session Variable. For this purpose I am using a method :



    private void OpenForm(object strDate,object
    strScore,DataListCommandEventArgs f)

    {

    if((f.Item.ItemType==ListItemType.Item)||(f.Item.ItemType==ListItemType.Item))

    {



    Label lblDate=((Label)f.Item.FindControl("lblActivityDate"));

    lblDate.Text =(string)DataBinder.Eval( f.Item.DataItem,"ActivityDate" );

    strDate =lblDate.Text;



    Label lblScore=((Label)f.Item.FindControl("lblActivityScore"));

    lblScore.Text =(string)DataBinder.Eval( f.Item.DataItem,"Score" );

    strScore =lblDate.Text;

    }

    Below is the code where it is implementated

    protected void dgdActivities_ItemCommand(Object s,DataListCommandEventArgs e)

    {

    OpenForm(Session["BDate"],Session["BScore"],e);

    }

    However for some reason Session["BDate"]ToString() and
    Session["BScore"].ToString() are both NULL. I have debugged the code and I
    can see that parameters strDate and strScore
    both NULL values. Why is it ?. Are you not allowed to pass session
    variables as method parameters.

    Kindly help.

    cheers,

    Sam Solomon
     
    Sam Solomon, Nov 25, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Smythe
    Replies:
    3
    Views:
    1,270
    Jeff Smythe
    Jan 2, 2004
  2. Replies:
    1
    Views:
    1,082
    Bruce Barker
    Nov 14, 2005
  3. =?Utf-8?B?Um9iSEs=?=
    Replies:
    4
    Views:
    5,307
    =?Utf-8?B?Um9iSEs=?=
    Apr 11, 2007
  4. chowchho
    Replies:
    7
    Views:
    646
    Patrice
    Mar 28, 2008
  5. Jazzis
    Replies:
    2
    Views:
    257
    Jazzis
    Sep 23, 2003
Loading...

Share This Page