Site Went Down With Dictionary Throwing Index Outof Range Exception?

Jul 20, 2010

I have a static dictionary object which hold some Key and Value pairs in our site.We are getting Indexoutofrange exception some times and we couldn't figureout the problem why it is causing.This error is logged several times in the log file and site went down.Do you have any idea why this is happend?Please provide your advice ASAP as we are facing this issue in live server.

View 6 Replies


Similar Messages:

Forms Data Controls :: DataView Throwing Exception - Index Out Of Range

Jul 13, 2010

A dataview is throwing an out of range exception when a page submit button is clicked. The strange part is if you change the data in the dataview by selecting a different person in the DDL the page works fine. Its only when the page loads and the default person in the DDL is when the DataView throws the exception.

The exception is thrown on the last line when I add DV.Rows(0).Cells(1).Text to the id_num parameter. I know there is a value in the dataview because it is displayed on the page. I can refresh the dataview with another person's information and the code works fine. This really has me confused. Here is a bit of the code behind.

Dim dashDataSource
As
New
SqlDataSource()
dashDataSource.ConnectionString =
ConfigurationManager.ConnectionStrings("SSSConnectionString2").ToString()
dashDataSource.InsertCommandType =
SqlDataSourceCommandType.Text
dashDataSource.InsertCommand =
"INSERT INTO tblAcadReferrals(all columns and parameter info here)"
dashDataSourceInsertParameters.Add("id_num", DV.Rows(0).Cells(1).Text)

View 7 Replies

Forms Data Controls :: Index Was Out Of Range - Throwing Error

Apr 3, 2010

Server Error in '/EBOOKS' Application.

Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

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.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

Source Error:

Line 61: Dim favorname As String = GridView1.DataKeys(row.RowIndex).ToStringLine 62: Line 63: ' Pass the value of the selected Employye ID to the Delete //command. My coding as
Protected Sub btnMultipleRowDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnMultipleRowDelete.Click
' Looping through all the rows in the GridView
For Each row As GridViewRow In GridView1.Rows
Dim checkbox As CheckBox = CType(row.FindControl("cbRows"), CheckBox)
'Check if the checkbox is checked.
'value in the HtmlInputCheckBox's Value property is set as the //value of the delete command's parameter.
If checkbox.Checked Then
' Retreive the Favorname
Dim favorname As String = GridView1.DataKeys(row.RowIndex).ToString
' Pass the value of the selected Employye ID to the Delete //command.
SqlDataSource1.DeleteParameters("Favorname").DefaultValue = favorname.ToString()
SqlDataSource1.Delete()
End If
Next row
End Sub
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
Width="563px" AutoGenerateColumns="False">
<RowStyle CssClass="fontsmallthennormal" />
<HeaderStyle CssClass="fontnormalblue8" />
<EditRowStyle CssClass="fontsmallthennormal" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="cbRows" runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Favorname" HeaderText="Favorname" SortExpression="Favorname" />
<asp:BoundField DataField="FavorDate" HeaderText="FavorDate" SortExpression="FavorDate" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1"
ConnectionString="<%$ ConnectionStrings:yyyy %>"
runat="server" SelectCommand="SELECT [US], [Favorname], [FavorDate] FROM [TBL_FAVORITES] WHERE ([US] = @US)"
DeleteCommand="DELETE from TBL_FAVORITES where [Favorname]= @Favorname"
>
<SelectParameters >
<asp:ControlParameter ControlID="txtusername1" Name="US" PropertyName="Text" Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="Favorname" />
</DeleteParameters>
</asp:SqlDataSource>

View 5 Replies

Error - Index Out Of Range Exception When Storing Into .net Session?

Oct 7, 2010

I'm building a web app that to build a report, but there are too many arguments to give each one a name, and I want to save them indexed by numbers so I can handle them with loops later on throughout the application.However, I'm getting an index out of range on the very first session item(0)...as I understand it, I don't have to instantiate a session myself and this should work right?

Session[0] = txtComplianceCaseID.Text;
Session[1] = ddlState.SelectedValue;
Session[2] = txtActingSupervisor.Text;
Session[3] = ddlRiskTolerance.SelectedValue;

View 2 Replies

Forms Data Controls :: Index Was Out Of Range - Exception In GridView

Mar 21, 2010

I have used the DataKeyNames property of the GridView to assign the column name whose visible property is set to false to get the cells value when the column is kept invisible. But, sometimes there is an error on this line of code - string cellValue = GridView.DataKeys[e.NewEditIndex].Value.ToString(); Following Error is generated -

Server Error in '/' Application. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index 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.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

View 5 Replies

VS 2005 Error Index Out Of Range / Exception Was Unhandled By User Code

Jul 11, 2012

You can for example enter the length and width of the web (VS.NET2005), when it runs out of range index error exception was unhandled by user code for chieudai

Code:
public class Tinh
{
private Int32 _quanhuyen;
private String _diachiNha;
private Double _chieudai;
private Double _chieurong;
private Double _dientichDat;
}

[Code] ....

View 3 Replies

Throwing Exception Message Giving Internal Server Error HTTP Code 500 On Live Site

Oct 4, 2010

using vb.net/asp.net 2005

when a user enters a bad email I am doing a check on this and throwing an exception message as follows, this works fine on the test site but for some reason the same code on the live site gives a "internal server error" (http code 500). The code below:

[Code]....

not certain why this is happening, I assume that it's some server or config difference between the test and live sites. has anyone seen this before? For a quick fix i'm registering javascript alert and showing the same text so it works but I would like to figure out why the code above is not working.

View 1 Replies

What Is The Point Of Throwing An Exception

Apr 15, 2010

What is the point of throwing an exception? It it anyways going to be caught in the Global.asax Application_Error method.

Lets say in the following code we throw an exception.

try {
using (var dc = GetDataContext())
{
// We are doing some data inserts here.
}
catch ( Exception ex)
{
throw ex;
}

My Question: Even if we do not use try catch and throw here, any exception which will be raised here will be caught inside Application_Error method in Global.asax. Then what is the point of try, catch and throw in this case?

View 7 Replies

Throwing Exception To Get A Message Back To UI?

Feb 3, 2010

I have an asp.net application with separate classes for business logic and database interaction and then of course the UI. I am building a form to add a widget to a widget list table in the database. My UI collects the information and submits it to the business class. I'm going to write the business class to first double check that the widget has a name (I know I should do this in UI with validation, and I will, but this is just in case validation is forgotten) and if it does, go ahead and send the information to the database class. The database class will then attempt to write the info to the correct table using a try catch finally block. Any errors caught here are logged and then rethrown so I can inform the user. So, knowing that my database class may rethrow an error, my business class code will also be written in a try catch finally block.

So at this point I have a number of possible outcomes that I want to inform the user via the UI:

1) Everything was fine and the widget was added.

2) Something happened with the database write and the user should try again later.

3) The user forgot to name the widget.

My question is: should I write my UI in a try catch block and then throw a custom Exception with an Exception.Message in the business layer if anything goes wrong, or just have my business logic return a string that is the message? I'll want to know if the process was successful or not, because I'll want to format the actual message differently, so I'd have to use if...elseif to determine if the message was bad or not.

It seems like throwing a custom Exception in the business layer may be a good way to tell the UI something bad happened. If the UI doesn't catch anything then of course the operation was successful. Then again throwing an exception for missing data seems a bit hefty.

View 6 Replies

C# - GridView.Columns[index].HeaderText Throws "Index Was Out Of Range" Error?

Jan 3, 2011

gvOff.DataSource = o.ViewData(dCity.SelectedValue);
gvOff.DataBind();
gvOff.Columns[0].HeaderText = "ZZZZZZZZ";
gvOff.Columns[1].HeaderText = "YYYYYYYY";
gvOff.Columns[2].HeaderText = "XXXXXXXX";

Header count is correct.

AutoGenerateColumns: Flase/True ( i tried both)
If i remove the gvOff.Columns[index].HeaderText portions, GridView works fine, but when i put the gvOff.Columns[0].HeaderText, i get the exceptional error.

