I habe a partial view named _GetRequestors, that have an IPagedList, it use to work well . but currently when i am trying to view this view i am getting the following error :-
System.Web.HttpCompileException was unhandled by user code
HResult=-2147467259 Message=c:\Users\Administrator\Documents\Visual
Studio 2012\Projects\TMS\TMS\Views\Customer_GetRequestors.cshtml(95):
error CS1061: 'PagedList.IPagedList' does not
contain a definition for 'ORG_ID' and no extension method 'ORG_ID'
accepting a first argument of type
'PagedList.IPagedList' could be found (are you
missing a using directive or an assembly reference?)
Source=System.Web ErrorCode=-2147467259 WebEventCode=0
SourceCode=#pragma checksum "C:\Users\Administrator\documents\visual
studio 2012\Projects\TMS\TMS\Views\customer_GetRequestors.cshtml"
"{ff1816ec-aa5e-4d10-87f7-6f4963833460}"
"9F77A32094FED764FF25BFFEBB39D9D953E8EBF5"
//------------------------------------------------------------------------------ // // This code was generated by a tool. //
Runtime Version:4.0.30319.19080 // // Changes to this file may
cause incorrect behavior and will be lost if // the code is
regenerated. //
//------------------------------------------------------------------------------
namespace ASP {
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Optimization;
using System.Web.Routing;
using PagedList;
using PagedList.Mvc;
using TMS.Models;
public class _Page_Views_customer__GetRequestors_cshtml : System.Web.Mvc.WebViewPage<IPagedList<TMS.Models.AaaUser>> {
line hidden
public _Page_Views_customer__GetRequestors_cshtml() {
}
protected ASP.global_asax ApplicationInstance {
get {
return ((ASP.global_asax)(Context.ApplicationInstance));
}
}
As far I see, the view GetRequestors.cshtml attempted to call a method or variable named ORG_ID in generic list that implements IPagedList of TSM.Models.AaaUser but type object does not have a method called ORG_ID and if have, this is not visible or is protected
make sure that ORG_ID can be access
Related
I'm still new to Umbraco 7 but I've found my way around Surface Controllers.
I have created a SurfaceController which you can see future below. But what I can't figure out is how to grab the URL from an Image Cropper and File Upload, I would normally do something like this: #node.GetCropUrl("uploadImage, "thumbnail");
But that doesn't work inside the controller. How do I achieve this? My end goal is to display the URL in a IMG tag when clicking on a category on this page: http://sp34k.dk/portfolio/vue/ in the description area.
CODE:
https://jsfiddle.net/odg3zamx/7/
GetCropUrl is an extension method of IPublishedContent so just add using Umbraco.Web; inside your sufrace controller and you should be able to call it. Like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Umbraco.Web.Mvc;
using Umbraco.Web; //you are missing this namespace
public class PortfolioSurfaceController : SurfaceController
{
// GET: PortfolioSurface
public ActionResult GetCategoryDetails(int id)
{
GalleryItem gItem = new GalleryItem();
var node = Umbraco.TypedContent(id);
gItem.imgUrl = node.GetCropUrl("uploadImage", "featured");
return Json(gItem, JsonRequestBehavior.AllowGet);
}
}
I was trying to do something similar to the stackoverflow article referenced below and am finding I can't set values in the code activity. I seem to be able to read values OK. I suspect this has something to do with the scope of these. In the stackoverflow article the code implied that the variable was set for the loop,
I am after guidance on how to set these correctly or a way for my codeactivity to flag to exit the external DoWhile loop ?
Refs
StackOverflow Article
Code Activity article
OK here is the missing story and is not in the MS doco that I have found..
e.g. https://msdn.microsoft.com/en-us/library/dd647551(v=vs.120).aspx
Although MS document In, InOut, Out args their scope is not shared... i.e.
WRONG View of the world
XAML argument like MyBoolInOut Inout is the same argument that the C# code is using , e.g.
public InOutArgument MyBoolInOut { get; set; }
thus you only need to change values in C# code to change the values in the TFS XAML
Correct view of this handling
The custom code activity variables are visible in the XAML BUT are different from the XAML arguments. i.e.
as below, your C# codeactivity args have to be manually linked to the XAML args
So even though XAML has arguments and C# have arguments, these are separate.
This is an area MS could greatly improve their doco in.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.TestManagement.Client;
using Microsoft.TeamFoundation.Build.Workflow.Activities;
namespace SampleActivityLibrary
{
[BuildActivity(HostEnvironmentOption.All)]
// Sample Acitivty that will Flip a bool from True to False or from False to True
public sealed class SampleFlipInOutBoolean : CodeActivity<Boolean>
{
public InOutArgument<Boolean> MyBoolInOut { get; set; }
protected override Boolean Execute(CodeActivityContext context)
{
Boolean MyBool = context.GetValue(MyBoolInOut);
context.TrackBuildWarning("SampleFlipInOutBoolean: In Value of Bool: " + MyBool.ToString(), BuildMessageImportance.High);
MyBoolInOut.Set(context, !MyBool);
MyBool = context.GetValue(MyBoolInOut);
context.TrackBuildWarning("SampleFlipInOutBoolean: Out Value of Bool: " + MyBool.ToString(), BuildMessageImportance.High);
return MyBool;
}
}
}
how can i open db connection in global asax file. For example i am trying to open in
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using EDefterWAP.Helpers;
using EDocSis.DAL;
using System.Configuration;
namespace EDefterWAP
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_EndRequest()
{
IEDefterDB db = DBContext.CreateInstance(ConfigurationManager.ConnectionStrings["EDocSis.DAL.EDefterDB"].ConnectionString);
db.KurumVeriAktarimlari.
}
i can't write where condition after db.KurumVeriAktarimlari ? What is the problem?
It looks like you are missing a using statement.
using System.Linq;
This assembly contains the information for the Where(), First(), etc lambdas.
**File :Views/Shared/Default.aspx:**
<%# Page Language="C#" AutoEventWireup="True" CodeFile="Default.aspx.cs" Inherits="Views_Shared_Default" %>
File: Views/Shared/Default.aspx.cs:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Views_Shared_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Error:Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
My Documents\Visual Studio 2008\Projects\3ICMS\Views\Shared\Default.aspx.cs 15 14 C:\...\3ICMS\
P.S I have 2 Default.aspx files in my Project 3ICMS.
1 File is at 3ICMS\Views\Shared\Default.aspx.cs
2nd File is at 3ICMS\Default.aspx
I have tried creating a new file and copy paste this code..Didn't work.
I have tried tried changing codefile to codebehind ... Didn't work
How to solve this problem?
The files are in different folders views and view , you should put the full directory path or put them in the same folder
<%# Page Language="C#" AutoEventWireup="True" CodeFile="../../Views/Shared/Default.aspx.cs" Inherits="Views_Shared_Default" %>
I am using Json.net to convert a json string into a dynamic. When I use this dynamic as a model for a Razor template, I am getting an error...
Unable to compile template. 'Newtonsoft.Json.Linq.JObject' does not
contain a definition for 'Name' and no extension method 'Name'
accepting a first argument of type 'Newtonsoft.Json.Linq.JObject'
could be found (are you missing a using directive or an assembly
reference?)
If I just use a simple anonymous object as the model, it works fine.
Here is the problem displayed in a simple console app where I used NuGet to pull in two libraries...Newtonsoft JSON and RazorEngine.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// template used for generation
var template = "<div>Hello #Model.Name</div>";
// create model
dynamic model = new System.Dynamic.ExpandoObject();
model.Name = "Foo";
// this works just fine
RazorEngine.Razor.Parse(template, model);
// convert model to string
var json = Newtonsoft.Json.JsonConvert.SerializeObject(model);
// regenerate model
model = Newtonsoft.Json.Linq.JObject.Parse(json);
// this prints 'Foo' to the console just fine so the model is valid!
string name = model.Name;
System.Diagnostics.Debug.WriteLine(name);
// this throws the error above!
RazorEngine.Razor.Parse(template, model);
}
}
}
Can someone help me with the problem here?
You can't directly pass the JObjects into the RazorEngine because whenever you assign a value to the JObject they are stored as type JValue. When you try to retrieve the assigned value also you will get a JValue not the assigned one.
Ex.
dynamic person = new JObject();
person.Name = "Vijay";
Console.WriteLine(person.Name.GetType());
==> NewtonSoft.Json.Linq.JValue