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.Page
Protected WithEvents Cart As System.Web.UI.WebControls.DataGrid
Protected WithEvents Label7 As System.Web.UI.WebControls.Label
Protected WithEvents Label5 As System.Web.UI.WebControls.Label
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents Image2 As System.Web.UI.WebControls.Image
Protected WithEvents Image1 As System.Web.UI.WebControls.Image
Protected WithEvents Label4 As System.Web.UI.WebControls.Label
Dim objTable As New DataTable("Temporary")
Dim CartView As DataView
Protected WithEvents HyperLink9 As System.Web.UI.WebControls.HyperLink
Dim i As Integer
'
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim objRow As DataRow
'
Try
ConSQL.Open()
objTable = sesDT '---- Global DataTable populated by many webpages
----'
CartView = New DataView(objTable)
i = objTable.Rows.Count
'
If objTable.Rows.Count <= 0 Then
Say("Sorry, Shopping Cart is empty.")
End If
'
Do While i < 7
objRow = objTable.NewRow
objTable.Rows.Add(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_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles Cart.EditCommand
'
Cart.EditItemIndex = e.Item.ItemIndex
BindGrid()
'
End Sub
'
Private Sub Cart_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles Cart.UpdateCommand
'
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.Text) * e.Item.Cells(3).Text
Dim Amount As Double = 2 * e.Item.Cells(3).Text
Dim dr As DataRow
'
CartView.RowFilter = "Itemcode='" & itemcode & "'"
If CartView.Count > 0 Then
CartView.Delete(0)
End If
CartView.RowFilter = ""
dr = objTable.NewRow()
dr(0) = itemcode
dr(1) = itemname
dr(2) = 2
dr(3) = price
dr(4) = Amount
objTable.Rows.Add(dr)
Cart.EditItemIndex = -1
BindGrid()
'
Catch ex As Exception
Say(ex.Message)
End Try
'
End Sub
'
Private Sub Cart_CancelCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) handles Cart.CancelCommand
'
Cart.EditItemIndex = -1
BindGrid()
'
End Sub
'
Private Sub Cart_PageIndexChanged(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
Cart.PageIndexChanged
'
If Cart.CurrentPageIndex >= 0 Or Cart.CurrentPageIndex < Cart.PageCount
Then
Cart.CurrentPageIndex = e.NewPageIndex
BindGrid()
End If
'
End Sub
'
End Class
Thanks,
R.Shakthi 1 1508
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*****@discussions.microsoft.com> wrote in message
news:70**********************************@microsof t.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.Page Protected WithEvents Cart As System.Web.UI.WebControls.DataGrid Protected WithEvents Label7 As System.Web.UI.WebControls.Label Protected WithEvents Label5 As System.Web.UI.WebControls.Label Protected WithEvents Label1 As System.Web.UI.WebControls.Label Protected WithEvents Label2 As System.Web.UI.WebControls.Label Protected WithEvents Image2 As System.Web.UI.WebControls.Image Protected WithEvents Image1 As System.Web.UI.WebControls.Image Protected WithEvents Label4 As System.Web.UI.WebControls.Label Dim objTable As New DataTable("Temporary") Dim CartView As DataView Protected WithEvents HyperLink9 As System.Web.UI.WebControls.HyperLink Dim i As Integer ' Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim objRow As DataRow ' Try ConSQL.Open() objTable = sesDT '---- Global DataTable populated by many webpages ----' CartView = New DataView(objTable) i = objTable.Rows.Count ' If objTable.Rows.Count <= 0 Then Say("Sorry, Shopping Cart is empty.") End If ' Do While i < 7 objRow = objTable.NewRow objTable.Rows.Add(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_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
Cart.EditCommand ' Cart.EditItemIndex = e.Item.ItemIndex BindGrid() ' End Sub ' Private Sub Cart_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
Cart.UpdateCommand ' 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.Text) * e.Item.Cells(3).Text Dim Amount As Double = 2 * e.Item.Cells(3).Text Dim dr As DataRow ' CartView.RowFilter = "Itemcode='" & itemcode & "'" If CartView.Count > 0 Then CartView.Delete(0) End If CartView.RowFilter = "" dr = objTable.NewRow() dr(0) = itemcode dr(1) = itemname dr(2) = 2 dr(3) = price dr(4) = Amount objTable.Rows.Add(dr) Cart.EditItemIndex = -1 BindGrid() ' Catch ex As Exception Say(ex.Message) End Try ' End Sub ' Private Sub Cart_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) handles
Cart.CancelCommand ' Cart.EditItemIndex = -1 BindGrid() ' End Sub ' Private Sub Cart_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles Cart.PageIndexChanged ' If Cart.CurrentPageIndex >= 0 Or Cart.CurrentPageIndex < Cart.PageCount Then Cart.CurrentPageIndex = 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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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:...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |