ASP.NET webforms physical site structure with dynamic site map - asp.net

I am having a little difficulty trying to wrap my head around site structures.
I have quite a large asp.net site, for which:
Admins can see a user list, Each user can have many accounts, and for each account can have many items.
I can picture this as a breadcrumb trail of editing a particular item.
User List > Mr Bob > Accounts > BOB77 > Items > Item32 > Edit
User List = All the users
Mr Bob = A user the administrator has selected from the User List
Accounts = A list of the user's accounts
12BOB = The administrator has selected the account named 12BOB
Items = A list of the items an account contains
Item32 = The item that the administrator selected
Edit = The action that the administrator wants to do
I can picture how this would look like if it was using ASP.NET MVC with the URL, but I am unsure how to map this out using Webforms, and in the physical filesystem.
This is what I have thought up about how I am guessing the physical structure would look like. Will this have to use session variables to achieve what I am trying to do?
/Users/User/Edit.aspx <- for editing a user
/Users/User/View.aspx <- for viewing a user
/Users/User/Accounts/Default.aspx <- for viewing all accounts
/Users/User/Accounts/Account/View.aspx <- for viewing an account
/Users/User/Accounts/Account/Edit.aspx <- for editing an account
/Users/User/Accounts/Account/Items/Default.aspx <- for viewing all items in an account
/Users/User/Accounts/Account/Items/Item/Edit.aspx <- for editing an item
Where can I read more about this kind of setup in a web application? Or, can someone point me in the direction of an available project that has this kind of layout?
Thanks

This seems simple, but when you want to lay out the logical structure and you're considering every element to the structure, it becomes very unclear.
This is the url format I came up with. This uses query strings instead of Session variables.
Query strings are used as parameters.
Using this format I was able to make a sitemap provider which interpreted the values of the querystring and replaced the names of nodes for that page.
User/Edit.aspx?UserID=11111
User/Account/Default.aspx?UserID=11111
User/Account/Edit.aspx?UserID=111&AccountID=54353
User/Account/Item/Edit.aspx?UserID=3333&AccountID=43243&ItemID=432432
I hope this helps you, if you are in a similar situation to what I was.

Related

Creating user WantList and WantToSellList in Buddypress / Wordpress

I’m working on a site cataloging recording artists and their releases. It is hosted on Siteground and posted with Wordpress. It is a wordpress database.
We catalog records, all the way down to the specific version of each release (each version is a post). I'm currently using buddypress to create the user accounts and etc.
https://staging3.recordcollectorsoftheworldunite.com/release/like-a-virgin-3/
Here’s an example of a release page. Each version is uploaded as a post. Custom post type->album (is one example). Currently I have buttons (they don’t do anything) in each version’s foreach loop that say “WANT” “HAVE” “SELL”.
I want these buttons to add to the user's WantList, HaveList, and WantToSellList. These will be unique arrays for each user.
I'm thinking the best way would be to create new column in the album's entry in the database called this_user_wants_this, _has_this, _wants_to_sell_this, etc. That column would be a dynamic column that each user's profile would fill in? Each user would have an entirely different list of wants and haves and wants-to-sells.
Here’s what I want to do in English.
If user is logged in and presses the WANT button on this_post(), Change this post’s row “want_this_item” to ‘1’ for this_user only.
if “want_this_item” == 1, change “want_this_item” back to 0.
I don’t understand the language of what I would need to write out. How do I create the field for “want_this_item”, and then what code do I need to modify it?
I've tried creating an x_profile_field in buddypress, is there something to this? I still don't exactly understand how to modify that with the buttons.
Thanks so much!

Wordpress | generate unique link

I am turning to Stackoverflow community for a need of critical advice.
It's simple, I want a person to generate a link... and that link will have a button where whoever it is sent to, that person can click yes/no - then return the value.
user 1 > generate link > user 2 > options > return option to user 1
Please can anyone point me in the right direction?
Thanks very much!
All the code you need is in wp-login.php
Generate unique URL (for password reset)
Email URL (or you could just display it)
Set user profile metadata (so you can track it)
If you want to track individual users, then you can either generate a unique url per user, per authored page or perhaps simpler is generate one unique url per page, but check that the user is logged when the unique link is clicked.
Either way you can use that to prevent multiple votes etc

Selecting Sql Data Source Column Value to Variable (VB.NET)

