473,473 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

chkBox datagrid question

Hello all,

I have a datagrid with a checkbox as a template. I connected my two
chekboxes in the template to my my datasource in the propeties menu. But I
get this error flagged at line 33.
"Index 0 is not non-negative and below total rows count. "
<asp:TemplateColumn HeaderText="Sold">
Line 32: <ItemTemplate>
<<<Line 33: <asp:CheckBox id=chkITsold runat="server"
AutoPostBack="True" Checked='<%# DataBinder.Eval(DsUinv1,
"Tables[IMSProducts].DefaultView.>>>[0].Sold") %>'>
Line 34: </asp:CheckBox>
Line 35: </ItemTemplate>
When I disconnect the checkboxes from the db, it' fine.
I also ahave a quick question on my code for the checkboxe in my item
command. Having problems with a "Object not refrenced error" on my chkbox
line. Not sure if this has something to do with not being connected to the
database, or I coded the line wrong.
Private Sub grdUinv_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
grdUinv.ItemCommand

If e.Item.ItemType = ListItemType.Pager Or _
e.Item.ItemType = ListItemType.Header Then Exit Sub
''' grdUinv.EditItemIndex = -1
Dim btn As Button = CType(e.CommandSource, Button)
If btn.Text = "Edit" Then
txbProductID.Text = e.Item.Cells(0).Text
txtProdName.Text = e.Item.Cells(1).Text
txtModNum.Text = e.Item.Cells(2).Text
txtSrp.Text = Microsoft.VisualBasic.Right(e.Item.Cells(3).Text, _
Len(e.Item.Cells(4).Text) - 1)
txtCost.Text = Microsoft.VisualBasic.Right(e.Item.Cells(4).Text, _
Len(e.Item.Cells(5).Text) - 1)
txtQty.Text = e.Item.Cells(5).Text
' chkEbay.Checked =
CType(e.Item.Cells(6).FindControl("chkEbay"), _
' CheckBox).Checked
chkSold.Checked =
CType(e.Item.Cells(6).FindControl("chkITSold"), CheckBox).Checked
pnlAdd.Visible = True
Else
' DeleteItem(grdUinv.DataKeys(e.Item.ItemIndex).ToSt ring)

End If
btnSave.CommandArgument = ""
End Sub

I do have a panel below that I can ADD items to the database, including the
checkbox, that works just fine. My other columns work fine too, just the
chkbox on the datagrid is giving me flak!

TIA!!!!

Rudy
Nov 19 '05 #1
0 872

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: magister | last post by:
Hello, I have xml like this.... <test> <question>sdfsa</question> <section><question>43ga</question> <question>asdf</question> </test>
2
by: DD | last post by:
I have a subform on a form In the subform i have a chkBox= and a txtbox= The idea is you Chk and the price $40.00 is automaticly entered into The chkBox has code Private Sub...
2
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of...
13
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for...
3
by: wink martindale | last post by:
Hello, I have a datagrid (this is a windows app) with a checkbox column (thanks again for the help on that!) I want the user to be able to select several records from the datagrid (by checking...
2
by: RbanBph | last post by:
Hello, I have used datagrid in my web application. I want to set datasource to this datagrid. I want to display check boxes in one of its column. How can i add checkboxes in my datagrid using...
0
by: John | last post by:
Hi all, i've added a checkbox column to my datagrid using template columns, and i added a checkbox to the header for check all and uncheck all functionality. the purpose of this is to allow the...
2
by: msbs48 | last post by:
chkbox 1. i pasted in on the form.. there does not seem to be a caption property.. i saw a couple of examples setting the caption in the from load.. The methods/Events window in the code does not...
4
by: hkarthik | last post by:
hi all, I added a checkbox inside my datagrid. This checkbox is generated automatically depending on the data's inside my datagrid. So the problem that occurs now is all the checkboxes...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
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,...
1
isladogs
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.