, i couldn't solve it. If you need further info, inform me.

EDITED:

Hold on! I commented the HeaderText portion and tested
int i = gvOffer.Columns.Count;
I found count is 0 eventhough the columns print out with DataBind()... Why?
NOTE: AutoColumn in this case is set to true. I guess i will have to edit the column
names from DataTable.

View 1 Replies

ToolkitScriptManager Throwing Exception On Calling Page_ClientValidate

Jan 17, 2011

I am using AjaxToolkit 4.0 which suggests to use ToolkitScriptManager in place of ScriptManager. But when I am using ToolkitScriptManager, it throws javascript exception when Page_ClientValidate() in called from javascript. However, this error is not coming when ScriptManager is used. Can anybody tell me how to make Page_ClientValidate() run when using ToolkitScriptManager?

View 1 Replies

C# - Send Method Of SMTP Is Always Throwing An Exception

Mar 25, 2011

The send method of SMTP is always throwing an exception. The message is : Failure sending mail Here is my code:

MailMessage mm = new MailMessage();
mm.To.Add("Yuvraj.dhot@xxxxx.co.in");
mm.From = new MailAddress("Kumar.Chaudhari@xxxxx.co.in");
mm.Subject = "Ant Subject";
mm.Body = "Body Cha MEssag here ";
SmtpClient ss = new SmtpClient("localhost");
ss.EnableSsl = false;
try
{
**ss.Send(mm);**
Result.Text = "Message Sent";
Result.ForeColor = System.Drawing.Color.Green;
}
catch (SmtpException ex)
{
Result.Text = "Message Not Sent :
" + ex.Message;
Result.ForeColor = System.Drawing.Color.Red;
}

I also tried using

ss.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;

Now it doesn't throw any exception, it executes fine but receiver does not receive any mail in his inbox. How can I fix this? Edit - This is the stack trace im getting.................

View 3 Replies

Security - Prevent Web Caching Throwing Exception?

Jan 18, 2011

I am trying to stop the caching of web pages using the following snippets in the ASP.NET however its not working and showing following error to me,

Response.CacheControl = "no-store";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;

[code]...

View 2 Replies

Padarn Web Server Project Throwing Exception?

Feb 14, 2011

I'm testing our OpenNetCF's Padarn Web Server.

In one of their Hands-On-Labs (HOL P101), an exception is being thrown at

private WebServer m_padarnServer = new WebServer();

The exception reads, "Exception in ConfigSectionHandler".

If you have experience with Padarn, have you received this exception before? If so, can you shed some light as to what I may do to debug this error?

View 1 Replies

System.Configuration.ConfigurationManager Throwing Exception?

Mar 17, 2011

I am having this strange case, at first time when the page loades, everything goes fine. But as soon as I click on any link which makes any ajax request, after that, I get this error while trying to read the configuration."System.Configuration.ConfigurationManager.ConnectionStrings' threw an exception of type 'System.Web.HttpException"I am using asp.net mvc 1.0

View 2 Replies

Throwing Exception When Field Is Zero And Clicking Edit Linkbutton

Mar 22, 2010

I have a radcombobox in radgrid nested inside FormTemplate:

Code:

<telerik:RadComboBox Skin="WebBlue" Width="250px" Height="150px" runat="server"
ID="TitleCombo" OnDataBound="Title_DataBound"
SelectedValue='<%# Bind("Title") %>' AppendDataBoundItems="true"
OnSelectedIndexChanged="Title_SelectedIndexChanged" AutoPostBack="true" />

then i insert an item to the top of list (at zero index):

Code:

protected void Title_DataBound(object sender, EventArgs e)
{
var item = (RadComboBox)sender;
item.Items.Insert(0, new RadComboBoxItem("Select title...", "0"));
}

It works perfect but, IF the Title field is zero and you Click EDIT LinkButton it throws an exception: Selection out of range Parameter name: value I would say that it's expected as zero index does not exist at the moment when i click edit button. I bind the combo from within RadGrid1_ItemCreated event.

