Posting Panels Twice (Understanding pre-init) - vb.net

I have a page that dynamically builds a group of Panels based on a SQL call.
Here is an example of what I am trying to accomplish.
When the page is first loaded several Panels are dynamically built. Lets say there is one panel for each State: CA, NJ, FL, etc.
If a user clicks on one of the panels (ie. one of the states) a SQL call is made and brings back a list of cities within that state. The page then dynamically builds the panels only this time listing the cities within the state clicked. When the user clicks on of the cities it calls SQL and find all of the schools listed in that city and displays them in panels (again one school per panel).
What's Happening
When the states are loaded they display fine. Though when the user clicks a particular state the page reloads and then displays all of states and all of the cities after listing all of the states instead of just listing the cities.
The proper cities are being listed so the SQL call is working.
Solution
I know several things.
ViewState is remembering the panels previously created and loading them
or
When I step through the code it's loading both the states and then the cities.
Dynamic controls are handed during the pre-init stage of the life-cycle.
Question
How can I solve this problem? I didn't post any relevant code because there is a decent amount of it to sift though. If parts of it are needed / wanted ask and I can edit this post.
I have already searched though Microsoft's documentation and the like so please don't post links to those unless you are fairly certain they will help with the issue.

Related

Track clicks on a button based on preceding button clicks

I need to track clicks on a button at the end of a sequence of selections. As shown in the image, there are five different business plans (circled in red), and each plan can be for three different years (highlighted in blue). The user will checkbox a business plan type (e.g., market trend) and click a year (e.g., 2017), then click the PDF button (highlighted in black) to download that particular plan (market trend for 2017 in this case).
So instead of counting the total clicks of PDF downloads, the task is to count how many times a particular plan is downloaded based on the plan type and year.
The PDF button, the checkbox for each plan type, and the click button for each year all can be tracked individually. They are also all on the same URL.
GTM and GA are used for tracking. Can anyone share some thoughts of how to achieve this type of tracking?
Thanks!
Yao
If you are using google tag manager you can use dataLayer.push() to push to an array which can be used to differentiate the clicks based on the interaction.
Approach is described here
Google Analytics custom dimensions
In your particular case you could have the dataLayer configured to add the different key / values for the different report components and then the trigger will be configured to fire when the download button is clicked.
For example on each of the check boxes you could have:
<input type="checkbox" onclick="dataLayer.push({'plan_component': 'Market Trends'});">
You'd probably better having an array to store this info.
The resultant data can be viewed or aggregated via a custom report download. Described here.
Custom Dimensions and Metrics
It can be a bit tricky to understand and you'll need to change the site so that the dataLayer gets populated with the requisite data but this is the way to go. Best of luck.

Need form in located in a SharePoint 2010 InfoPath web part to retain data submitted at the same time

I have created a form for use during a meeting. Multiple people need to click approve at the same time. The issue is if they all are in the form at the same time, it is only going to keep the last approval and resets the fields the others have approved... as there approval was not there when the form was opened. I guess I should have seen this coming. Is there anything I can do?
Use two lists with a parent/child relationship.
You need a master list with a unique ID and a detail list where the Master ID is assigned to the new list items to define the relationship. In the Master List you can customize the display form to contain a list view of the related items in the Detail list and a link to add new items to that detail list. A little bit of JavaScript will ensure that a new item in the Detail list gets the Master item's ID assigned automatically.
Clear as mud? The SharePoint Hillbilly has a video tutorial for 2007 and 2010.
If you go through the material (the 2007 stuff is good to understand the approach), you'll find that there are two techniques, one using SharePoint Designer, the other one without SPD.
Back to your meeting: Before the meeting, create an item in the Master list. Everybody can see the item on their screen and click to create a related item in the Detail list. They can all save their related item at the same time, since these are individual list items in the Detail list. Refresh the display view of the Master list item to see everybody's replies.

Get Geolocations from SQL database to be used in Bing Maps

