Session Variable Problem

S

Sam Solomon

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
 

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,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top