how to reduce web page size with many select controls - asp.net

I'm working on an asp.net application that allows the user to update data for a series of days. The data is presented as a table:
Date - Active - Active Promotion
04/11/11 - yes - listbox with 360 entries
05/11/11- yes - listbox with 360 entries
06/11/11 - yes - listbox with 360 entries
...
04/02/12 - yes - listbox with 360 entries
Now, the table can have from 90-700 rows (eg allow entry for 90-700 days) and the select box has 360 entries (12,000 characters). So, for a 3 month display, I get the page size of 90 * 12,000 = 1MB and this increases to 8.4MB for a 2 year display.
I can see that the problem is the many repeated listbox . I have thought of the following approaches, perhaps people can suggest improvements or refinements:
Have each listbox populate itself when clicked (reduces initial page size but user may have to wait for drop down to populate)
Have one 'real' listbox and many 'fake' listbox . when the user clicks on a 'fake' listbox the 'real' listbox is then displayed, the selected value is then stored in a hidden field
get the client to cleanup the data so there aren't 300+ options in each box

If the options are the same for every listbox, I would definitely suggest auto-populate with javascript on clicking. I've used this solution before for exactly the same reason, and there is no perceptible delay in popping up the select list, and the original page loads way faster.
Also Firefox used to have a bug when handling lots of large select elements, and the javascript populate when necessary solution also sidestepped that.

I would go with something like the second option. What you can also do is to populate the first one initially, and then copy the contents to others using JavaScript.
But otherwise - seems you got some usability problems to solve, who's gonna use such monster forms!? :)

I would limit input to one month at a time and store it in memory until ready to complete the transaction back to the DB. I would also review choice of control for this, that is, instead of a listbox think of something more intuitive; possibly a calendar with text boxes - you could use tabs and move from one month to the next.

Related

How to store user responses on-the-fly temporarily for later use?

I am looking for the best way to store information that is entered within an Oracle ApEx app that is sectioned off like a wizard.
Basically there are a number of fields on the screen, i.e. text box, text area, select list, checkboxes as well as radiogroup buttons but are not attached to any particular database tables.
What I would like to do is basically have the user enter required answers say on one pane, which might have 5 items in total, i.e., 2 textfields, 1 radiogroup, 1 selectlist and 1 checkbox and when they press the "Next>" button before going to the next pane, store these answers into a ApEx Collection against a particular Id and perform the same process on the following pane of answers entered.
I am using Oracle ApEx 4.1.2. Basically want to store away values on the fly and reuse at a later stage.
As I mentioned in my last comment above, Plouf came through with the goods. I didn't require an ApEx Collection after all - regular items did the trick.

Need suggestions Asp.Net DropDown LIist Filtering

3262 Points
662 Posts
Need suggestions
17 hours, 13 minutes ago|LINK
I have an insert data page, having a drop down on the page items are filling from SQL Data Source (using code behind)
I need to apply some filter to chop out certain values from Drop Down (user will select some radio buttons and then
apply the filter, when filter applies, it will remove the unwanted items from drop down)
Now I dont know what is best procedure, I have done:
1) Using AJAX update panel, so when the user clicks on Apply, I am re-generating query and re-binding the drop down list)
so it involves server round trip, every time user clicks on apply button.
The best thing about this is, if user wants to insert records one by one, then user does not have to apply filter agian and again
(once applied it will only show the filtered values after each record insertion)
2) Using client side javascript i have achieved the same but big problem here is that
once a record is inserted, the page will refresh, and thus the drop down will show all the UN-Filtered values again
I need suggestions on which techinque I should follow in this regard, plz help
Using ajax is the best option, but in sql you create a stored procedure, so that it might reduce the time of regenerating query.

asp.net + Binding DataSet to already bounded Listview