Basically I have a set of geolocations and other information corresponding to each point in a table in a SQL database. I have a Bing Maps website with checkboxes to set different filters for which geolocation pins should be displayed. I'm basically wondering how I can most efficiently query the database and update pins on a map, based on given checkboxes.
Alternatively, as requerying may be expensive as the table size increases, how could I load the entire database and only display certain pins based on the selected checkbox filters?
When researching this I found answers regarding GeoRSS files, but those solutions are specific to points that are all loading at once and that will continue to stay in view. It doesn't seem like filters can be applied in this process (without further requerying).
EDIT: When I say 'filters' I'm basically talking about narrowing down the currently displayed pins by things like the date the geolocation was recorded, and various other things that will use checkboxes. Let's say I have a list of restaurants and they each have their ID, geolocation, date added (to the database), and a foreign key for their type of food. I'd like to be able to select through the available food-types to limit results to Italian and Mexican restaurants but still provide the functionality of showing Chinese restaurants with the click of a button.
And to make it easy, I'll initially take all database entries in.
You could use an SSRS Report with a Map Control to display the info on a Bing Map. That way you can use an expression in the "hidden" property of the marker to determine whether or not to show the pushpin and map your checkboxes to parameters.
See
http://technet.microsoft.com/en-us/library/ee240845.aspx for using a map control.
If SharePoint is an option you can have a completely interactive experience with PowerView.
Here is an introduction http://office.microsoft.com/en-gb/sharepoint-help/maps-in-power-view-HA103005792.aspx

User interface choice for managing an "orders" table

I'm using VB Net, but this is entirely a question about user interface, not coding.
I want to "manage" a table of "orders." Orders is a typical table with a foreign key pointing to a customer, and a one-to-many relationship with a "details" table. To manage orders means to enter new orders, add details to orders, record payments, print a list of orders, cancel orders, mark orders shipped, print one order, etc., etc. These tasks can be divided into tasks that affect single orders (cancel an order) and tasks that affect multiple orders (print a list of orders).
That task division led me to this user interface: present a form/window that displays by default a list of orders, and provide a button that switches the view from list mode to single-order mode. Each mode then provides the buttons for its tasks.
I first implemented this with panels, putting the controls for each view into its own panel, and then superimposing the panels. I then use hide and show methods to switch between panels, effectively switching between views. It works, but meh...
Would it be better to use a tabbed control, and put each view on its own tab? I'm not trying to re-invent any wheels. I know nobody gets fired for making it look like a Microsoft app. LOL :) But I haven't seen any retail applications to copy from.
I'd argue that your "multiple panels" approach IS tabs, just without the tab part. In reality, tab controls do basically what you've already done with code, they just hide that behind a convenient design time facade.
Still, it's the same thing.
E James answer is pretty good. Would it make sense to put both on screen at a time? is this a touch screen app or a traditional windows app? How sophisticated is the target user?
Those are a few questions that should drive how complex you let the screen get.
Do you have room to show the list and all of the possible controls? If so, I would start with all controls disabled. When you select a single order, only the single order controls would be enabled, and when you select multiple orders, only the multiple orders controls would be enabled.
I would also put the most common tasks right into the list, if possible, so that only one click is required for frequent tasks.

Silverlight 4 datagrid printing

I have a Silverlight 4 app with RIA services. It's based on Tim Heuer's video and I have pretty much the same setup.
I have a DomainDataSource, a set of DomainDataSource.FilterDescriptors, a Datagrid which display 15 items per page with the help of a DataPager. When the user enters their filtering options, the datagrid updates accordingly but is still multiple pages which is okay for viewing on screen. I want to implement a print function that essentially prints the datagrid but all items at once and on multiple pages, if need be.
I have played around with printing basics and I can print the datagrid as it is exactly displayed on screen but I want to be able to print all items.
I'm not finding any good examples on the web. Can anyone suggest an approach to tackle this?
Thanks
Edit:
Not sure how helpful it's going to be but here's the XAML outline.
So one problem will be that when the user says they want to print, you'll presumably then want to ensure all the data is on the client (by executing some larger query), but let's assume you've taken care of that and have all the data on the clien and just want to focus on printing now.
In that case, I'd point you to David Poll's excellent additional printing helpers ( blog post here : http://www.davidpoll.com/2010/04/16/making-printing-easier-in-silverlight-4/ ). He provides a library (with full source) that basically takes an ItemsControl (or lots of other things, but ItemsControl is particularly relevant here) and paginates it automatically.
So you'd create a separate UserControl that has a "print view" of your data, which contains a DataGrid not limited to 15 items, removes paging UI, and basically gets everything "print-ready" (sort of like a print CSS sheet if you're familiar with that concept). Just point his library at that print view of your data, with all the data already on the client, and you should be just about all set.