Hi,
Pls let me how to solve this error "Specified argument out of range"
Pls find the code below and let me know the solution.
Public Class viewcart
Inherits System.Web.UI.P age
Protected WithEvents Cart As System.Web.UI.W ebControls.Data Grid
Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label1 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Image2 As System.Web.UI.W ebControls.Imag e
Protected WithEvents Image1 As System.Web.UI.W ebControls.Imag e
Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l
Dim objTable As New DataTable("Temp orary")
Dim CartView As DataView
Protected WithEvents HyperLink9 As System.Web.UI.W ebControls.Hype rLink
Dim i As Integer
'
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim objRow As DataRow
'
Try
ConSQL.Open()
objTable = sesDT '---- Global DataTable populated by many webpages
----'
CartView = New DataView(objTab le)
i = objTable.Rows.C ount
'
If objTable.Rows.C ount <= 0 Then
Say("Sorry, Shopping Cart is empty.")
End If
'
Do While i < 7
objRow = objTable.NewRow
objTable.Rows.A dd(objRow)
i = i + 1
Loop
'
Catch ex As Exception
Say(ex.Message. ToString)
Finally
If ConSQL.State = ConnectionState .Open Then
ConSQL.Close()
End If
End Try
'
If Not IsPostBack Then
BindGrid()
End If
'
End Sub
'
Private Sub BindGrid()
'
Cart.DataSource = CartView
Cart.DataBind()
'
End Sub
'
Private Sub Cart_EditComman d(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles Cart.EditComman d
'
Cart.EditItemIn dex = e.Item.ItemInde x
BindGrid()
'
End Sub
'
Private Sub Cart_UpdateComm and(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles Cart.UpdateComm and
'
Try
'
Dim itemcode As String = e.Item.Cells(0) .Text
Dim itemname As String = e.Item.Cells(1) .Text
' Dim qtyText As TextBox = e.Item.Cells(2) .Controls(0) '--- If I comment
these 2
lines program works with 2 as default qty. Even if I Typecast to
textbox it
throws error. Pls let me know the solution. ---
' Dim qty As String = qtyText.Text
Dim price As Double = e.Item.Cells(3) .Text
' Dim Amount As Double = Val(qtyText.Tex t) * e.Item.Cells(3) .Text
Dim Amount As Double = 2 * e.Item.Cells(3) .Text
Dim dr As DataRow
'
CartView.RowFil ter = "Itemcode=' " & itemcode & "'"
If CartView.Count > 0 Then
CartView.Delete (0)
End If
CartView.RowFil ter = ""
dr = objTable.NewRow ()
dr(0) = itemcode
dr(1) = itemname
dr(2) = 2
dr(3) = price
dr(4) = Amount
objTable.Rows.A dd(dr)
Cart.EditItemIn dex = -1
BindGrid()
'
Catch ex As Exception
Say(ex.Message)
End Try
'
End Sub
'
Private Sub Cart_CancelComm and(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) handles Cart.CancelComm and
'
Cart.EditItemIn dex = -1
BindGrid()
'
End Sub
'
Private Sub Cart_PageIndexC hanged(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridPageChanged EventArgs) Handles
Cart.PageIndexC hanged
'
If Cart.CurrentPag eIndex >= 0 Or Cart.CurrentPag eIndex < Cart.PageCount
Then
Cart.CurrentPag eIndex = e.NewPageIndex
BindGrid()
End If
'
End Sub
'
End Class
Thanks,
R.Shakthi 1 1518
i would suggest that you download the commerce starter kit from www.asp.net
and have a look at the implementation of Cart in there.
They use a lot easier way.
--
Regards,
Hermit Dave
( http://hdave.blogspot.com)
"Shakthi" <Sh*****@discus sions.microsoft .com> wrote in message
news:70******** *************** ***********@mic rosoft.com... Hi,
Pls let me how to solve this error "Specified argument out of range" Pls find the code below and let me know the solution.
Public Class viewcart Inherits System.Web.UI.P age Protected WithEvents Cart As System.Web.UI.W ebControls.Data Grid Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label1 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l Protected WithEvents Image2 As System.Web.UI.W ebControls.Imag e Protected WithEvents Image1 As System.Web.UI.W ebControls.Imag e Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l Dim objTable As New DataTable("Temp orary") Dim CartView As DataView Protected WithEvents HyperLink9 As System.Web.UI.W ebControls.Hype rLink Dim i As Integer ' Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load Dim objRow As DataRow ' Try ConSQL.Open() objTable = sesDT '---- Global DataTable populated by many webpages ----' CartView = New DataView(objTab le) i = objTable.Rows.C ount ' If objTable.Rows.C ount <= 0 Then Say("Sorry, Shopping Cart is empty.") End If ' Do While i < 7 objRow = objTable.NewRow objTable.Rows.A dd(objRow) i = i + 1 Loop ' Catch ex As Exception Say(ex.Message. ToString) Finally If ConSQL.State = ConnectionState .Open Then ConSQL.Close() End If End Try ' If Not IsPostBack Then BindGrid() End If ' End Sub ' Private Sub BindGrid() ' Cart.DataSource = CartView Cart.DataBind() ' End Sub ' Private Sub Cart_EditComman d(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
Cart.EditComman d ' Cart.EditItemIn dex = e.Item.ItemInde x BindGrid() ' End Sub ' Private Sub Cart_UpdateComm and(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
Cart.UpdateComm and ' Try ' Dim itemcode As String = e.Item.Cells(0) .Text Dim itemname As String = e.Item.Cells(1) .Text ' Dim qtyText As TextBox = e.Item.Cells(2) .Controls(0) '--- If I comment these 2 lines program works with 2 as default qty. Even if I Typecast to textbox it throws error. Pls let me know the solution. --- ' Dim qty As String = qtyText.Text Dim price As Double = e.Item.Cells(3) .Text ' Dim Amount As Double = Val(qtyText.Tex t) * e.Item.Cells(3) .Text Dim Amount As Double = 2 * e.Item.Cells(3) .Text Dim dr As DataRow ' CartView.RowFil ter = "Itemcode=' " & itemcode & "'" If CartView.Count > 0 Then CartView.Delete (0) End If CartView.RowFil ter = "" dr = objTable.NewRow () dr(0) = itemcode dr(1) = itemname dr(2) = 2 dr(3) = price dr(4) = Amount objTable.Rows.A dd(dr) Cart.EditItemIn dex = -1 BindGrid() ' Catch ex As Exception Say(ex.Message) End Try ' End Sub ' Private Sub Cart_CancelComm and(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) handles
Cart.CancelComm and ' Cart.EditItemIn dex = -1 BindGrid() ' End Sub ' Private Sub Cart_PageIndexC hanged(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridPageChanged EventArgs) Handles Cart.PageIndexC hanged ' If Cart.CurrentPag eIndex >= 0 Or Cart.CurrentPag eIndex < Cart.PageCount Then Cart.CurrentPag eIndex = e.NewPageIndex BindGrid() End If ' End Sub ' End Class Thanks,
R.Shakthi This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael Conroy |
last post by:
Hi... Synposis...
Throws exception:
"Specified argument was out of the range of valid values."
Read on for the juicy tidbits.
MySimpleClassCol mscc=new MySimpleClassCol();
private void InitCombo()
{
|
by: Todd Perkins |
last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually
rely on google. So I hope I have enough info contained. Thank you in
advance for any help!
Problem:
I am getting this error when I try to pull up my edit page to display the
current database information in the form, and then edit it on click:
|
by: subdhar |
last post by:
I'm getting following error in asp.net application.I search the web
and couldn't find error like this can any one help me in trouble with
this error
Specified argument was out of the range of valid values.
Parameter name: U 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.
|
by: darrel |
last post by:
What does this error mean?
Specified argument was out of the range of valid values. Parameter name:
value
System.Web
It's being thrown here:
DDL_SubCategory.Enabled = True
DDL_SubCategory.DataSource = DS
|
by: rajarameshvarma |
last post by:
Hi....
I have a serious problem while deploying my asp.net application. I have
developed a web project in which everypage contains Header, Left
navigation and footer as usercontrols. For center court i have used
Ifrmae tag to call an HTML page. It was working fine for most of the
pages it is working fine. But for some pages...user controls are
rendered correctly ... but htnl page which is in the frame giving
error.
| |
by: IndiraPriyaDarshini |
last post by:
Hi ,
Am trying to sum the total in the footer if a gridview,
but am getting the error "Specified argument was out of the range of valid values.
Parameter name: index "..Its Printing one cell value in the footer..
But for the seond sum,it showing the error, the value is getting,
Help me pls..
Here is the ode snippent
|
by: gsauns |
last post by:
I have a DetailsView which is inside of a FormView. I lifted this
DetailsView straight off another one of my pages, where it was working
beautifully. Now I get this endlessly frustrating error message
whenever I try to go into Edit mode:
Specified argument was out of the range of valid values.
Parameter name: index
The DetailsView is actually inside an UpdatePanel, which is inside an
Ajax Accordion, which is inside the FormView. Could...
|
by: Chapi |
last post by:
hi, i'm having problems with a datagrid paging.
it's populates fine, but when i click the paging button appears this
error:"Specified argument was out of the range of valid
values.Parameter name: index"
I paste the code here in case someone can help me.
Sub paginaNueva(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
|
by: RN1 |
last post by:
I have a DataGrid with 7 BoundColumns. A user can login as an admin or
non-admin. When a user logs in as a non-admin & the DatGrid is in the
editable mode, I want only the first 4 columns i.e. the TextBoxes in
the first 4 columns to be editable & the remaining 3 TextBoxes should
remain disabled. This is what I tried (in the OnItemDataBound event
functions):
--------------------
If (sessAdmin = 0) Then
For i = 4 To 6
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |