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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

DataGrid using ParseControl causes Cannot instantiate type 'DataBoundLiteralControl' error

Posted By:      Posted Date: September 11, 2010    Points: 0   Category :ASP.Net
Hi, I have written a very simple aspx page that creates a DataGrid control using ParseControl and then tries to load some data.  asp:BoundColumn works fine but when i try and add a templatecolumn and use Container.DataItem i get the following error "Cannot instantiate type 'DataBoundLiteralControl' because there is no public parameterless constructor."  The code is below Creating the grid control string grid = "<asp:DataGrid ID=\"grid2\" runat=\"server\" AutoGenerateColumns=\"false\"><Columns><asp:BoundColumn DataField=\"storeId\" /><asp:BoundColumn DataField=\"storeName\" /><asp:TemplateColumn><ItemTemplate><asp:LinkButton ID=\"link1\" runat=\"server\"></asp:LinkButton><%# DataBinder.Eval(Container.DataItem, \"storeId\")%></ItemTemplate></asp:TemplateColumn></Columns></asp:DataGrid>";tempHolder.Controls.Add(this.ParseControl(grid)); Creating the datasource DataTable table = new DataTable("stores");        table.Columns.Add(new DataColumn("storeId", typeof(string)));        table.Columns.Add(new DataColumn("storeName", typeof(string)));         for (int i = 0; i < 5; i++)        {            Da

View Complete Post

More Related Resource Links

Type or namespace error.


A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 

Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

error message that would typically be received when the dll has not been added as a reference or added in a using statement.

I can eliminate the error by adding an


Activation error occured while trying to get instance of type Database, key "DBName"


Im using Enterprise library 5.0
I have a scenario, where I have to access two different databases in my application.

Basically this application is a webservice,delployed on my local for testing purpose.
I'm trying to access this web method from diffent windows application, default connection works fine but the other database throw's exception.

Problem is only my defaultDatabase is works fine, if I change defaultDatabase="MYCON1" with "MYCON2" it works fine, if I try to access the other database which is not default, throws exception.

<dataConfiguration defaultDatabase="MYCON1" />
<add name="MYCON1" connectionString="Data Source=server1;Initial Catalog=dbName1;User Id=Username1;Password=password1;"

" />
<add name="MYCON2" connectionString="Data Source=Server2;Initial Catalog=dbName2;User Id=Username2;Password=password2;"
providerName="System.Data.SqlClient" />

Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>(); --> works fine for the default database (MYCON1)

Database myDB=EnterpriseLibraryCo

"Type ASP.x is not defined" error for dynamic user control when publishing updateable


I have a user control (ContainerCtrl) which programmatically instantiates another user control (SimpleCtrl) in OnLoad. It builds and runs fine, but when I publish it I get the error "error BC30002: Type 'ASP.SimpleCtrl' is not defined." (If I publish without the "updateable" option there's no error, but I need the site to be updateable.)

I assume this has to do with the particulars of how the assembly(ies) are built for the different compiler options. My question is, how can I get it to work properly for "updateable" publishing?

VS 2008 / .NET 3.5 sp1

The code follows (web.config is the default from Visual Studio).

Many thanks, Dave


<%@ Control Language="VB" ClassName="SimpleCtrl" CodeFile="SimpleCtrl.ascx.vb" Inherits="_SimpleCtrl" %>

    Simple control


Partial Class _SimpleCtrl
    Inherits UserControl

    'Nothing to see here.

End Class


<%@ Control Language="VB" CodeFile="ContainerCtrl.ascx.vb" Inherits="_ContainerCtrl"

Parser Error Message: Could not load type MasterPage File



Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'wamsilverlight.Web.Wam'.

Source Error:

Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Wam.master.cs" Inherits="wamsilverlight.Web.Wam" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Source File: /Wam.Master    Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4927


All of the following have been tried over and over again:

1.) Delete all existing .dlls

2.) Delete MasterPage File and recreate it.

3.) Delete MasterPage perform a c

override error message (The value 'test' is not valid for Age) when input incorrect data type for in


Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

public class Person
public string FirstName {get;set;}
public int Age {get;set;}


For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.

Error converting data type varchar to numeric.


I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


Object expected error


<input type="button' onclick="timeoutCheck()" value="Click Me!" />

it tells me Microsoft JScript runtime error: Object expected


