.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Trying to generate a view with Details.tt

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
I'm using Entity Framework and I have Mvc 1.0 installed.I keep getting weird errors when I try to generate a view for my details method. The first time I try to gen I get: error CS0234: Compiling transformation: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?) I rebuild and then I get: CodeTemplates\AddView\Details.tt(-1,-1) : error : The host threw an exception while trying to resolve the assembly reference 'System.Data.Entity'. The transformation will not be run. The following Exception was thrown:System.ArgumentOutOfRangeException: Length cannot be less than zero.Parameter name: length   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)  Anyone have any ideas? I've searched google...I've searched the forums...I've moved the .tt templates into my solution. No luck.

View Complete Post

More Related Resource Links

Customer Activity Designer Problem - "Could not generate view for VisualBasicValue`1"

I'm reading Bruce Bukovics Pro WF4 book and in chapter 16 - Advanced Customer Activites, he details emulating a Sequence activity along with a custom designer. When I drop the custom activity into a new xaml activity, I'm getting all sorts of wierdness. The custom sequence activity has a condition property that determines whether to schedule each child activity contained within. Once I set a value in the ExpressionTextBox for the activity, Visual Studio starts showing in red "Could not generate view for VisualBasicValue`1" along with this error showing up in my error window: The activity 'VisualBasicValue<Boolean>' cannot be referenced by activity 'MySequence' because the latter is not in another activity's implementation.  An activity can only be referenced by the implementation of an activity which specifies that activity as a child or import.  Activity 'VisualBasicValue<Boolean>' is declared by activity 'MySequence'. Here is the source for the activity itself: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Activities; using System.ComponentModel; using System.Collections.ObjectModel; namespace ActivityLibrary { [Designer(typeof(ActivityLibrary.Design.MySequenceDesigner))] public sealed class MySequence : NativeActivity { [Browsable(false)] public Collection<Activity&

Details view

I am currently using a Grid view to list out some information about the products in my database. When selecting on Select button, a Details view with more information is shown at the bottom, Question is - how do I show the Details view in a new page instead of being at the bottom of the same page? Thanks for your help. 

Could not generate view for

