Using Kendo Tabstrip in MVC 4.
I have a tabstrip. Each tab contains a number of form fields for the overall page form.
Right now I add the fields as below, it's very messy though. Is there a way to use some kind of Template where I don't have to concat strings together?
Here's what I have to do currently:
#(Html.Kendo().TabStrip()
.Name("tabFormItems")
.Items(items =>
{
items.Add().Text("Rex Online").Content(
"<table><tr>" +
"<td>" + Html.LabelFor(x => x.ClientID).ToString() + "</td>" +
"<td>" + Html.EditorFor(x => x.ClientID).ToString() + "</td>" +
"</tr></table>")
Yep. You can use a Razor template delegate as shown in this example: http://demos.kendoui.com/web/tabstrip/index.html
Here is the relevant code:
tabstrip.Add().Text("New York")
.Content(#<text>
<div class="weather">
<h2>29<span>ÂșC</span></h2>
<p>Sunny weather in New York.</p>
</div>
<span class="sunny"> </span>
</text>);
Related
In my simple_form, I have a field that contains a collection as a series of checkboxes. It's very long and takes up a lot of space on the form.
I want to style the container the checkboxes are in with CSS so that it's limited to a 180px height and contained in a scrollable box. My code on the simple_form:
<th>Authors</th>
<td><%= f.association :authors, as: :check_boxes, item_wrapper_tag: :div, item_label_class: 'h_180', label: false, collection: Author.order('name ASC') %></td>
I've wrapped the rails output in a div with item_wrapper_tag: :div. How do I style that div? Neither item_label_class nor item_wrapper_class is working.
I have a checkbox selection in my app, but I implemented it somewhat differently:
<%= f.collection_check_boxes(:item_ids, Item.all.sort_by { |x| x.name }, :id, :name) do |b| %>
<%= b.label class: "label-checkbox", style:"padding-right:5px" do >
<%= b.check_box + " " + b.text + " "%>
<% end %>
<% end %>
I think you could style the check box again the way the label is styled:
<%= (b.check_box class: "checkbox-class", style: "checkbox-style") + " " + b.text + " "%>
If you choose to implement the selection this way, make sure you allow your controller to receive :item_ids as a parameter.
I'm very new to Umbraco, I am still picking my way through how it works so it is entirely possible that I have missed something extremely obvious.
I have been asked to amend how a slider on a MasterPage functions, I've found the markup for the slider is in the .cs file for the MasterPage.
void CreateSlider()
{
if (!String.IsNullOrEmpty(CurrentContent.Slider1Image))
{
slider.InnerHtml += "<li class='foobar'>";
if (!String.IsNullOrEmpty(CurrentContent.Slider1Title))
{
slider.InnerHtml += "<img src='" + GetMedia(CurrentContent.Slider1Image) + "' alt='' />";
slider.InnerHtml += "<div class='slider_content bx-pager-item'>";
slider.InnerHtml += "<h1>" + CurrentContent.Slider1Title + "</h1>";
if (!String.IsNullOrEmpty(CurrentContent.Slider1VideoButtonTitle) && !String.IsNullOrEmpty(CurrentContent.Slider1VideoLink))
slider.InnerHtml += "<span>" + CurrentContent.Slider1VideoButtonTitle + "</span>";
slider.InnerHtml += "</div>";
if (!String.IsNullOrEmpty(CurrentContent.Slider1VideoButtonTitle) && !String.IsNullOrEmpty(CurrentContent.Slider1VideoLink))
{
slider.InnerHtml += "<div class='video_wrapper'>";
slider.InnerHtml += "<div class='youtube_container'>";
slider.InnerHtml += "<div><iframe src='https://player.vimeo.com/video/" + CurrentContent.Slider1VideoLink + "' width='100%' height='542' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>";
slider.InnerHtml += "</div>";
slider.InnerHtml += "</div>";
}
}
slider.InnerHtml += "</li>";
}
}
I have tried adding a class to the <li> but it doesn't not show up in the HTML markup at all. I have tried building the project but with no joy.
Here is the markup that is output:
<%# Master Language="C#" MasterPageFile="~/masterpages/Base.master" AutoEventWireup="true" Inherits="HomePageType1" Codebehind="HomePageType1.master.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<div class="slider_container">
<ul id="ContentPlaceHolderDefault_ContentPlaceHolder1_slider" class="bxslider">
<li>
<img src='/media/img001.jpg' alt='' />
<div class='slider_content'>
<!-- SLIDE CONTENT -->
</div>
<div class='video_wrapper'>
<div class='youtube_container'>
<div>
<!-- VIDEO URL -->
</div>
</div>
</div>
</li>
</ul>
</div>
</asp:Content>
Any suggestions?
Any code added to a .cs file outside of /App_Code/ must be compiled before it "counts" - that part should be dealt with when you build the project.
Also, the master page must reference its code behind for it to pick it up, like
<%# Master Language="C#"
AutoEventWireup="true" CodeBehind="MyMasterpage.master.cs" Inherits="MyNamespace.MyMasterpage" %>
Can you perhaps also share the master page content?
The reason this was not functioning correctly is because the previous developers had compiled their code but had also uploaded the C# files to the server. So the files we received were compiled.
After much political wrangling we got them to send us the uncompiled files which allowed me to make the code changes as expected.
I am having two form tags on single page and they both are redirected to different url.
button = "<form id='frm1' action='https://www.ccavenue.com/shopzone/cc_details.jsp' method=POST>" +
"<input type='image' src='../Images/btn_paynow.gif' border='0' name='submit'>" +
</form>
button = "<form id='frm2' action='https://secure.payu.in/_payment' method=POST>" +
"<input type='image' src='../Images/btn_paynow.gif' border='0' name='submit'>" +
</form>
Please help me to handle it.
It is not at all redirecting to proper page. I tried code on: http://www.codeproject.com/Articles/664/Specifying-multiple-actions-from-a-single-Form but it is not working.
The link which I have posted in question solved my problem. It is worth vote 5.
I have the following code :
#Html.ActionLink("Hello " + User.Identity.GetUserName() + "!",
"Manage", "Account",
routeValues: null,
htmlAttributes: new { title = "Manage" })
I just want to display the text (with the correct htmlattribute) (i.e. no link)
Could you help me with the correct syntax please?
I think you can use Url.Action method.
<a href="#Url.Action("ActionName")">
<span>"Hello " + User.Identity.GetUserName() + "!"</span>
</a>
If i understand correctly,you want to show the text inside your link without an achor tag, but with your html attributes (title attributes)
Try this
<span title="Manage">Hello #User.Identity.GetUserName() !</span>
If you want the text with no link i.e. no anchor element, then just use plain HTML
<span title="Manage">Hello #User.Identity.GetUserName()!</span>
Or if you don't want to enclose it within a <span>
<text>Hello #User.Identity.GetUserName()!</text>
But with this you won't get the title attribute since the text is not enclosed within an html tag with which to apply it to.
If you actually want an anchor then you could also use #Url.Action() in conjunction with plain HTML
<a title="Manage" href="#Url.Action("Manage", "Account")">
Hello #User.Identity.GetUserName()!
</a>
Writing html using Response.Write in asp.net it doesn't display the image. I check my image path code and simple put it in the page and it works fine. Why it doesn't display the image when writing using response.write code.
Following is my image path code
<img alt="" src="<%= VirtualPathUtility.ToAbsolute("~/Content/images/txt2.png")%>" border="0"/>
This is Response.write code
<% Response.Write(valueHelp); %>
ValueHelp is a string which contain the image code which i have mention above.
Any idea why it is not working?
Thanks in advance
<%= %> is to be used within the mark-up (i.e. the HTML part of your code) and not in the code-behind.
My guess (without seeing the code) is that you are actually sending <%= VirtualPathUtility.ToAbsolute("~/Content/images/txt2.png")%> to the browser as part of a static string.
So instead of it being picked up by the server and rendered into the correct path, it is simply being sent as part of the HTML to the browser (the browser not knowing what on earth it means, therefore it will not show the image you expect).
Try something like this when you are creating the valueHelp string
valueHelp = "<img alt='' src='" + VirtualPathUtility.ToAbsolute("~/Content/images/txt2.png") + "' border='0'/>";
Try this
<% Response.Write("<img alt='' src='" +
VirtualPathUtility.ToAbsolute("~/Content/images/txt2.png") +
"' border='0'/>" ); %>