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

Top 5 Contributors of the Month
Post New Web Links

System.ArgumentOutOfRangeException 'ComboBox' has a SelectedIndex which is invalid because it does

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net


I think I have a complicated one here.

Synopsis: I have a AJAX enabled ASP.Net application, the purpose of which is to allow users to ad hoc drill an engineering database.  The application UI is divided into three sections, Filtering, Column Selection, and Results. The filtering section (implemented as a user web control) uses a PlaceHolder control, to which I allow addition and removal of individual Filter user controls.

All of that works well. The Filter user control essentially consists of three ComboBox controls with SqlDataSources bound to each of those ComboBoxes, and a TextBox to enter in a value. The first ComboBox, once a value is selected in its list, passes the SelectedValue to the SqlDataSource of the next ComboBox, which uses that value as a Select Parameter so the DataSource can fill out the ListItems of the next ComboBox. So simply, the results of the previous one cascade to the next.

Again, all this worked well. But one of the requirements was to allow storage of these queries the customer comes up with, allowing them to reload the query at a later time to run again.

I implemented that by writing a simple set of container classes, Filter, Column, and Query, where Query has public arrays of Filters and Columns. I serialize that simple Query object, then store it as XML in my database. To reload i

View Complete Post

More Related Resource Links

System.InvalidOperationException: Invalid attempt to read when no data is present.


Invalid attempt to read when no data is present.

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.InvalidOperationException: Invalid attempt to read when no data is present.

Source Error: 