Hi,   Could you please tell me why I get "Could not generate view for Action", where classes Action and Designer are as follows   using System; using System.ComponentModel; using System.ComponentModel.Design; using System.Collections; using System.Drawing; using System.Workflow.ComponentModel; using System.Workflow.ComponentModel.Design; using System.Workflow.ComponentModel.Compiler; using System.Workflow.ComponentModel.Serialization; using System.Workflow.Runtime; using System.Workflow.Activities; using System.Workflow.Activities.Rules; using System.Drawing.Drawing2D; namespace Microsoft.Samples { [Designer(typeof(ActionDesigner), typeof(IDesigner))] public partial class Action : System.Activities.CodeActivity { public Action() { } protected override void Execute(System.Activities.CodeActivityContext context) { } } public class ActionDesigner : FreeformActivityDesigner { protected Rectangle frameRect; protected Rectangle pageRect; private Color _baseColor; private Color BaseColor { get { return _baseColor; } set { _baseColor = value; } } private Color _lightingColor; private Color LightingColor { get { return _lightingColor; } set { _lightingColor = value; } } private Color _titleLightingColor; private Color TitleLightingColor {

how to xml Generate Jquery tree View using XMl

i have an xml file how to Generate Tree View<?xml version="1.0"?>  <HD id="Acct" value="Acct">    <SH id="Books" value="Books">      <TRK id="Annual" value="Annual">        <TGT id="ABA.0001" value="ABA.0001">Closure of accounts for 2009-10</TGT>      </TRK>      <TRK id="Monthly" value="Monthly">        <TGT id="ABM.0003" value="ABM.0003">Finalization of expense accounts for Jun</TGT>      </TRK>    </SH>  </HD>  <HD id="Admin" value="Admin">    <SH id="GH" value="GH">      <TRK id="Eqpt" value="Eqpt">        <TGT id="AGE.0001" value="AGE.0001">Shifting of BSNL Landline.</TGT>      </TRK>    </SH>    <SH id="Offc" value="Offc">      <TRK id="Eqpt" valu

Details View Biding Custom Object with Enum properties fields

Hello, I'm trying to bind custom object to details view. The problem is that enum property fields are not show.Is there any way to show enum property fields in details view ?I put some example code below (I do not specify any rows mappings, they are generated dynamically because different kind of objects are bound to details view):// My object public class OrderItem { public ItemKindEnum unitemizedItemKind { get { return (ItemKindEnum)this.unitemizedItemKindID; } } ... } // Details view configuration <asp:DetailsView ID="dvOperationDetails" runat="server" DefaultMode="ReadOnly" ... />

Generate the event handler of a control directly in the markup view ?

Hi there, I was wondering if there is a way to generate the event handler of a control directly in the markup view and not in the design view. Thanks.

How do I drop a drop down box into a details view ?

SO I've got a Details View control which I can insert data into my database with OK.However, in one of the text fields I want to limit what the user can insert to a set of key words. So the obvious thing to do is to present the User with a drop down box to select a key word.So I have converted the text field into a template and I thought I could replace the <InsertItemTemplate> in the details view with the drop down box. Well it looks like what I want but when I INSERT the data that field is not inserted into the database.So I guess I need to Bind the Drop Down somehow to the Insert - How do I do that ?My code is below; <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataKeyNames="dateID" DataSourceID="SqlDataSource1" DefaultMode="Insert"> <Fields> <asp:BoundField DataField="dateID" HeaderText="dateID" InsertVisible="False" ReadOnly="True" SortExpression="dateID" /> <asp:TemplateField HeaderText="diaryDate" SortExpression="diaryDate"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<

want to get Data key value of details view and use in objectdatasource for data list ?



I have a details view and the primary key is CompanyId which retrieves data from a table called companies.


On the same page I have a datalist that is bound to another objectdatasource which has a select method



For the parameter for the OBJ seect method attached to data list, I want to use the DataKey Value for the company that is being displayed in

the details view.


thanks for any solutions to this







How can I print a Details View?


I have a page in my project that has data inside of a details view. I'd love to be able to have a print button that just prints out the details view and not the whole webpage. Is that possible and if so how do you do it? Or if it's easier it could be exported to excel?

Insert the date as a hidden field using details view


When adding a new record. I have a field that displays the current date using now(). I want to make that a hidden field and simply insert it into the database when the new record is submitted.

I tried making it a template field and then deleting the textbox and inserting a hidden field but I can only either bind it to the field in the database or use custom binding to add the date value 'now()'... I don't seam to be able to do both.

any ideas ?

Based on the rowsize entered on the text box, how to generate a dynamic grid view of that many row?


Hi, I have a text box.It is having 2 validation on it(Range validator and req field validator). Now,if I enter an integer within 0-8,just after gettting out of focus of the text box,I need to generate a grid which should contain exactly that many number of rows. Now,My question is: 1.How to capture that number entered in the text box and without any button click event,how to to generate the grid?I suppose,I need to write the code in one of the TextBox event.But,which one and how? Please help me as I am in urgent need.

How to diplay a data in Details view. Framework 3.5 ASP.Net



Am having a details view and grid view in a page. In details view I have one dropdown list with selected index changed.I have to take the values from database and bind it to the other fields in details view. I have Written the Query which is executing fine and fetching values(this one i have checked in SQLServer). But when i select any items in DDL, instead of binding it in DetailsView its getting binded to Grid view.... Can some one help me how to fix this issue??

Many Thanks

Looking for best setup to accomplish this task, need to generate report view for printing(edited)


We have some pages that are in gridviews and datalists.. one requirement for 2 of them is the ability to generate the results in a report view of sorts.. in other words, if you do a search and the results come back in one of the 2 gridviews or datalist, on screen its presented as it currently does.. just a gridview or datalist.. but i need to add a button that gives you the option to convert / generate the data in a report view so you can print it out and not be just a print out of the gridview..

I already offer the ability to export to excel format, but what they are wanting is to create it so if it needs to be presented to someone, they can print it out with the click of a button and it looks like a nice report.

Hope that makes sense... any suggestions would be great..

Just thinking to myself, could it be possible or would this be an option and if it can, how can it be incorporated to work correctly..

Build a template page that has a formal report layout.. then if you chose to print, then each record in the gridview loops thru the template and each record would print out on its own page..

Does that sound like it can be done? or am i just wishing it could be that simple??


// Added to above //

What i guess would be comparable to what im looking for is

Showing User Details with List view


Hi All, 

        Here is my scenario.There is a users table and each user has multiple addresses(one to many) and I want to dispalay them like the image provided below

using listview only.I am really stuck with the deign of the page.There is a show and hide feature also.I can use only list view that is my requirement.

Waiting for your Suggestions.(List view only)

Some helpfull links.....

Any kind of help will be appreciated.





















Unable to add view with content of List or Details



I can successfully right click on a Controller to add views where Content is any one of Empty, Edit or Create but when I select List or Details I receive the following error "Template processing results in 1 error . . . the referencedAssemblies property cannot contain null or empty strings . . .". I tried it with both Entities and Linq to Sql with the same outcome.

Not sure whether this is a feature of beta code or if I'm missing something obvious.

Details View - Change control rendering



i am currently using the CSSFriendly adapters and need to change their behavours.  I am currently using a detailsview control to generate a form based upon a table in a DB and that the detailsview generates the column automatically.

If a column in the DB is of type bool the adapter displays a check box but for all other types it displays a text box.  I want to be able to customize this and actually have some rendered as dropdowns.  Is this possible by updating the adapter?

MVVM Bind View Details to Model Via ViewModel when a Button clicked.


I have model called Car with prperties name,model,type,year.

I have implemeted the Viewmodel with same properties with OnpropertyChangedEvent including model object type Property.

I have a view usercontrol where textboxes for name, model and for year a combobox.

Whenever i fill the view i want to save those details into model via view model

I have written ICommand  Save which calls SaveCarDetails defined in viewmodel,  which is bind to a button in view ,All other texboxes text is bind to the properties of viewmodel properties.

When i put break point at ICommand SaveCommand and SaveCarDetails Function i could see the values filled from view.

But when i bind these details to another user control where listbox is placed and its itemsource property is set to Car property nothing but model object defined in the viewmodel.

I couldn't see the values binding via viewmodel to model.

Where as if i bind to textboxes in the listview i could see the values because i it's a dependency property.

Can any one please tell me what is the wrong i am doing here.




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend