Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Need help with Parent and Child Page

Author  Topic 

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-09 : 10:27:51
Good Morning:

I have an ASP.Net Page MS.aspx (Parent Page). The page contains a datagrid with the following columns:

Product Name --PDFformatofProduct Manufact Prod Type
Product Name is a Lnk Button
PDFFormat is a Link Button.

OK.

I have to create a new Printer friendly page. I called MSPrint.aspx
I use the following Java to OPEN my New MSPRINT.ASPX
This function is located inside the HTML section of the Parent MS.aspx form.
function PrintThisPage()
{
var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,";
sOption+="scrollbars=yes,width=730,height=700,left=100,top=25";

var winprint=window.open("MSDSPrint.aspx","Print",sOption);

winprint.focus();
}

</script>

<div id="contentstart">

The concept is that it will open a new page that contains all the information from the Parent Page in the <div id= "contenstart"></div>

In the new page MSPrint.aspx I don't want:
Product Name as a Lnk Button - I just want the text.
PDFFormat is a Link Button. - I don't want this PDF column.

I cannot eliminate this two columns from the Parent Page because it is needed. How can I prevent this two columns from being pass into my new MSPrint.aspx Page.

Thanks for the help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-09 : 11:00:08
Ok. I think I have an idea....I will take the dataset that fill out the information in the datagrid for the Parent Page and put it in a Session Variable


cnMSDS.Open()
daProducts.SelectCommand = sqlCommand
daProducts.Fill(dsProducts)

Here is the dataset----how can I put into a Session VAriable...

dsProducts = Session(MSPrint) ????? Need help
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-09 : 11:23:07
Just create a NEW printable version of your current page, and open that new page when a user clicks the print friendly link.

Or, accept a URL parameter like "PrintFriendly=Y" and use that to output your page to determine if it should be done in a normal manner or in a print-friendly manner.

Does this make sense? Don't try to do this with javascript.

And store a DataSet in the session! You should never store large objects that potentially consume lots of memory in a session variable.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-09 : 11:31:01
The problem is that I need the print preview to look different from the original page. I don't need the hiperlink column and I don't need the pdf column.
Go to Top of Page

fridaynoon
Starting Member

3 Posts

Posted - 2008-05-09 : 11:35:20
You may want to look at CSS and the "media type" tag. You can define styles for both "screen" and "print". This allows you to use the exact same page for both the online viewable page and the printed page.

See this article:
http://www.w3.org/TR/REC-CSS2/media.html

Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-09 : 11:39:47
The problem is that I need the print preview to look different from the original page. I don't need the hiperlink column and I don't need the pdf column.

I do not want the exact same page...that's the problem. I want the printable version to be different from the ORIGINAL.

Thanks.
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-09 : 11:40:38
cnMSDS.Open()
daProducts.SelectCommand = sqlCommand
daProducts.Fill(dsProducts)

Here is the dataset----how can I put into a Session VAriable...

dsProducts = Session(MSPrint) ????? Need help

Just help me on how can I put a dataset into a Session VAriable....Thanks!!!
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-09 : 11:47:08
I already told you: CREATE A NEW .ASPX PAGE FOR THE PRINT-FRIENDLY VERSION.

quote:

Just help me on how can I put a dataset into a Session VAriable....Thanks!!!



And, again:

DO NOT EVER STORE DATASETS IN A SESSION VARIABLE!

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-09 : 11:49:12
Have you read my first post? I already created the new .aspx page for the print-friendly version....
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-09 : 11:50:11
Then what is the problem? If you have a new ASPX page, then don't put a hyperlink on there! Just create the page exactly as you want to. If you are using a HyperlinkColumn, then don't! Use a BoundColumn, or a template column. And, if you have <A> tags on the .ASPX page, then remove them, that's what causes hyperlinks to appear.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-09 : 11:57:24
I need the information from the Parent Page, to be pass into this new page but to look different.

I already change the printable Page and I am using a Template Column for Product Name. But since the Parent Page is the Result of a Selection Criteria done in another page. I guess what I am trying to do is pass the same selection criteria - but that looks different in the printer friendly page.

I hope this will give you an idea.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-09 : 12:13:32
So, what you need is totally, completely different than what you were originally asking for.

All you need to do is put pass the parameters of what the user is currently viewing into the URL.

PrintFriendly.aspx?CompanyID=24&Month=01&Year=2004 ... etc ....

If that doesn't answer your question, you need to step back and provide clear, specific information that explains your entire situation and exactly what you are trying to do and exactly what problem you are having. You can't leave things out, or be vague, or expect that we know anything at all about your application, what the page is displaying, and so on.


- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -