Hi
I am busy with a webpage and on it the user can Add or Remove items that he/she needs to specify some details for. I have one page for Add and remove as the same information needs to be entered. I am using iFrame where the Add/Remove pages load in.
I want to add the words “Add” or “Remove” to the heading of the page loaded in the iFrame. For that I need to check what the user has clicked. Normally this wouldn’t be an issue, but the menu control that I’m using only has a “OnClickScript” that can be used for every menu item. That means I can’t use Code Behind directly. Then I thought of using javascript to execute a Code Behind method and then use Session, but I have no idea how to use javascript this way.
What would be the best way to check what the user has clicked and the best way to get the value(Add/Remove) added to the page in the iFrame?
Hope I am making sense… ;)
And then I am also struggling to find a good article on how to have the user download a file from the page. I just want to have about 3 or 4 pdf files available for the user to download to there PC’s. Anyone know of a good one?
Thanks
NeCroFirePosted Jun 20, 2008, 11:20 AM
The add and remove is the same page as the same information is needed. I just want to know if the user clicked Add or if he/she clicked Remove and then I can add the words (Add/Remove) to the heading of the page loaded in the iFrame. I thought about using javascript to execute a Code Behind method, but I don't know how. The client wants this menu control, but it only has a "OnClickScript" to work with.
Should have made my first post clearer... my bad.
I had know idea the downloading is so simple... thought I would have to write some special method or something.
I've only been working with ASP for about 3 months now.
Mahesh ChandPosted Jun 20, 2008, 10:46 AM
I am not sure why you are using JavaScript to add and remove items. The way I would do is, simply have a menu or button for Add and Remove separately and have codebehind code to add and remove items and probably show items in a ListBox or GridView or whatever control fits for the UI.
If you still want to use JavaScript, here is an example how you can use JavaScript and access your page controls in it:
http://www.c-sharpcorner.com/UploadFile/purankaushal/103222006013805AM/1.aspx?ArticleID=10c0cce3-e00f-4dad-9ddb-df0c669afd6c
You can use Session state to transfer values between pages. For example, you can store all items from your Page1 to an ArrayList (if you have multiple items), put that in a session variable, and access that ArrayList back on the second page.
Here is one article on Session state and search the site for session state to get more results:
http://www.c-sharpcorner.com/UploadFile/ganesh.nataraj/ASPdotNETSessionState09212005235624PM/ASPdotNETSessionState.aspx
To add downloads of PDF files, just add links and link the PDF files. As soon user will clock on the links, download will start automatically.