I have a SqlDataSource, defined in the Master Page, that gets the current user permissions for the web application Select * from portal_users where userid = #userid, where portal_users is a view i built with all the data needed. I need to access the contents on the returned row so I can disable/enable site features according to the user permissions. This results in a lot of if blocks across the child pages to do it.
I browsed around forums and I only found issues about assigning those values to controls like i.e. label. Is there a way to access the SqlDataSource from the Master Page, get the row that is returned, select 1 or more column's values and assign them to variables?
Hy
It's not a good idea, use Master Page to share Data Source connections
Read this post to help you:
http://forums.asp.net/t/1188088.aspx?sql+data+source+in+Master+Page
Regards

Google Analytics custom dimension vs new users

We have multiple e-learning modules under one domain.
We want to know how many new users start each module over a set period of time e.g.
trainingDomain.com/module01 > 4 new starts
trainingDomain.com/module02 > 2 new starts
trainingDomain.com/module03 > 5 new starts
The metric that seems to best fit new starts is new users by module.
We have tried various approaches but no success so far. I suspect we are misunderstanding something conceptual.
Each page in a module saves a moduleID to a custom dimension i.e. click scope. If we create a custom report with new users as the metric and moduleID as the primary dimension, only the first module visited registers in the report.
Does anyone have a suggestion of a better way we can approach this or a way to tweak the current approach to work? I'm really struggling to get my tiny brain around this...
Many thanks!
Actually, custom dimension is redundantly for your purpose.
Create a page content group with your modules. Then create a custom report with the new users as metric, page as a dimension and filter by your content group.

Auto-Incrementation in InfoPath 2010 Form

I have a form in which I am attaching a workflow to. The form has a number that will be auto-generated. For example the first number will be 1, the next time the form is opened the number should be 2, so on and so forth. The issue I am having is: in the Default Value under the Text Box Properties I have the Value as: count(mynumber QuoteNumber) +1. When the form is generated the first and only number is 2 the number begins at 2 and never increases. Can someone help me with this or explain what I may be doing wrong? Thank You. I'm not using visual studio.
Rachel: I have fought with this problem since InfoPath 2007. Here is how I do it.
Since you say you are attaching a workflow, I assume you are using the from in SharePoint.
1 - create your form library in SharePoint
2 - use InfoPath to design the form. When you publish the form to SP, make sure you promote AT LEAST the ID field you want to auto-inc. (I usually promote every field in my forms, 'cause I like to use them like SP lists.)
3 - In SP, create one new form and manually set the ID field to the starting number for your form series.
4 - return to InfoPath designer and re-open your form template.
5 - create a new data source to receive data from your SP form library and specify your form library as the source, and the ID field as a data element. Name the data source something like “ID Lookup”.
6 - open the properties of the field you want to auto-inc on your form and, in the default value box, select function, then choose the MAX function.
And add “+1” after the function to increment by 1.
Now, double-click in the field are of the Max function. You will see a dialog showing your form fields. Notice the drop-down at the top of the dialog – here you can choose the data source (notice I named mine “sales Contracts” in this example). If you select the data source you created in step 5, you will see a dialog showing you a couple of data branches.
Expand the ‘dataFields’ branch until you see the field you want to auto-inc. Click on this.
Your formula dialog will look something like:
max(ID_X0020) + 1
With your field name instead of the 'ID' in the Max function – the function will now return the Maximum value of the field IN THE FORM LIBRARY, plus 1.
Save the form in InfoPath and try previewing it. You will probably get a security warning – your InfoPath form is grabbing data from your SharePoint library on the fly. You may even get asked to re-enter your password (I usually do). When the new, blank form is displayed in InfoPath preview, you should see you ID field filled in with a value one greater that the number in that field of your SP library.
There is one huge Gothca with this method - if users re-open a completed form to edit it, the formula will probably try to replace the ID number. If your users don't edit the forms after they are submitted, the this will work for you.
Hope this makes sense.
You aren't doing anything wrong - you just have to change how you think about "forms" a bit. Remember a form is just like a word document template. Suppose you save a word document on your hard drive with a blank spot to fill in your name. Later you open the template, type your name, and save a copy as V1.doc. When you go back and open the template again - your name is not there because it was saved in V1.doc. Everytime you open the template you start again from scratch.
Infopath forms that you design and that the user fills out are templates (.xsn files). When the user fills it out and saves it they are really saving a copy which is only data (.xml files). The .xsn template doesn't change when users interact with it.
So to answer your question - there is no way directly in InfoPath to cleanly keep track of an auto incrementing ID. You will need to tap into some code (webservice, sharepoint, etc) to do that. You could also consider making the ID a GUID (which infopath does support) but it won't be auto incrementing and it won't look "clean" if it has to be displayed/used by real people.

Resources