Line 53:             if (reader.HasRows)
Line 54:             {
Line 55:                 Response.Write(reader.GetString(0));

Here is my code:

Not successful with SelectedIndex = -1 for Combobox

My Windows form has three comboboxes. Combobox2 references a child table of combobox1, and Combobox3 references a child table of combobox2. I want the three comboboxes not to show a selectedItem until the user selects a value.  I have this set when the Form is first shown:         private void Form1_Shown(Object sender, EventArgs e)         {             this.comboBox1.SelectedIndex = -1;             MessageBox.Show("You are in the Form.Shown event.");         }          private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)         {             if (isClosing == false)             {                 try                 {                     String cb1Value = comboBox1.SelectedValue.ToString();     

" 'System.ArgumentOutOfRangeException' occurred in PresentationCore.dll " while adding items to Ob

I have custom workflow designer in wpf application.
So there is a toolbox with activities.
I have collection of toolbox items in toolbox:

public ObservableCollection<WorkflowToolbox> Items
            get { return (ObservableCollection<WorkflowToolbox>)GetValue(ItemsProperty); }
            set { SetValue(ItemsProperty, value); }

// Using a DependencyProperty as the backing store for Items.  This enables animation, styling, binding, etc...
 public static readonly System.Windows.DependencyProperty ItemsProperty = System.Windows.DependencyProperty.Register("Items", typeof(ObservableCollection<WorkflowToolbox>), typeof(WorkflowToolboxContainer), new UIPropertyMetadata(new ObservableCollection<WorkflowToolbox>()));

Then every time i close/open that component in UI this collection  is cleared and populated with new items.

WorkflowToolbox toolBox = new WorkflowToolbox { DataContext = assembly };

And after 2 open/reopen i had ArgumentOutOfRangeException with stack trace:
   at System.Windows.Me

System.Data.SqlClient.SqlException: Invalid object name


I am getting this error message

System.Data.SqlClient.SqlException: Invalid object name 'Members'.

The database name is ACEStaff

I copied it accross from my old server to my new one

The table name in the database is Acestaffrm.members. Is the Acestaff prefix giving me this problem. I notice other table have dbo. prefix

Any suggestions on the problem here



SSRS 2008 ERROR - rsProcessingAborted:System.ArgumentOutOfRangeException: Index was out of range. Mu



I am using SQL Server 2008 R2 Ent. Edition 64 bit reporting services. The source data for report is at remote server and it is SQL Server 2005 Ent. Edition (though I don't think this matters here.) I have set the <WorkingSetMaximum> to 5GB for SSRS

I am testing the performance of report server and running a report with 100K records with 20 concurrent users. All 20 reports gets executed successfully. When I try with 25 or 30 users only 21 reports execute successfully when I see the ExecutionLog table. I see this exception in the report service log file. Please help.

ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: , Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during report processing. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatReader.RemoveReadOnlyMembers(List`1 declarations)
   at Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatReader..cto

System.Web.UI.ViewStateException: Invalid viewstate.


I had to switch to

sessionState mode="StateServer" timeout

System.Management.ManagementException: Invalid parameter


I have created a windows Service which invokes executables on remote machines, waits for it to complete and then proceeds to the next machine on the network.
The Account type for the windows Service is "Network Service". For monitoring if the process is completed on the remote machine, I am using ManagementEventWatcher class. I get the following error when I start the Management event watcher object.

System.Management.ManagementException: Invalid parameter
at System.Management.ManagementException.ThrowWithExt endedInfo(ManagementStatus errorCode)
at System.Management.ManagementEventWatcher.Start()

The code (VB.net 1.1) I am using is as follows:

Dim connection As New System.Management.ConnectionOptions
connection.Username = v_sUserName
connection.Password = v_sPassword
connection.EnablePrivileges = True

Dim oPath As New ManagementPath("\\" & v_sServerName & "\root\CIMV2")
Dim oScope As New System.Management.ManagementScope(oPath, connection)
oScope.Options.Impersonation = ImpersonationLevel.Impersonate

Dim processClass = New System.Management.ManagementClass("Win32_Process")
processClass.Scope = oScope

Dim inParams = processClass.GetMethodParameters("Create")

Getting "System.UriFormatException: Invalid URI: The URI is empty."


I have some code which is a wrapper "DLL" I used the DLL in a VB6 app in order to call a web service, and invoke a web method. I'm using the same DLL wrapper for an ASP.NET 2008 web portal site. The wrapper class was created in VS 2008. A little about the wrapper code: Basically I create a BasicHttpBinding object, set the basic propties of the object, this way I can eliminate te need for a web config in the wrapper class. I then create my proxy object for the web service in which I’m going to call within the wrapper class passing it the BasicHttpBinding an a new EndpointAddress. The wrapper class exposes a single method, see code below:

Paraemters defined:

pwd: password in order to login to web service

System.ArgumentException: Invalid postback or callback argument.


Is there a good way to test and debug these errors.  I constantly get them emailed to me from my production site but I can not duplicate them.  Below is the entire error.

User: jbrown
Session[STUser] = DAL.stUser
Session[PlaylistName] = Adult Contemporary Holiday Blend 2010 (vol. 2)
Session[PlaylistId] = 3865
Session[SES-FAN] = SessionFan
Session[fullPreview] = yes
System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using 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. at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Exception of type 

StringBuilder.ToString() Throws a System.ArgumentOutOfRangeException Index was out of range


I have the following code to show a logging window that has the last 64000 chars of code. Every new line I add the first line will be deleted:

m_sbText = new StringBuilder(65000);

private void AddLine(string LogMessage)
   if (m_sbText.Length > 64000)
      m_sbText.Remove(0, m_sbText.ToString().IndexOf("\n") + 1);
   textBoxLog.Text = m_sbText.ToString();

When I let this run the first time I got an OutOfMemory exception because I forgot to add

textBoxLog.UndoLimit = 0;

So this UndoLimit problem is still happening in WPF dot net framework 4. 

I added the UndoLimit and let this run for a night. Once every few hours the textBoxLog.Text = m_sbText.ToString(); line raises a System.ArgumentOutOfRangeException Index was out of range exception on StringBuilder.ToString(). Because I do not do anything with the Index I suspect the StringBuilder to mess up internal indexes.

Ajax toolkit error : System.InvalidProgramException: Common Language Runtime detected an invalid pro


I have website that uses .NET 3.5 and Ajax tool kit.  The strange thing is it works fine in two environments but it errors with the following error on production site:


Server Error in '/UPS' Application.

Common Language Runtime detected an invalid program.

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.InvalidProgramException: Common Language Runtime detected an invalid program.

Source Error:

Line 13:     <aj:ComboBox ID="ComboBox1"  runat="server">
Line 14:     </aj:ComboBox>
Line 15:     <aj:MaskedEditExtender MaskType="Number" ID="MaskedEditExtender1" Mask="(###)" TargetControlID="txt1" runat="server">
Line 16:     </aj:MaskedEditExtender>
Line 17:   

Source File: d:\Search\UPS\TestAjax.aspx    Line: 15

Stack Trac

System Development Life Cycle

The Systems Development Life Cycle (SDLC) is a conceptual model used in project management that describes the stages involved in an information system development project from an initial feasibility study through maintenance of the completed application. Various SDLC methodologies have been developed to guide the processes involved including the waterfall model (the original SDLC method), rapid application development (RAD), joint application development (JAD), the fountain model and the spiral model. Mostly, several models are combined into some sort of hybrid methodology

The Agile System Development Life Cycle (SDLC)

The goal of this article is to describe the agile system development life cycle (SDLC), putting it in context from what you may have heard about within the agile community and more importantly within the context of your overall IT efforts.

Performance Tests: Precise Run Time Measurements with System.Diagnostics.Stopwatch

Everybody who does performance optimization stumbles sooner or later over the Stopwatch class in the System.Diagnostics namespace. And everybody has noticed that the measurements of the same function on the same computer can differ 25% -30% in run time. This article shows how single threaded test programs must be designed to get an accuracy of 0.1% - 0.2% out of the Stopwatch class. With this accuracy, algorithms can be tested and compared.



hello i have the following problem

i have upload my content to hosting server but i get the following error

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of typ

Problem upgrading to MVC3 - System.Web.Routing



I'm trying to upgrade to .NET 4 and MVC 3.

When trying to compile my project, I get the error:

Error 1 The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) C:\Users\spencer\Desktop\weblauncher\Common\MVCConfig.cs 4 18 Common

The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

I do have the System.Web.Routing in my references for the project.

BUT - when I try to view System.Web.Routing in the OBJECT BROWSER, nothing is inside!  The System.Web.Routing namespace is not in there - the entire thing is empty!  Could it that the dll is corrupted?  I tried to reinstall the .NET 4 and MVC 3 stuff, but its still empty!

The dll is coming from here:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Routing.dll

and the runti

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPerm


Good Day all,

Having an issue with an outside user accessing my IIS7 box. I do not have this problem when running the website from my host machine. I found this post: Http://forums.asp.net/t/1371394.aspx. I assure you that this is not a solution because I am not storing any of my files on a network share. 

What do you think my approach should be. 

I already have read rights to IIS user to my BIN folder. 

Thanks for the help. 

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