I'm needing to create a new page in my project in csharp on asp.net
The logic is for me to do calculations. When i do these calculations they need to show on a different page.
Lets say I add or subtract 5 on page one, it needs to show on the next page that I've added 5 with the new result on.
How do I do this
I've tried using a QueryString, but that's not helping me
Related
I have a page on which user select a date range and submit the form. I am picking data as per date range and then binding it to the gridview. Since I have to also generate pdf just after binding I am using response.write to write the generated pdf file to the user. But the problem is that the gridview never changes. The moment I stops execution after gridbind(return;), the gridview binds properly. After struggling for some time i found out it is happining due to response.write and response.end statement which is used for writing the file.
My question is how to do these two task back to back? so that when user submit the form he sees the gridview with all data and also the file gets downloaded.
right now after gridbinding I generate 1 more link to the generated pdf but the client wants that it should be done in one go instead of 2 .
you can achieve this using two ways
show your data to user and set interval in javascript lets say wait for 1 min and then postback page to download PDF.
(RECOMMENDED)create another page say FileDownloader.aspx and open that page in new window using javascript. you can share your data between pages using session, disk, db whatever suits you best.
My problem here is the following :
i am developing a website where Lecturers are supposed to create Course Pages for every course they give in the Uni. so i don't know how i will take the values like the course name for example from the course creating page and create a content.aspx with these values which have the same layout or Design as the master page .. any suggestions ?? ( i mean in each time a Lecturer enter and create a page i want to Create a .aspx container which have the same layout as Master class )
Do not create a single page for each course, but load the content from a database. So you have a page with Querystring e.g. ~/course.aspx?courseid=123. In Page_Load you can fetch the course name from the database and assign it to a Textbox or Label.
This is somewhat related to my previous printing question re: remote printing, which I resolved with help here at work. This new situation likely has a simple answer as well, but I have yet to discover it.
To simplify, I have two webpages written in ASP.NET with C# codebehind, which we can call page1.aspx and page2.aspx.
The first page, page1.aspx, is a simple search tool that opens a database and returns a list of reports matching the search criteria into a gridview. The second page, page2.aspx, displays a report in the web browser, given the report ID as a query variable (which I have working). This page is also pre-formatted to be printer friendly.
On page1.aspx, in my gridview, I have two buttons for each row labeled "View" and "Print". The "View" button will retrieve the appropriate order number for the corresponding row, and page2.aspx will load the report based on the order number (again passed as a query variable).
For the "Print" button, however, I would like to print. That is, when the user clicks the button, instead of the page loading onto the screen, I would like for the Print dialog to pop up and allow the user to print the report directly to the printer (since they are able to view the report using the separate button if they should so desire).
I would load page2 into an iframe, probably separately and have the page call a JavaScript print when loaded, or call focus on the iframe and then print on the same object.
You could load the page with a new call, or just load it when page1 loads in the background.
You would, of course, make the iframe hidden from view.
I can do this in Javascript by pulling a series of thumbnails as an array. Then I know when I'm on the first photo, or the last, and can show controls based on that.
How can this efficiently be done on the server side using C#/ASP.NET MVC 3(razor)? For example, on my site here, is one photo, out of 19 photos. I'd like to add next/prev functionality.
Do I have to pull the entire array of photos, parse out the current photo, determine if it's first or last, then build next/prev buttons?
When there is a photo gallery, there is One photo from many photos, and when there is a concept like x items from y items in which x < y, then we all think of paging. Photo gallery is almost like a grid with one item and two buttons for going to the next page and previous page. If you want to implement paging by yourself, there is no need to fetch all photos and compare them to the current photo to create next/previous buttons. All you have to do, is to cache current item index and the count of all photos, and on each rendering, calculate to see if you need to render next, previous, or next and previous buttons.
Making one complete page load per image is inefficient, slow and will send your visitors away of your site quickly.
I have recently creating a decently fast ASP.NET MVC photo gallery using the following techniques:
When the visitor clicks on a certain folder an ajax request is sent to the server requesting the folder's thumbnail collection (the data is returned in JSON format)
The thumbnails and other UI components are rendered using a model view view-model framework called Knockout.js (btw, it is great!). The information retrieved from the server is passed directly to the knockout binding model in JSON format, so you don't have to do any serialization or marshalling.
When the user clicks on a certain thumbnail, an ajax call is issued to the server, to retrieve a JSON object containing the image information: a) the main image URL c) next and prev images (if any) d) exif information c) comments for that image, etc.
Knockout.js knows how to render the prev and next arrows (if any), and all the other information to the UI view-model, so they refresh automatically.
If you combine that with some server side caching, you'll have a pretty fast photo gallery application.
Cheers!!
iván
You didn't specify a client technology, Silverlight, ASP.NET MVC, ASP.NET Webforms, WPF, Winforms..
The concept is as follows.
Choose a client /presentation technology
Decide where the photos are going to come from (Database, Webservice (Infront of a database)
Create methods to get next and previous photos for a specific series (Album, User, Globally)
Call these methods on a Forward or Backward (button/image) click.
You can get this going in several ways:
Create an aspx page which gets the first photo and create buttons that call this same aspx page, but with a query string of the next or prev photo, as needed. This solution will cause postbacks, so you need to decide if this works for you or not.
Create an aspx page which gets you a photo based on the query string and call it via jQuery ajax.
Create an ASHX file which returns a different image for a query string parameter and make it the SRC for the image.
These three methods allow you different levels of interactivity vs. postback. If you decide which route you would like to take, we can help you get there :)
I don't know why you go for this in C#. While doing it in C# i will use ajax call. For this i will load only the first image and Total image count initially.
According to the total count and current image no show the prev and next button.
On clicking the next and prev button take the corresponding image from db using ajax call.
I dont know how to use but there are many jquery plugins to show gallery
I'm new, building a practice project in C# and ASP.NET. Have a checkbox list with 7 insurance products; when a user selects a product, I need to bring up a new window where they can customize this product. What is the simplest way to do this?
To open a new window, you need client-side javascript (window.open).
EDIT
in response to the submit of the list, generate some script statements (see RegisterStartupScript).
But are you really sure that this is what you want: open a handful of new windows?
A different approach would be to remember that list server-side (in Session) and handle those products one-by-one.
EDIT
You could have a redirect page: as long as there are items in the list, take&remove the first one and show the page for that. When that page is finished, redirect back yo the redirect page. When the list is done, go back to the list (or whatever).