How to transfer my DataTable to a PopUp Window? Context? Session?

A

Andreas Klemt

Hello,
which is the best way to transfer my DataTable to a PopUp Window?
Using Context would be great but I it seems not to work.

Which is the best solution?

Thanks in advance,
Andreas
 
D

Daniel Bass

use a session...

in the code where you launch the pop up from you'd have something like:

....
// store the datatable
Session["DataTable"] = sourceDt;

// write some script to launch the pop up
string szJavaScript = " <SCRIPT language=javascript>" +
System.Environment.NewLine +
" window.open('MYPOPUP.ASPX', '_blank',
'width=300,height=150,top=250,left=350,toolbar=no,scrollbars=no,status=no,re
sizable=no', 'true');" + System.Environment.NewLine +
" </SCRIPT>";
RegisterClientScriptBlock( "LaunchPopup", szJavaScript );
......


replace the 'MYPOPUP.ASPX' with your popup name.

then in the Page_Load of your pop up window you'd have something like

// get the datatable
object objDataTable = Session["DataTable"];
DataTable dt;
if ( objDataTable is DataTable )
{
dt = (DataTable) objDataTable;
// .....do your business with it here....
}


be careful of word wrapping in this document, if you're using VB and need it
in that, lemme know and I'll do that for you.

hope that helps.

Dan.


Hello,
which is the best way to transfer my DataTable to a PopUp Window?
Using Context would be great but I it seems not to work.

Which is the best solution?

Thanks in advance,
Andreas
 

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

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top