C# - What Is The Syntax For If False In NVelocity

Feb 9, 2010

What is the syntax for an not true or false if statement in nVelocity (or Velocity)?

And more importantly, where is this in the nVelocity docs? I've been Googling for quite a while to no avail.

I've tried several different combinations such as:
#if (!$artist.IsFestival)
$artist.FestivalName
#end
and
#if ($artist.IsFestival == false)
$artist.FestivalName
#end

So frustrating!

View 1 Replies


Similar Messages:

C# - NVelocity Syntax For Calling Methods With Evaluated Parameters?

Jul 14, 2010

I have a fairly simple template that I need to make a method call from. However, NVelocity does not seem to evaluate method parameters that themselves are NVelocity variables. Take the following NVelocity template:

#if (--- CONDITION SNIPPED ---)
<blockquote class="column span-4">
I MADE IT!
</blockquote>
#else
<blockquote class="column span-4">
$extensionMethods.TestMethod(${var1})
</blockquote>
#end

In the above template, $extensionMethods is passed in as an instance of a class and works wonderfully when passing in evaluated numbers (e.g. $extensionMethods.TestMethod(4) works every time). However, using $var1 causes the entire string to be returned as-is: $extensionMethods.TestMethod(${var1}).

Is there a way to pass in a variable to a method lazily to get the above template to evaluate correctly?

View 1 Replies

Looking To Use NVelocity In MVC Application?

Mar 17, 2010

I'm looking to use NVelocity in my ASP.NET MVC application, not as a view engine, just for rendering some email templates.However, I cannot for the life of me get it to work. I have downloaded it from the castle project and followed the example at [URL].html#step1No matter what I try I don't seem to be able to load a template located in my site. The example suggests using the absolute path, which I have tried to no avail:Template t = engine.GetTemplate("/Templates/TestEmail.vm");So please can someone give me two examples. One of loading a template located in the web site directory and secondly one parsing a string variable (as it is likely that my templates will be stored in a database).

View 3 Replies

How To Use NVelocity From Webforms

Feb 1, 2011