Basically what I want to achieve here is to show more items in batches just like the YouTube comments session in every vid, about 10 comments shows up for the start with a "Show More" button below which loads additional comments in batches of 10 when clicked upon. Anyone has a clue of how to go about this?
Not sure if this is right but what I intend to do now is to bind additional records to my Listview again with DataSets without extracting the data that has already been bonded.
Currently I am binding my first set of records with a Dataset filled with data from my SQL Server like this:
DataSet ds = activityBll.GetActivityAttendees(activityId);
DataTable dt = ds.Tables[0];
uilvEventParticipants.DataSource = dt;
uilvEventParticipants.DataBind();
The simplest way to do this would be to do as you suggest, and just keep getting more records from farther and farther in the past. You'll experience increasing delays as you rebind, and if you allow users to make changes to comments you'll have to do a huge postback to process those. If you go this way you should look at UpdatePanels.
The most elegant would involve jQuery or a similar Ajax technology to fetch additional records and add them to the bottom of an HTML table (not necessarily a ListView) without refreshing the page. There are quite a few questions on this board about doing that.

Two tables on one page Asp.Net

My project is in Asp.Net Webforms using C#.
On one of my web pages, I want to have two tables. One is going to be a summary table and the other a more detailed breakdown of the summary. When the user clicks on one of the rows of the summary table, I want the corresponding breakdown rows to appear in the breakdown table.
These tables can have anything between 60 and about 500 rows.
I have thought of two possible ways of doing this and I'm not sure which is best, or if there is another, better way of implementing this:
1) When a user clicks on one of the rows in the first table, a postback event happens, and the data for the second table is loaded from the code behind.
2) When the webpage is loaded for the first time, both tables are filled with all of the possible data, but all of the rows in the second table have the "display: none;" CSS attribute. When a user clicks on a summary row, the CSS of the corresponding breakdown rows is changed using JavaScript.
I'd go with your first thought and perhaps either
load the data for the second table through an AJAX request returning only row data in JSON (or maybe even the HTML for the table)
use an UpdatePanel
if the user only needs to view the data, I would go for the former, but if they need to edit the data in some way, I would probably choose the latter (even though I'm aware that UpdatePanels are effectively a full postback in async clothing, I feel their use can make the UI more fluid).
You could also make an AJAX call when the user clicks on a row in the summary table to return the data for the 2nd table.
second way no way, loading all of data and then hiding showing is not a good idea, it will be slow and if you add more functionality it will only get in your way...
I recommend this two approaches:
1)first table with pagination
click on row triggers ajax call to page method
page method return second table
here, you can see how to that:
http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/
2)using of uframe
http://labs.omaralzabir.com/UFrame2005/
cheers

Easiest method to build where clause from checked items in DataList of PreviousPage

I have a selection list that is generated dynamically, it lists a number of checkboxes that are based on an end-user editable table, as such I have no idea what data, or how much, might be contained in this table and how many checkboxes or what they might contain, other than the primary keys of the table.
The user will select the checks they wish to see, and then control is passed to another page via PostBackUrl. The second page has to figure out which records to show (build it's where clause) based on the checkboxes checked in the previous page.
So, my problem is several-fold. First, asp:CheckBoxes don't have values. This can be worked around by a number of methods. Right now, i'm using a placeholder and dynamically creating the checkboxes in the ItemDataBound event of the DataList. I set the ID to "CheckboxKey1Key2" (where Key1 and Key2 are the primary keys of the check items).
Second, I have to walk through the controls of the PreviousPage to dig out all these values. That in itself is also a pain, but doable.
Now, my thinking is to build the where clause of my Linq2Sql query based on the keys I got from decoding the checked checkbox names. This all seems like a lot of jumping through hoops for something that shouldn't be this difficult. Am I missing something? Does anyone have any better solutions?
Make a class with a structure for your values that will be useful and easy for you to use on the result page. Then when the user clicks whatever it is they click to go to the result page, loop through the DataList, create a collection from the checked items, and you will only need to grab one object instead of everything, when you need to format your query.
Then when you get to the result page, loop through the collection and build the query in the loop. Pretty easy and not much code.

Resources