Wrox Programmer Forums
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 17th, 2005, 04:36 AM
Registered User
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Checkbox DatagridItem

Hi All,
I have a problem dealing with TemplateColumn in Datagrid. I have a checkbox on it. My problem is this, if I have a hundred of records in my Datagrid and check/uncheck the checkboxes at the BOTTOM of the grid, it SCROLL up to the top of the record. In this case, I have to scroll down it again to see what I have done. Could you please give me an idea on how to fix this?

By the way, the checkboxes are used to include for reporting and computations. I also use the Autopostback property. Here are my codes for checkbox:

Protected Sub chkIncEvent_Clicked(ByVal sender As Object, ByVal e As EventArgs)
Dim chkIncEvent As CheckBox = CType(sender, CheckBox)
Dim dgItem As DataGridItem = CType(chkIncEvent.NamingContainer, DataGridItem)
Dim dgItem_Hall As DataGridItem
Dim itmlblRevenue, itmlblComm, itmlblAmtDue, itmlblNetDue As Label
Dim nRevenue, nCommission, nTotRevenue, nTotCommission, nTotAmtDue, nExpenses, nTotNetDue As Double
Dim itmchkInc_Hall2, itmchkInc_Hall1 As CheckBox
Dim itmHall_Event, itmHall As Integer
Dim itmExpenses, itmCommRate
Dim itmtxtAdjust As TextBox
nRevenue = CDbl(dgItem.Cells(6).Text)
nCommission = CDbl(dgItem.Cells(7).Text)
itmHall_Event = dgItem.Cells(0).Text
itmCommRate = dgItem.Cells(8).Text
If chkIncEvent.Checked = True Then
txtRevenue.Text = String.Format("{0:N2}", CDbl(txtRevenue.Text) + CDbl(nRevenue))
txtCommission.Text = String.Format("{0:N2}", CDbl(txtCommission.Text) + CDbl(nCommission))
txtRevenue.Text = String.Format("{0:N2}", CDbl(txtRevenue.Text) - CDbl(nRevenue))
txtCommission.Text = String.Format("{0:N2}", CDbl(txtCommission.Text) - CDbl(nCommission))
End If
clsInvoice.UpdateSessionDataSet(Session("HallID_In v"), chkIncEvent.Checked, dgItem.Cells(1).Text, dgItem.Cells(2).Text, itmHall_Event, itmCommRate)

For Each dgItem_Hall In grdInvoice.Items
itmHall = dgItem_Hall.Cells(0).Text
itmlblRevenue = dgItem_Hall.FindControl("lblSesRevenue")
itmlblComm = dgItem_Hall.FindControl("lblSesCommission")
itmlblAmtDue = dgItem_Hall.FindControl("lblSesAmtDue")
itmchkInc_Hall1 = dgItem_Hall.FindControl("chkInc_Hall1")
itmchkInc_Hall2 = dgItem_Hall.FindControl("chkInc_Hall2")
itmlblNetDue = dgItem_Hall.FindControl("lblNetDue")
itmExpenses = dgItem_Hall.Cells(8).Text
itmtxtAdjust = dgItem_Hall.FindControl("txtAdjust")

If itmchkInc_Hall1.Checked = True And Session("HallId_Inv") = itmHall Then
itmlblRevenue.Text = String.Format("{0:N2}", CDbl(txtRevenue.Text))
itmlblComm.Text = String.Format("{0:N2}", CDbl(txtCommission.Text))
End If
nTotRevenue = String.Format("{0:N2}", CDbl(nTotRevenue) + CDbl(itmlblRevenue.Text))
nTotCommission = String.Format("{0:N2}", CDbl(nTotCommission) + CDbl(itmlblComm.Text))
itmlblAmtDue.Text = String.Format("{0:N2}", CDbl(itmlblRevenue.Text) - CDbl(itmlblComm.Text))
nTotAmtDue = CDbl(nTotAmtDue) + CDbl(itmlblAmtDue.Text)
If itmchkInc_Hall2.Checked = True And itmchkInc_Hall1.Checked = True Then
nExpenses = CDbl(nExpenses) + CDbl(itmExpenses)
itmlblNetDue.Text = String.Format("{0:N2}", CDbl(itmlblAmtDue.Text) + CDbl(itmExpenses) + CDbl(itmtxtAdjust.Text))
itmlblNetDue.Text = String.Format("{0:N2}", CDbl(itmlblAmtDue.Text) + CDbl(itmtxtAdjust.Text))
End If
nTotNetDue = CDbl(nTotNetDue) + CDbl(itmlblNetDue.Text)

txtTotRevenue.Text = String.Format("{0:N2}", CDbl(nTotRevenue))
txtTotCommission.Text = String.Format("{0:N2}", CDbl(nTotCommission))
txtTotAmtDue.Text = String.Format("{0:N2}", CDbl(nTotAmtDue))
txtTotExpense.Text = String.Format("{0:N2}", CDbl(nExpenses))
txtTotNetDue.Text = String.Format("{0:N2}", CDbl(nTotNetDue))
txtTotalDue.Text = String.Format("{0:N2}", CDbl(txtTotNetDue.Text))

Tnx in advance...

Old May 17th, 2005, 06:15 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Add the following to the top of the page:



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extending DataGridItem Phrozen ASP.NET 2.0 Professional 0 March 11th, 2007 09:17 AM
Dinamically Adding DropDownList Into DataGridItem 1kHz ASP.NET 1.0 and 1.1 Professional 0 January 20th, 2006 12:06 AM
DatagridItem selection aldwinenriquez ASP.NET 1.0 and 1.1 Professional 2 August 2nd, 2005 06:25 PM
Casting DataGridItem.DataItem to Object thecolour General .NET 2 July 12th, 2004 02:43 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.