View 21 Replies

HttpContext.Current.Session Is Throwing Exception In Business Class

Sep 8, 2010

In our application we have to access session objects in business class. We are using HttpContext.Current.Session to get the session value. In some cases it returns the value but mostly its throwing a null reference exception(Object reference not set to an instance of an object). We have the following code Try

If HttpContext.Current.Session("Username") IsNot Nothing then
' Statements to be executed
End If
Catch ex As Exception
'Log to db
End Try

Here HttpContext.Current.Session("Username") is mostly throwing an exception "Object reference not set to an instance of an object" While debugging we found that HttpContext.Current itself is nothing.

View 2 Replies

Web Forms :: Fileupload / When Deployed App On Server And Accessed It From Client System Its Not Throwing Exception?

Nov 3, 2010

I m uploading file to a directory inside my website root directory like this-

[Code]....

I m getting exception-

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:Documents and SettingsAdminMy DocumentsVisual Studio 2008WebSitesElcomponics Sales-BDsamples&#65533;50841010_sd113201031833.pdf'.

Why so?

When i deployed my app on server and accessed it from client system. It is not throwing exception.What is the difference?

Still i want to confirm will it throw the same exception in case i deployed it to server and access it from client.

View 3 Replies

C# - Index Was Out Of Range

Feb 21, 2010

I get the index out of range exception when compiling my grid view to display a set of orders. It doesn't happen when I add a new row but it does occur when I try to delete or update a row. The designer is:

