473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

"System.Web.HttpException: External component has thrown an exception" if OnSortCommand attribute is present in a datagrid control

JT
This seems like it could be an asp.net bug. I am getting the following
exception when I add OnSortCommand attribute to a datagrid. I have
deleted the temp directories, rebooted etc and I have isolated it to
the OnSortCommands presence. When I use a code behind it doesn't fire
any events on the back end and the global error handler grabs it. I
put together a very simple example to illustrate the problem below. If
anyone has an idea of why this is happening I'd appreciate it.
+ _errorMessage {"System.Web.HttpException: External component has
thrown an exception. ---System.Web.HttpCompileException: External
component has thrown an exception.\r\n at
System.Web.Compilation.BaseCompiler.ThrowIfCompile rErrors(CompilerResults
results, CodeDomProvider codeProvider, CodeCompileUnit sourceData,
String sourceFile, String sourceString)\r\n at
System.Web.Compilation.BaseCompiler.GetCompiledTyp e()\r\n at
System.Web.Compilation.PageCompiler.CompilePageTyp e(PageParser
pageParser)\r\n at System.Web.UI.PageParser.CompileIntoType()\r\n
at
System.Web.UI.TemplateParser.GetParserCacheItemThr oughCompilation()\r\n
--- End of inner exception stack trace ---\r\n at
System.Web.UI.TemplateParser.GetParserCacheItemInt ernal(Boolean
fCreateIfNotFound)\r\n at
System.Web.UI.TemplateParser.GetParserCacheItem()\ r\n at
System.Web.UI.TemplateControlParser.CompileAndGetP arserCacheItem(String
virtualPath, String inputFile, HttpContext context)\r\n at
System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context)\r\n at
System.Web.UI.PageParser.GetCompiledPageInstanceIn ternal(String
virtualPath, String inputFile, HttpContext context)\r\n at
System.Web.UI.PageHandlerFactory.GetHandler(HttpCo ntext context, String
requestType, String url, String path)\r\n at
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean
useAppConfig)\r\n at
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()\r\n
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step,
Boolean& completedSynchronously)"} System.Data.SqlTypes.SqlString


<%@ Page language="c#" %>
<%@ Import Namespace="System.Data" %>
<HTML>
<script language="C#" runat="server">

ICollection CreateDataSource() {
DataTable dt = new DataTable();
DataRow dr;

dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
dt.Columns.Add(new DataColumn("DateTimeValue",
typeof(DateTime)));
dt.Columns.Add(new DataColumn("BoolValue", typeof(bool)));
dt.Columns.Add(new DataColumn("CurrencyValue",
typeof(double)));

for (int i = 0; i < 9; i++) {
dr = dt.NewRow();

dr[0] = i;
dr[1] = "Item " + i.ToString();
dr[2] = DateTime.Now;
dr[3] = (i % 2 != 0) ? true : false;
dr[4] = 1.23 * (i+1);

dt.Rows.Add(dr);
}

DataView dv = new DataView(dt);
return dv;
}

void SortCommand_Click(object source, DataGridSortCommandEventArgs
e)
{
//dv.Sort = e.SortExpression;
//dgTransactions.DataBind();
}

void Page_Load(Object sender, EventArgs e) {
MyDataGrid.DataSource = CreateDataSource();
MyDataGrid.DataBind();
}

</script>
<body>
<h3><font face="Verdana">Specifying Columns in
DataGrid</font></h3>
<form runat="server" ID="Form1">
<ASP:DataGrid id="MyDataGrid" runat="server"
BorderColor="black" BorderWidth="1" GridLines="Both"
CellPadding="3" AllowSorting=true
OnSortCommand="SortCommand_Click" CellSpacing="0" Font-Name="Verdana"
Font-Size="8pt" HeaderStyle-BackColor="#aaaadd"
AutoGenerateColumns="true">
<Columns>
<asp:BoundColumn HeaderText="Integer"
DataField="IntegerValue" />
<asp:BoundColumn HeaderText="Date/Time"
DataField="DateTimeValue" />
<asp:BoundColumn HeaderText="String"
DataField="StringValue" />
<asp:BoundColumn HeaderText="True/False"
DataField="BoolValue" />
<asp:BoundColumn HeaderText="Price"
DataField="CurrencyValue" DataFormatString="{0:c}"
ItemStyle-HorizontalAlign="right" />
</Columns>
</ASP:DataGrid>
</form>
</body>
</HTML>

Nov 10 '06 #1
0 2636

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Berata | last post by:
Hello all, in VB6 we were able to create ActiveX-DLL's (In Process Components) and ActiveX-Exe's (Out of Process Components). We habe build up an application that exists of an main module...
0
by: Peter O'Reilly | last post by:
I receive the following error when I post a webpage: "Unable to validate error" - System.Web.HTTPException. The web page is an ASP WebForm page. I have a few controls on the page that when...
3
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I...
2
by: Rossco | last post by:
I have a VB.NET serviced component (COM+), running on a lan, that calls out to an external web service to place an order with a supplier. The problem machine is the middle tier (COM+) for our in...
2
by: alex | last post by:
I need to set a directory with hidden and/or system attribute from my c# code. Similar to what is c:\RECYCLER folder set to in WinXP. So it is not visible to a user with default "Folder Options". ...
2
by: Gnus | last post by:
Hi all! I have a little(?) problem with external schema location... I'm using xerces/xalan (C++) for doing some actions with some set of xml-files. Some of these files must validating...
3
by: =?Utf-8?B?Q3ltZXI=?= | last post by:
When the datagrid has multi rows and the vertical scrollbar hasn't appeared, if I click the column near the bound or drag horizontal scrollbar, this exception will be throwed. The trace stack as...
0
by: Fresno Bob | last post by:
I get the following very intermittant error. System.Web.HttpException: Unable to validate data. at System.Web.Configuration.MachineKeySection.GetDecodedData The form encoding type is for...
0
by: Schadrach | last post by:
I'm having a strange problem, I have a small executable that runs a backup for a some data nightly, and as of September 22, 2007 it has ceased to function with the following error: Unhandled...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.