timeoutCheck() is my script function that i declared above the input tag

can anyone tell me why i am getting this error

hello i need help , any ideas are welcome i have been working on this for two weeks now and cannot seem to be able to advance

How can I solve this problem?::Compiler Error Message: CS0433: The type 'CrystalDecisions.Web.Cryst


I upgraded my web application from visual studio 2003 to 2008. When I want to create a report in visual studio 2008 and receiving this error at runtime. I am able to compile but when runnning thats when I am getting this error.

How can I solve this problem? please help.

Compilation Error

Server Error in '/IRPSDEV' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.Web\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Web.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\irpsdev\9e97e0a9\94a2ecd\assembly\dl3\151eb571\00df56e1_6064c201\CrystalDecisions.Web.DLL'

Source Error:

Line 161:        
Line 162:        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 163:        private global::CrystalDecisions.Web.CrystalR

The type 'DataGrid' was not found. Verify that you are not missing an assembly reference and that

Hi; I'm new to WPF and I was going through the ExpenseIt tutorial on MSDN's website. The tutorial was working fine until I added DataGrid. I got the error message: "The type 'DataGrid' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built."     I could not find a clear answer online of which assembly references to fix and how to fix them. Any help would be appreciated. Thanks!     Note: I'm running the following: Windows Vista 32-bit operating system Microsoft Visual Studio 2008 Version 9.0.30729.1 SP Microsoft .NET Framework Version 3.5 SP1

Error Build: Type or namespace could not be found, when referencing a web service

Hello, I'm new in writing C# application in Visual Studio 2008. I'm currently writing a web application for CRM 4.0 Reporting Service rendering. I reference my web application to our Reporting Service web service http://reportservername /ReportServer/ReportExecution2005.asmx and name it 'RSWebReference'. Then I want to reference it in my code: Using RSWebReference; Not sure why, but I cannot build my solution, saying "The type or namespace name 'RSWebReference' could not be found (are you missing a using directive or an assembly reference?)". I read this thread in http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/74f70e30-83e8-4817-b5e0-7729450730a1 that the website probably is using .net 1.1, and I should change it to .net 2.0. However, I think the website is already using 2.0. Is it probably because I'm using VS 2008? How can I tell and change if the website is using 1.1 or 2.0? Or could I be doing something wrong? Thanks in advanced for your help! -Elizabeth K.

Data Source View Gives incorrect Error--Different Data Type

Hi, I'm creating a report model (2008 R2).  I am trying to create a relationship between two tables.  One FKs to another--same name and type (tinyint) columns.  But the Data Source View editor doesn't allow this, giving the message "...source and destination column have different data types".  But the columns are the same types.  I ahd this once before  acouple of years ago and don't remember how I got around it. Does anyong have ideas?  

Strange: Parser Error: Could not load type '_Default'.

i donot have any intentions till now of uploading my web project and just started working on MS VS9.0I made a simple Linq based project (CODE BEHIND used)AS i compiled it i got Parser Error: Could not load type '_Default'.I figured out 2 solutions for this(WHICH I CUDNT FIND IN MANY FORUMS). But nt sure...why doing them solves the problem.SOL 1)The easy way out is to uncheck "place the code in the seperate file" while adding an item.and then adding the statement <%@ Import Namespace="System.Linq" %> on top of ur aspx as in:<%@ Page Language="C#" %><%@ Import Namespace="System.Linq" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">---FURTHER CODE----Sol2)If  we deal whith the CODE behind technique....and have already used "USING System.Linq; in the definition,I found a funny solution to the problem.In ur default page...the top line is<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="<namespace>.<class>" %>Now if i change the keyword from CodeBehind to CodeFile as in:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="<namespace>.<class>

COM Interop Error loading type library/DLL TYPE_E_CANTLOADLIBRARY error in Vista but not XP

I have created a .NET executable that is using a COM assembly that is located on a servers shared drive but am  having problems getting it to work on a number of machines. I have made sure to register the COM assembly using regsvr32 and doing that it works on the computer that I developed it on. From there I brought it over to a Windows XP computer where it didn't work. I received an error message saying "Error loading type library/DLL ... (TYPE_E_CANTLOADLIBRARY)", which was in reference to the COM assembly. After some trouble shooting I found that if I granted the executable FullTrust in the .NET security model the .NET executable was able to load the assembly and everything worked properly. From there I brought the executable to a Windows Vista computer, registered the COM assembly using regsvr32 and granted the .NET executable FullTrust in .NET but it doesn't work. I get the same error saying "Error loading type library/DLL ... (TYPE_E_CANTLOADLIBRARY)". Any idea why the same steps would work in XP but not in Vista? Am I missing something obvious? Any suggestions would be greatly appreciated.