<asp:GridView ID="GridView1"
runat="server"
AutoGenerateColumns="False"
DataKeyNames=""
OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating"
OnRowCommand="GridView1_RowCommand"
ShowFooter="True"
OnRowDeleting="GridView1_RowDeleting">
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<ItemTemplate>
<asp:Button ID="editButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
</ItemTemplate>
<FooterTemplate>
<asp:Button ID="LinkButton2" runat="server" CausesValidation="False" CommandName="AddNew" Text="Add New"></asp:Button>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Order ID">
<EditItemTemplate>
<asp:TextBox ID="txtOrderID" runat="server" Text='<%# Bind("OrderID") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewOrderID" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("OrderID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
<EditItemTemplate>
<asp:TextBox ID="txtDate" runat="server" Text='<%# Bind("Date") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewDate" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Order Taken by">
<EditItemTemplate>
<asp:TextBox ID="txtOrderTaker" runat="server" Text='<%# Bind("OrderTaker") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewOrderTaker" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("OrderTaker") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Order By">
<EditItemTemplate>
<asp:TextBox ID="txtOrderBy" runat="server" Text='<%# Bind("OrderBy") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewOrderBy" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("OrderBy") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Lens Material">
<EditItemTemplate>
<asp:TextBox ID="txtMaterial" runat="server" Text='<%# Bind("Material") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewMaterial" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("Material") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tint">
<EditItemTemplate>
<asp:TextBox ID="txtTint" runat="server" Text='<%# Bind("Tint") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewTint" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Bind("Tint") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BCOR">
<EditItemTemplate>
<asp:TextBox ID="txtBCOR" runat="server" Text='<%# Bind("BCOR") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewBCOR" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Bind("BCOR") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Power">
<EditItemTemplate>
<asp:TextBox ID="txtPower" runat="server" Text='<%# Bind("Power") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewPower" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%# Bind("Power") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Diameter">
<EditItemTemplate>
<asp:TextBox ID="txtDiameter" runat="server" Text='<%# Bind("Diameter") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewDiameter" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="LabelDiameter" runat="server" Text='<%# Bind("Diameter") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Design">
<EditItemTemplate>
<asp:TextBox ID="txtDesign" runat="server" Text='<%# Bind("Design") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewDesign" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%# Bind("Design") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Notes">
<EditItemTemplate>
<asp:TextBox ID="txtNotes" runat="server" Text='<%# Bind("Notes") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewNotes" runat="server" TextMode="MultiLine"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%# Bind("Notes") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" />
</Columns>
</asp:GridView>
The code-behind is:
public class LensOrdersCls
{
private string cnstr = ConfigurationManager.ConnectionStrings["PatientConnectionString"].ConnectionString;
private string sql;
public LensOrdersCls()
{
//
// TODO: Add constructor logic here
//
}
public void Insert(int OrderID, string Date, string OrderTaker, string OrderBy, string Material, string Tint, string BCOR, string Power, string Diameter, string Design, string Notes)
{
string sql = "Insert Into LensOrders (OrderID, Date, OrderTaker, OrderBy, Material, Tint, BCOR, Power, Diameter, Design, Notes) Values ('" + OrderID
+ "' , '" + Date + "', '" + OrderTaker + "', '" + OrderBy + "', '" + Material + "' , '" + Tint + "' , '" + BCOR + "' , '" + Power + "', '" + Diameter + "', '" + Design + "', '" + Notes + "')";
SqlConnection conn = new SqlConnection(cnstr);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
conn.Dispose();
}
public DataTable Fetch()
{
string sql = "Select * From LensOrders";
SqlDataAdapter da = new SqlDataAdapter(sql, cnstr);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
public void Update(int OrderID, string Date, string OrderTaker, string OrderBy, string Material, string Tint, string BCOR, string Power, string Diameter, string Design, string Notes)
{
string sql = "UPDATE LensOrders SET OrderID='" + OrderID + "', Date = '" + Date
+ "', OrderTaker='" + OrderTaker + "', OrderBy = '" + OrderBy + "' Material=" + Material + "' Tint= '" + Tint + "' BCOR= '" + BCOR + "' Power '" + Power + "' Diameter= '" + Diameter + "' Design= '" + Design + "' Notes= '" + Notes;
SqlConnection conn = new SqlConnection(cnstr);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
conn.Dispose();
}
public void Delete(int OrderID)
{
string sql = "Delete LensOrders Where OrderID=" + OrderID;
SqlConnection conn = new SqlConnection(cnstr);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
conn.Dispose();
}
}
The page code-behind is:
public partial class Default : System.Web.UI.Page
{
LensOrdersCls LensOrder = new LensOrdersCls();
private void FillOrdersInGrid()
{
DataTable dtOrder = LensOrder.Fetch();
if (dtOrder.Rows.Count > 0)
{
GridView1.DataSource = dtOrder;
GridView1.DataBind();
}
else
{
dtOrder.Rows.Add(dtOrder.NewRow());
GridView1.DataSource = dtOrder;
GridView1.DataBind();
int TotalColumns = GridView1.Rows[0].Cells.Count;
GridView1.Rows[0].Cells.Clear();
GridView1.Rows[0].Cells.Add(new TableCell());
GridView1.Rows[0].Cells[0].ColumnSpan = TotalColumns;
GridView1.Rows[0].Cells[0].Text = "No Record Found";
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillOrdersInGrid();
test.Text = GridView1.Rows[0].Cells.Count.ToString();
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.Equals("AddNew"))
{
TextBox txtNewOrderID = (TextBox)GridView1.FooterRow.FindControl("txtNewOrderID");
TextBox txtNewDate = (TextBox)GridView1.FooterRow.FindControl("txtNewDate");
TextBox txtNewOrderTaker = (TextBox)GridView1.FooterRow.FindControl("txtNewOrderTaker");
TextBox txtNewOrderBy = (TextBox)GridView1.FooterRow.FindControl("txtNewOrderBy");
TextBox txtNewMaterial = (TextBox)GridView1.FooterRow.FindControl("txtNewMaterial");
TextBox txtNewTint = (TextBox)GridView1.FooterRow.FindControl("txtNewTint");
TextBox txtNewBCOR = (TextBox)GridView1.FooterRow.FindControl("txtNewBCOR");
TextBox txtNewPower = (TextBox)GridView1.FooterRow.FindControl("txtNewPower");
TextBox txtNewDiameter = (TextBox)GridView1.FooterRow.FindControl("txtNewDiameter");
TextBox txtNewDesign = (TextBox)GridView1.FooterRow.FindControl("txtNewDesign");
TextBox txtNewNotes = (TextBox)GridView1.FooterRow.FindControl("txtNewNotes");
LensOrder.Insert(Convert.ToInt32(txtNewOrderID.Text),
txtNewDate.Text,
txtNewOrderTaker.Text,
txtNewOrderBy.Text,
txtNewMaterial.Text,
txtNewTint.Text,
txtNewBCOR.Text,
txtNewPower.Text,
txtNewDiameter.Text,
txtNewDesign.Text,
txtNewNotes.Text);
FillOrdersInGrid();
}
}
// Row Editing
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
FillOrdersInGrid();
}
// Row Cancel editing
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
FillOrdersInGrid();
}
//Row updating
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox txtOrderID = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtOrderID");
TextBox txtDate = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDate");
TextBox txtOrderTaker = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtOrderTaker");
TextBox txtOrderBy = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtNewOrderBy");
TextBox txtMaterial = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtMaterial");
TextBox txtTint = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTint");
TextBox txtBCOR = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtBCOR");
TextBox txtPower = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPower");
TextBox txtDiameter = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDiameter");
TextBox txtDesign = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDesign");
TextBox txtNotes = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtNotes");
LensOrder.Update(Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()),
txtDate.Text,
txtOrderTaker.Text,
txtOrderBy.Text,
txtMaterial.Text,
txtTint.Text,
txtBCOR.Text,
txtPower.Text,
txtDiameter.Text,
txtDesign.Text,
txtNotes.Text);
GridView1.EditIndex = -1;
FillOrdersInGrid();
}
//Deleting row
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
LensOrder.Delete(Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()));
FillOrdersInGrid();
}
}

View 1 Replies

DataSource Controls :: Index Out Of Range - Error

Jan 4, 2010

I'm stumbling on a basic LinqDataSource insertion problem. For some reason, I cannot insert records. The run-time returns the following error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index The mark-up is as follows with the InsertParameters group. Adding or removing the group leads to the same error. (Note that updating works fine):

[Code]....

The events are void (just a convenient way to to troubleshoot). However, the run-time error occurs before the events are fired.

View 3 Replies

SQL Reporting :: Server Error:Index Was Out Of Range?

Dec 20, 2010

I am getting the below error when I am trying to export RDLC report data into Excel sheet using Microsoft report viewer control."Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index"

View 1 Replies

Forms Data Controls :: Index Was Out Of Range?

Jan 24, 2010

keep getting an error with

Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Source Error:

[Code]....

Here is my codes:

[Code]....

View 3 Replies

Windows Server 2003 - Site Throwing A System.Security.SecurityException?

Jan 14, 2011

I have an ASP.NET application that was working fine on my server up until last night when I installed a bunch of windows updates, now it's throwing this exception : System.Security.SecurityException: Requested registry access is not allowed.Unfortunately there is some things that makes this hard to debug. I added the debug="true" attribute to the web.config file to get the line where the exception is lauched. The line identified in my code is an End If and the code just before seems benign :

<body id="body" runat="server">
<div class="conteneur-confirmation">
<%

[code]...

View 3 Replies

Index Was Out Of Range / Display Some .mht Files On Iframe In Gridview?

Jan 4, 2010

I am facing problem when i try to deploy my website on iis 7.0 on test page.

i have to display some .mht files on iframe in gridview and error looks like below,

[code]....

View 6 Replies

VS 2008 - Index Was Out Of Range - Must Be Non-negative And Less Than The Size Of The Collection

Feb 24, 2011

I am Getting this exception when i select the checkbox control in Grid view"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"

I have Checkbox in Gridview control, when i select the record in grid view corresponding entire record will be populated into form fields,it working absolutely fine,I have search method on my webform, if i searched based on particular value in form fileds, records will be filtered in Girdvie control when i select the record, same reocrd suppose to populate in form fields but not loading, above error occuring.normally no issues error occuring when i search and select record. error occuring at redline in the code

[code].....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved