Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Controls / November 2005

Tip: Looking for answers? Try searching our database.

DataList Issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sam Solomon - 25 Nov 2005 10:11 GMT
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 aDate,object aScore,DataListCommandEventArgs f)

{

aDate=(((Label)f.Item.FindControl("lblActivityDate")).Text);
aScore= (((Label)f.Item.FindControl("lblActivityScore")).Text);
string scriptblock = "<script
language='javascript'>window.open('ABC.aspx'_blank','width='+700+',height='+610+',top=0,left=0,scrollbars=1,menubar=no,toolbar=no,location=no');</script>";
Page.RegisterStartupScript("OpenPrintWindow", scriptblock);

}

But when I use this method

protected void dgdActivities_ItemCommand(Object s,DataListCommandEventArgs e)

{

if(e.CommandName=="Print")

{

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

}

}

the variables  Session["BDate"] and Session["BScore"] are empty. Because
when I use Session["BDate"]  and Session["BScore"]  on some other Web forms
it throws the following error

Object reference not set to an instance of an object

the variables  Session["BDate"] and Session["BScore"] are empty.

Any help would be greatly appreciated. Below is my sample HTML code:

<ItemTemplate>

<tr align="center">
      <td>
       <asp:Label ID="lblActivityName"
Text='<%#DataBinder.Eval(Container.DataItem,"ActivityName")%>' Runat="server">
       </asp:Label></td>
      <td>
       <asp:Label ID="lblActivityDate"
Text='<%#DataBinder.Eval(Container.DataItem,"ActivityDate","{0:d}")%>'
Runat="server">
       </asp:Label></td>
      <td>
       <asp:Label ID="lblActivityScore"
Text='<%#DataBinder.Eval(Container.DataItem,"Score")%>' Runat="server">
       </asp:Label></td>
      <td>
       <asp:Button ID="btnPrintCertificate" Text="Print"
CommandName="Print" Runat="server"></asp:Button></td>
     </tr>
    </ItemTemplate>

cheers,

Sam Solomon
Seth Webster - 28 Nov 2005 16:01 GMT
Where are you adding the variables to the Session.  I don't see it in the
supplied code.

>Dear All,
>
[quoted text clipped - 64 lines]
>
>Sam Solomon

Signature

Seth Webster


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.