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))
Else
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))
Else
itmlblNetDue.Text = String.Format("{0:N2}", CDbl(itmlblAmtDue.Text) + CDbl(itmtxtAdjust.Text))
End If
nTotNetDue = CDbl(nTotNetDue) + CDbl(itmlblNetDue.Text)
Next
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...
|