Similar to Page Load Event - MVC - asp.net-mvc

I want to display a list in a div when the view is loaded. I am new to MVC
and I don't know where or how to do it. I know I Need to do HTTP POST but how?
Thank you for your help.
<div class="form-group">
<div class="online">
</div>
</div>
A nudge to the right direction would help me. Thank you

Related

Umbraco 7 - How to allow users to add new content fields on-the-fly?

I'm setting up Umbraco 7.7 for the first time and creating the document types and templates for a page that displays the people that work at our organization (includes their names, photos, and bios).
How do I configure it such that the content manager can add another "person"—effectively a cluster of divs with user-editable images and text—without having to manually add another "person" to the template? Using Partial Views seems like part of the solution, but I'm unclear on how to fit it all together.
My template (simplified) currently looks something to the effect of:
#inherits Umbraco.Web.Mvc.UmbracoTemplatePage
#{
Layout = null;
}
<!doctype html>
<html>
<body>
<div class="person-bio">
<img src="/media/person-01-photo.jpg">
<p>#Umbraco.Field("person-01-name")</p>
<p>#Umbraco.Field("person-01-title")</p>
<p>#Umbraco.Field("person-01-bio")</p>
</div>
<div class="person-bio">
<img src="/media/person-02-photo.jpg">
<p>#Umbraco.Field("person-02-name")</p>
<p>#Umbraco.Field("person-02-title")</p>
<p>#Umbraco.Field("person-02-bio")</p>
</div>
<div class="person-bio">
<img src="/media/person-03-photo.jpg">
<p>#Umbraco.Field("person-03-name")</p>
<p>#Umbraco.Field("person-03-title")</p>
<p>#Umbraco.Field("person-03-bio")</p>
</div>
<!-- etc., etc. -->
</body>
</html>
Thank you! Any help would be much appreciated.
You'll probably will want to use the Nested Content control for this. It allows you to add a list of entities (in your case persons) on a document
More documentation about the nested content control can be found here: https://our.umbraco.com/documentation/getting-started/backoffice/Property-Editors/Built-in-Property-Editors/Nested-Content
So from my understanding you don't need a partial view. If it's that simple and you want to output only the div I see you're repeating, then loop it:
#foreach (var person in whateverYourCollectionIs) {
<div class="person-bio">
<img src="/media/person-01-photo.jpg">
<p>#person.GetPropertyValue<string>("pseudoNameFieldAlias")</p>
<p>#person.GetPropertyValue<string>("pseudoTitleFieldAlias")</p>
<p>#person.GetPropertyValue<string>("pseudoBioFieldAlias")</p>
</div>
}
That loop will create the exact same html for each person, but with the appropriate names, Titles, Bio etc. This is not the actual code you get to use but it hopefully leads you to the correct direction.
This is the documentation that will help

Using Bootstrap, how do I create 2 columns for content? - example included

I am new to using Bootstrap and want to create a responsive layout that has 2 columns side by side for my posts. Example
I want to achieve the 2 column arrangement seen under Portfolio. I have looked at the source and see various classes that don't seem to be included in the standard Bootstrap. I am using the Bootstrap version included with an MVC6 project in VS2013. Any help or a nudge in the right direction is appreciated.
My attempt to date causes this to occur. I end up with the gap.
Here my MVC code that causes the gaps to occur:
<div class="container">
#For Each item In Model.ToList
#<div class="col-md-6">
<div class="item">
<div class="content">
#Html.Raw(GetImageHelper.getImage(True, item.PostSummary))
<h3>
#item.PostTitle
</h3>
#Html.Raw(item.PostSummary.StripStyle)
</div>
</div>
</div>
Next
</div>
Thank you
It looks like you didn't use clearing properly. My solution for that issue is to use bootstrap row class. Following example also supports responsiveness:
<div class="row">
<div class="col-md-6 col-xs-12"></div>
<div class="col-md-6 col-xs-12"></div>
</div>
<div class="row">
<div class="col-md-6 col-xs-12"></div>
<div class="col-md-6 col-xs-12"></div>
</div>
...
This is an unequal height problem. Float tries to fill the available area as much as possible, but when you have one column that's taller than another, it knocks the next float object off to the right a little. While #luke is right that you can clear each row to solve the problem, that also kills your site's responsiveness, as now you can only have two or less per row. For this particular example, that may not be a problem. You've got an initially even number of columns and for very small screens you can just scale down to one per row. In other situations, though, such as wanting to have three per row perhaps in nice wide-screen displays, you'd be out of luck.
You might want to take a look at the article, Bootstrap 3 Responsive Columns of Same Height, on Minimit.

Show/Hide multiple, layered jQuery UI widgets

I'm new to all this so please bear with me.
I've been using some jQuery UI widgets and I'm wanting to create category (adults) radio buttons with their own set of subcategories (children) that only appear when the appropriate adult is selected.
Here's the code I have so far: http://jsfiddle.net/99azd/
The problem is only the formatting of the initial set of children work, the others show up as plain checkboxes. I think it has something to do with the div id="format" but I'm not sure.
<div style="display: none;" id="Adult1Children">
<div id="format">
<input type="checkbox" id="child1" value="child1"/><label for="child1">child1</label>
<input type="checkbox" id="child2" value="child2"/><label for="child2">child2</label>
</div>
</div>
Got some help from the IRC channel - here's the fixed code:
http://jsfiddle.net/w6qFC/
I had a duplicated id "format" so it only ran the first one. All I had to do was change the id to a class instead and then in the js change from #format to .format. Simple.
$( ".format" ).buttonset();
and
<div class="format">

Can I simplify this code with an HTML Helper?

I have the following code on my web pages:
<div class="rep_tb0" id="Activity" style="display:none;">
<div class="rep_tr0">
<div class="rep_td0" id="ActivityLog">Activity Log<br /><br /></div>
</div>
</div>
It's repeated for many pages and I would like to just code it once in one place. Can anyone tell me what are my options for doing this. Can I code an HTML Helper or is there a better / another way of doing this?
I think you need to use a partial in this case. Just create a .cshtml file and put that code in. Then call
#Html.Partial("PartialName");
Yes, build an HTML helper by creating an extension method. It's a lot easier than you think.
Check out this article:
http://weblogs.asp.net/jgalloway/archive/2011/03/23/comparing-mvc-3-helpers-using-extension-methods-and-declarative-razor-helper.aspx
Or this article:
http://www.asp.net/mvc/tutorials/creating-custom-html-helpers-cs

Can Struts 2 handle 3 action class calls at the same time

I am using ajax to load 3 jsps in a master page but the problem is it loads one after the other? I wanted to know if struts 2 can handle 3 action class calls at the same time? Or is it even possible to make such calls? My page is getting slow because of this, is there any other way to handle this?
<div id="content">
<div class="col1">
<div id="content_right">
<div class="curved section_content">
<div id="sub_header" class="curved_top">
<h2>
<s:text name="ft.history.title.details" />
</h2>
</div>
<sj:div cssClass="ajaxDiv" href="transferdetailhistory"
id="transfer_detail_content">
<div class="ajaxSection">
<div class="centeredAjaxSection">
<center>
<img style="vertical-align: middle;" alt="Loading"
src="${pageContext.request.contextPath}/img/bigindicator.gif">
</center>
</div>
</d‌​iv>
</sj:div>
</div>
</div>
</div>
this would load the history page, like wise i load 2 more jsps
Struts2 can handle significantly more than three simultaneous requests. There are many large, scalable applications using the Struts2 framework.
The issue is most likely related to your code.
we are in our application using such cases in every now and than and never faced problem with this.
better come up with some code may be problem with your code or some configuration as Steven said in his repply

Resources