I want to use "NVelocity" from plain ASPX pages without using any MVC framework. I don't want to use "NVelocity View Engine" thru' asp.net MVC framework. The only example that I got for "NVelocity" is for merging and writing onto console window (http://www.castleproject.org/others/nvelocity/usingit.html)

I am looking out for example on to integrating "NVelocity" into aspx web forms.

View 1 Replies

Create First Family Site With MVC And Possibly NVelocity?

Jan 22, 2010

I am an experienced .NET developer with approximately 5 years of experience. Unfortunately, I have worked primarily on the back-end and as an desktop/smartclient developer. I have worked as a consultant for a total of 1 1/2 years on web development using both the MVP pattern and some Silverlight. I am wanting to develop a personal site, (My wife is due with our first in 7 months!) and figured while I was at it I would target particular technologies that I want to learn. Being that my current employer
uses Monorail with NVolocity and is plannning a migration to ASP.NET MVC with (most-likely) NVelocity, I figured that would be a good tech stack to use. In addition, I would like to add JQuery to the set-up.

I have done several ASP.NET MVC tutorials. Including one on this site (Great job!). However, adding NVelocity and JQuery to the mix muddies the water a bit for me.

So, my question is, does anybody have advice of where to start? Do you know of any good books, online tutorials, etc.? Do you think this is a good stack to use? Better view engine?

View 2 Replies

WebForms Placeholder For NVelocity View Engine?

Oct 31, 2010

Is there any way to use placeholder similar to WebForms in NVelocity View Engine (.vm files)? Today I've got a component containing everything for the <head>, but I wish to specify additional tags from each view page like it can easily be done in ASP.NET WebForms / MVC:

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server"></asp:Content>

If this is not possible directly trough NVelocity View Engine, do I have any other alternatives other than using a blank MasterPage and adding all markup in each view page?

View 1 Replies

Access :: Syntax Error (missing Operator) In Query Expression / Get Conflict With CommandText Syntax

Aug 8, 2010

I'm having problem in inserting text from a textbox in which user write or copy some text which may contain special characters ( " , . ) etc. If there is any special character it get conflict with CommandText Syntax and generates error in inserting. I want to insert all these characters. How could i do it?

Code:

[code]....

View 1 Replies

Why Can't Use C# Syntax In Inherits Attribute For A Closed Generic But CLR Syntax Is Fine

Jan 15, 2011

The following CLR syntax works fine in my aspx page:

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="Website.MyBasePage`1[HomePageViewModel]" %>

But this C# syntax does not:

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="Website.MyBasePage<HomePageViewModel>" %>

Note, I am not using ASP.NET MVC, but this works fine if using System.Web.Mvc.ViewPage<> from ASP.NET MVC.
My MyBasePage looks like this:

public class MyBasePage<TModel> : Page where TModel : class {
public TModel Model
{
get { return (TModel)HttpContext.Current.Items["model"]; }
}
}

View 1 Replies

MVC :: 3 RC2 - Convert ASPX Syntax To Razor Syntax For Asp:Hyperlink?

Dec 15, 2010

For reporting we used report RDLCs and displayed using an ASPX form. We implemented using the route as shown below. This resulted in forcing us to use the page route below and also to use the hyperlink instead of the normal Action Link. The question is how do we convert the asp:hyperlink ASPX syntax to Razor syntax.

//Custom route for reports routes.MapPageRoute( "ReportRoute", // Route name "Reports/{reportname}", // URL "~/Reports/{reportname}.aspx" // File );
<li><asp:HyperLink ID="hypReport" runat="server" NavigateUrl="<%&#36;RouteUrl:routename=ReportRoute,reportname=StaffRpt%>">Staff Report</asp:HyperLink></li>

View 2 Replies

SQL Server :: EXEC 17P_Comose Will Give Incorrect Syntax Error - Incorrect Syntax Near '17'

Sep 15, 2010

I am working with a sql server database with about 50 stored procedures. The database and stored procedureswere not created by me. The stored procedures all begin with a number in their name.

Example: 17P_Comsetter

The problem I am having is that if I try and execute the stored procedure at the command line in Query Analyzer,the query analyzer appears not to like that the stored procedure begins with a number. For example:

If I try an run the stored procedure as follows:

EXEC 17P_Comsetter

Then I get the following error message:

Msg 102, ..... Incorrect Syntax near '17'

I am using SQL server 2005. Does anyone know why I am getting this error message?

View 1 Replies

ADO.NET :: Not Working Showing Syntax Error Syntax Error:operand Is Missing?

Mar 25, 2011

DataRow[] filterRows = ds.Tables[0].Select("Running Status= case State when 'True' then 'Running' When 'False' Then 'Stoped' end Where Active='1' and State='1'");

this is not working showing syntax error syntax error:operand is missing

View 3 Replies

Data Controls :: Alert Return False On Confirm True And Return True On Confirm False On Value Exists

Mar 26, 2016

I have an approve button.on clicking on this button it should show that an inactive value is present .Onclicking yes conformation it should save the data or else clicking on no conformation should return false; how i will do that?After alert it always submit the data. 

protected void ibtApprove_Click(object sender, ImageClickEventArgs e)
{

string otherAffiliateName = txtRequestedAffiliate.Text;
int inActiveAffiliates = new BLRating().InActiveAAffiliateChecking(otherAffiliateName);
if (inActiveAffiliates > 0)

[code]...

This is the code i used.how i wiil stay back on Confirm 'no' click?

View 1 Replies

Syntax Near The Keyword?

Jul 4, 2010

I am trying to use this code:
PHP Code:

string connVac = "Database connection...";
SqlConnection dbConnVac = new SqlConnection(connVac);

DataSet dsInfo = new DataSet();

[code]....

But i need to change it so it shows the Job name, details and then the regions..

View 5 Replies

C# - Sql Syntax How To Do A Join

Mar 24, 2011

Im trying to retrieve a path name from my Pictures table the pathname is stored under picturepath in my Pictures table I dont know how to join it on to my current sql syntax it uses the UserID which is set by a session.

And im unsure what goes in the commented line for my image url string?

using (OdbcCommand cmd = new OdbcCommand("SELECT Wallpostings FROM WallPosting WHERE UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
{
using (OdbcDataReader reader = cmd.ExecuteReader())
{
test1.Controls.Clear();
while (reader.Read())
{
System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
div.Attributes["class"] = "test";
//div.Style["float"] = "left";
div.ID = "test";
Image img = new Image();
img.ImageUrl = String.Format("{unsure}", reader.GetString(unsure));
// this line needs to be represented in sql syntax
img.AlternateText = "Test image";
div.Controls.Add(img);
div.Controls.Add(ParseControl(String.Format("{0}", reader.GetString(0))));
div.Style["clear"] = "both";
test1.Controls.Add(div);

View 1 Replies

Understanding Syntax In C#?

Apr 23, 2010

understand what is going on in the code line below:

Table t = (Table)Page.FindControl("Panel1").FindControl("tbl");
I understand Page.FindControl("Panel1").FindControl("tbl");
Why is there a (Table) before the Page.FindControl?

View 4 Replies

C#, Vb.net Syntax Highlighter?

Apr 10, 2010

I am looking for a code to HTML converter.Let say I have a code

[Code]....

which is in formatted color. Now when I am converting it to the basic HTML convertor it is giving me without color.I have found http://www.manoli.net/csharpformat/ which is generating CSS for the same, which is not possible to add at runtime.

View 12 Replies

ADO.NET :: Incorrect Syntax Near ')'.

Dec 2, 2010

Server Error in '/' Application.

Incorrect syntax near ')'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near ')'.

Source Error:

[Code]....

Line 25:SqlDataAdapter sda = new SqlDataAdapter(cmd);Line 26:DataSet ds = new DataSet();Line 27:sda.Fill(ds);Line 28:Label1.Text = ds.Tables.Count.ToString();Line 29:

View 3 Replies

Getting False Value Of Checkbox

Jan 19, 2010

public CheckBox[] cb = null;
int z=0;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cb = new CheckBox[count - k];
//Database code.........
while (dr.Read())//read data from access database
{
cb[z] = new CheckBox();
cb[z].Text = dr["Member_Name"].ToString();
Panel2.Controls.Add(cb[z]);
Panel2.Controls.Add(new LiteralControl("</br>"));
z = z + 1;
}
}
}
protected void Button6_Click(object sender, EventArgs e)
{
for (int x = 0; x < cb.Length; x++)//ERROR IS HERE:Object reference not set to an instance of an object.
{
if (cb[x].Checked == true)//EVERY TIME I GOT FALSE VALUE
{
//processing check boxes
}
}
}

View 1 Replies

How To Set The Div Visibility To False

Apr 2, 2011

Basically, when the page loads i set the div visibility to false. When i click the button, i want the code behind function to be called, and the div tag to be visible, true.

$('#Button2').click(function () {
$('#edit').show(function () {
});
});
<input type="submit" id="Button2" runat="server" value="Search" OnServerClick="Button1_Click" />
but when clicking the button, the page posts back, causing the div tag to be invisible all times.
I can set the return false to the onlclick event of the button , but i need to call the function also.

View 4 Replies

Use Of Validaterequest False?

Jun 28, 2010

tell me the use of Validaterequest False?

View 4 Replies

Set ValidateRequest To False?

Nov 2, 2010

I'm using FreeTextBox HTML editor in some webforms in my asp.net project . if I do not set ValidateRequest property to false I get this error :

A potentially dangerous Request.Form value was detected from the client

It's OK in admin folder though , Because only authorized users have access to work with it . But how about public pages like sections where every users have access to leave comments(using FreeTextBox for collecting users comment ) ? Isn't risky for XSS Attack ? If the answer is not Yes , So what's ValidateRequest property for?

View 3 Replies

C# - Get False Value Of Checkbox

Jan 19, 2010

public static CheckBox[] cb = null;
int z=0;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cb = new CheckBox[count - k];
//Database code.........
while (dr.Read())//read data from access database
{
cb[z] = new CheckBox();
cb[z].Text = dr["Member_Name"].ToString();
Panel2.Controls.Add(cb[z]);
Panel2.Controls.Add(new LiteralControl("</br>"));
z = z + 1;
}
}
}
protected void Button6_Click(object sender, EventArgs e)
{
for (int x = 0; x < cb.Length; x++)//ERROR IS HERE:Object reference not set to an instance of an object.
{
if (cb[x].Checked == true)
{
//processing check boxes
}
}
}

View 3 Replies

Set GeneratePublisherEvidence To False In An App

May 4, 2010

To reduce the loading time this blog we set generatePublisherEvidence to false in the app.config for executables.

<configuration>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>

Where do I set it for web apps? The blog that this does not go to the web.config. Where else should I put it?

View 1 Replies

MVC :: IsAjaxRequest Is Always False?

Mar 22, 2010

i am using MVC 2 RC and VS2010

when i want to use Ajax for my application IsAjaxRequest returns false

this is my code for view

[Code]....

and this is my controller

[Code]....

also i was added these libraries to my master page

[Code]....

the Request.IsAjaxRequest returns false

View 8 Replies

Converting VB To C# - What Is Proper Syntax

Jul 6, 2010

I am trying to conver this to C# but Item is not a method in C#

Repno is a string variable of 3 characters

First if rep is not null

then

confirm that Repno the field salespnno from the query.

[code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved