.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

Exception caused by DataPager.SetPageProperties() on ListView (postback error)

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :ASP.Net
 Hi, I have a issue with drives me crazy! I'm using the DataPager method SetPageProperties() to restore the current page in my listview after I navigated into a page related to a listview item. (I persist the current page in the session state) I display 10 items at a time, and there are 10 pages. Everything works perfectly for the first 100 items, .... but after I go beyond (to display pages 11 to 20), if I call SetPageProperties() to restore the proper "current" page, I cannot submit anymore anything without getting the following exception: An error has occurred because a control with id 'ctl00$ctl00$ContentPlaceHolder$ContentPlaceHolder1$m_ListViewSearchItems$lvProductsPager$ctl00$ctl10' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error. The exception refers to the DataPager sub-controls which are not rendered the same way for first pages (1 - 10) than (11 - 21); Is that because it expect then a "previous page" button? I don't quite know what to think about it. Does anyone have a clue?

View Complete Post

More Related Resource Links

Display a nested child ListView on PostBack while using DataPager on parent ListView


Hello ASP.NET community,

I am having trouble finding how to solve the following issue :

I am using nested listviews to display Sales and Sales details.

The main ListView displays General Information about Sales and the child ListView displays the detailed information about one sale. the child listview is shown only when the user clicks on a link (see included code, DataBind is made on PageLoad) :

ASPX Markup Code :

<asp:listview id="lvSales" runat="server" onitemdatabound="lvSales_ItemDataBound">
<table cellspacing="0" border="1" width="250" style="border-collapse:collapse;">
<tr runat="server" id="headerRow">
<th scope="col" style="width:30px;"></th>
<th scope="col">SaleNumber</th>
<tr id="itemPlaceHolder" runat="server" enableviewstate="true"/>
<tr id="row" runat="server">
<td style="text-align:center;"><asp:button id="btnShowHideDetails" runat="server" oncommand=&qu

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

ListView DataPager with SQL-Statements that already return only paged data.



As far as I understand the ListView-Control and the DataPager-Control, they work like this: The ListView gets its datarows from its data source, then the DataPager causes the ListView to display only a subset of those rows.

So what, when I want to use custom databinding for the ListView, that *already* gets the certain subset from SQL-Server (for better performance). Can I and how can I use the DataPager then?

Thanx, S.

Error while using exception handling block el 4.1


Hi Folks,


i am trying to use tyhe exception handling block of Enterprise library 4.1.


I just createda polisy and used IndexOutOfRangeException and added a replace handler and a logging handler to it.

I am using the NotifyRethrow PostHandlingAction to the exception.


During runtime I am getting an exception on the HandleException event, The exception is added below:



Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 42:             catch (Exception ex)
Line 43:             {
Line 44:                 bool reThrow = ExceptionPolicy.HandleException(ex, "ReplacePolicy");
Line 45:         

Error Handling: Throwing Custom Exception Types from a Managed COM+ Server Application


Exception handling semantics in .NET are based on type, so you can create custom exceptions that have their own properties and methods. In .NET, exceptions are first-class citizens, and since they're the built-in error handling mechanism, all .NET-compliant languages must support exceptions. In addition, COM+ services are available to .NET code as Enterprise Services, so you can leverage exceptions in your Enterprise Services design.In this article the author describes custom exceptions, throwing exceptions across COM interop boundaries, and working with Enterprise Services.

Bob DeRemer

MSDN Magazine March 2004

How to CATCH "Invalid postback or callback argument" exception?



How can I catch this exception? I do not want it to stop my page execution. Can/Should I do that?

Server Error in '/' Application.
Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
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.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally

2008 R2 Tuning Advisor reports "Error: Exception encountered(DTAEngine)"

I am encountering an error when I try to use the SQL 2008 R2 Database Engine Tuning Advisor. I create a very simple workload (either by right-clicking a query in SSMS or by loading a file), and click Start Analysis.  In the "Consuming Workload" step DTA aborts, and in the message column displays "Error: Exception Encountered(DTAEngine)". When I click on the error message, I get a dialog box with a title of DTAEngine, and a message "Error: Exception encountered". This is a clean test environment (SQL 2008 R2 Data Center Edition 64-bit, on Windows Server 2008 R2 64-bit, in a VM) against a local database. Any ideas about what the problem is or how to resolve it? See below for detailed version information: 10.50.1600.1 RTM Data Center Edition (64-bit) Database Engine Tuning Advisor      10.50.1600.1 Microsoft Data Access Components (MDAC)      6.1.7600.16385 Microsoft MSXML      3.0 6.0 Microsoft Internet Explorer      8.0.7600.16385 Microsoft .NET Framework      2.0.50727.4952 Operating System      6.1.7600    

Error: A native exception has occurred in my_file.exe

Hello everyone,   This error is occurring with me when I am working with SSCE in my pocket PC. Can anyone tell me why?   Thanks!

"Format exception was unhandled by user" error. . .please help. . urgent!

Hi to all developers. I'm developing a survey site and i got this error 'Format exception was unhandled by user'. .  please help me deal with this. . any help is much appreciated. .here is where the error occured(2nd line):If Not Request.QueryString("DeptCode") Is Nothing Then            Dim DeptCode As Double = Double.Parse(Request.QueryString("DeptCode"))            Session.Add("DeptCode", DeptCode)        Else            Response.Redirect("default.aspx")        End Ifthanks in advanced. .

how can we show error in our application when exception occur in webs service

how can we show error in our application when exception occur in webs service

Pass exception details to custom error page.

Hi All, I created a custom error page and update using webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, CustomErrorPage). Its working fine and my custom error page is show if error is occurred. OR We redirect using SPUtility.RedirectToErrorPage("my message"); But I am not able to find my exception details at my custom error page. Is there any way to pass the exception details and other custom information to custom error page?  

Error .Cummunication Exception was unhandle

Hello Friends,   I was downloaded the SCVMM WCF code and made some modification. I got error CommunicationException was unhandle "The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element."     Please Help me to solve the problem, Regards rajivbirari

Internal Server Error Exception when Searching (in CoreResultsWebPart::OnInit)

Hello, We are encountering an "Internal server error exception" when we attempt to search. The relevant error in the ULS log is:   CoreResultsWebPart::OnInit: Exception initializing: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.SetPropertiesOnQueryReader()     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.OnInit(EventArgs e)   This is occurring on a fresh install of SharePoint Server 2010 Standard Edition running on a single-server farm.  We have tried:   ensuring that hotfix 976462 is installed (it is) ensuring that the "SharePoint Server Search" and "Search Query and Site Settings Service" services are running (they are) removing, then reinstalling the search application (tried, but with no luck) appending ":80" to the host of portion of the search result url to see if we get a different result (we do not) ensuring that the application pool is assigned correctly (it is) restarting the timer service restarting the search service rebooting For the sake of conversation, we'll say the server is named "pharaoh". It has the following AAMs: http://pharaoh:8888, Default Zone  (Central Admin) http://pharaoh, Default Zone   All services and applicati

Error while reading values on postback

I have some problems with trying to read values on a postback.The fields, textboxes and dynamiclly created fields doesn't keep their values or I'm doing something wrong when trying to read the values. I get an error message: System.NullReferenceException was unhandled by user code  Message="Object reference not set to an instance of an object."  Source="App_Web_m-6qot6q"  StackTrace:       at Sikt.RäknaVärden() in C:\Visual Studio 2005\WebSites\Kalibreringscertificat\Sikt.aspx.vb:line 688       at Sikt.Button1_Click(Object sender, EventArgs e) in C:\Visual Studio 2005\WebSites\Kalibreringscertificat\Sikt.aspx.vb:line 892       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)       at System.Web.UI.Page.ProcessReque

Expression evaluation caused an overflow error when calling ExecuteResultSet(SqlServerCe.ResultSetOp

HelloWhen I call ExecuteResultSet(SqlServerCe.ResultSetOptions.Scrollable) I am getting the following error when the data type is Numeric(18, 4):Expression evaluation caused an overflow. [ Name of function (if known) =  ]The numbers involved are not that big and work fine when ExecuteReader() or ExecuteResultSet(SqlServerCe.ResultSetOptions.None) are called on the same SQL.Any ideas? Thanks in advance!Cheers,DaveCode:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click        Dim errorDescription As String = String.Empty        Dim numericNumber As String = String.Empty        Try            Using sqlCE As New System.Data.SqlServerCe.SqlCeConnection("Data Source = '" & My.Application.Info.DirectoryPath & "\MyDatabase.sdf';")                sqlCE.Open()                Dim sqlCECommand As SqlServerCe.SqlCeCommand = sqlCE.CreateCommand()                sqlCECommand.CommandText = "SELECT SUM(MT.TPM_Measure1) AS CurrentAmount FROM BUS_Table MT"                System.Diagnostics.Debug.WriteLine(sqlCECommand.CommandText)                Dim reader As System.Data.IDataReader = Nothing                If RadioButton1.Checked Then                    reader = sqlCECommand.ExecuteReader() 'Works fine                ElseIf RadioButton2.Checked Then                    reader = sqlCECommand.ExecuteRe

Getting Error " Error occurred in deployment step 'Add Solution': Exception from HRESULT: 0x810702

i'm getting the following error when deploying my sharepoint project i've created 3 site templates by adding according to this article http://www.sharepointbits.com/blog/sharepoint-2010-custom-site-templates.html but when i deployed my project i got the following Error occurred in deployment step 'Add Solution': Exception from HRESULT: 0x8107026E

SQLVDI error in eventlogs, caused by ntbackup

I wanted to prevent ntbackup from locking my databases during the nightly backup,  so I excluded the ...\Data folder from the backup set.  However, I think that ntbackup is backing up the databases during the volume shadow copy phase of the backup, even though their folder was excluded from the backup set (I verified this setting in the .bks file).  Although the lock only lasts a few seconds, the error message is worrisome and I would prefer to skip the databases completely.  How can I stop the volume shadow copy from doing this? Below is the the sequence of events leading up to the error, most recent first: Event Type: ErrorEvent Source: SQLVDIEvent Category: NoneEvent ID: 1Date:  3/23/2007Time:  3:01:49 AMDescription:SQLVDI: Loc=CVDS::Cleanup. Desc=Release(ClientAliveMutex). ErrorCode=(288)Attempt to release mutex not owned by caller.. Process=8684. Thread=7556. Client. Instance=. VD=. Event Type: InformationEvent Source: MSSQLSERVEREvent Category: (6)Event ID: 18264Date:  3/23/2007Time:  3:01:48 AMDescription:Database backed up. Database: master, creation date(time): 2007/03/12(15:08:23), pages dumped: 1, first LSN: 268:352:37, last LSN: 269:24:1, number of dump devices: 1, device information: (FILE=1, TYPE=VIRTUAL_DEVICE: {'{66DC3082-FB76-4312-AD74-4BDAD9FC7209}1'}). This is an informational message only. No user action is required. Event Type: InformationEvent Source: 
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