Grand Totals showing "Type MisMatch" error

Hi All, I have created a calculated measure using Exponential and Datediff function, and the formula is shown below. ( (EXP((DateDiff( "d", CDATE([Time].[Date].CurrentMember.PrevMember.MemberValue), CDATE([Time].[Date]. CurrentMember.MemberValue)))/365.0 * [Measures].[CD Dec Interest Rate]) -1) * ([Time].[Date]. CurrentMember.PrevMember.PrevMember,[Measures].[Cummulative_Premium])   ) In the above formula what i am trying to achieve is finding the difference between previous date and current no of days in days and dividing it by 365 and doing some multiplication after that, When i deployed above formula all my row values are getting displayed correctly but all my grand totals are displaying as "#VALUE" and when i checked the error, it displays as TYPE MisMatch. Could some one help me in finding the problem in above formula. Thanks in advance.

Java - Type not defined error with ReportViewerWebControl.axd

I've been searching for several days now looking for threads / solutions in regards to a Report Viewer Problem. OS - Windows Server 2008 all updates installed DN FW - 3.5SP1 and 4.0 ReportViewer.exe was and is installed (Version 10.0.30319.1) The ReportViewer Assemblies are in the GAC The project is a Visual Studio 2010 project The application is running in it's own App Pool with the 4.0 framework in integrated mode In order to pin this down I have reduced a test project to an empty page with a Report Viewer Control and a Button. There is no DataSource and no report associated with the viewer, just the empty viewer control. The web application runs without errors on my dev box and on a new test environment (with the Web Server in a VM) that I set up to test with. When I deploy to our test or staging servers the page fails with Java Script errors. The error that is the root cause is "Type is undefined" which is referring to Reserved.ReportViewerWebControl.axd.  When using the developer tools for IE the script is loaded but fails at Line 1 of the script Type.registerNamespace("Microsoft.Reporting.WebFormsClient"); with the message Type is undefined.   'Type' ist undefiniert  Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=10.0.30319.1&Name=ViewerScript, Zeile 1 Zeichen 1 When I call the ReportViewerWebCont

Timer job intiation error: SharePoint cannot deserialize an object of type

Hi All, when i run a timer job (One-Time timer) it has added it to Timer Job definitions in the Central Administration. I have checked the Log file in 12 hive and found the following error..... "SharePoint cannot deserialize an object of type xyz.xyzJob, xyzTimer, Version=, Culture=neutral, PublicKeyToken=<token> on this machine. This typically occurs because the assembly containing this type is not installed on this machine. In this case, this message can be safely ignored. Otherwise, the assembly needs to be installed on this machine in a location that can be discovered by the .NET Framework." The above error says that the assembly is not added.... but it has been already added to the GAC. Can anyone guide me about the issue and how to resolve that........?

Error from AS2005 - Binding for column 'xxxxx' is not a ColumnBinding type

I've seen this question come up a couple times on the public .olap newsgroup, but I've never seen an answer, so I'm going to give it another try:I'm getting an error when I try to incrementally process my SSAS 2005 cube:    Errors in the high-level relational engine. The binding for the 'column-name' column is not a ColumnBinding type.In this case, the column name that's given is a name that occurs in only 1 table in the underlying schema, so I know unambiguously which column it's talking about.  The relevant part of the schema is roughly this:create table Date(    DateID int not null primary key,     /* ... */);create table File(    FileID int not null primary key,    FileDateID int not null foreign key references Date(DateID),    /* ... */);create table Fact(    /* ... */    DateID int not null foreign key references Date(DateID),    FileID int not null foreign key references File(FileID));The column that's named in the error message is File.FileDateID.  Note that this is not a pure snowflake schema - there's a "loop" that associates files with dates in addition to other date relationships within the main fact table.  I'm just guessing that the root of the problem has something to do with non-snowflake-ness of the schema.  Full processing of the database/cube works fine - it's only when I try to process incrementally or create aggregations that I get thi
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