Problem with Data Grid
am 17.04.2008 09:56:43 von AshwinI have a Data Grid to display employee names and codes. On clicking a
button (outside the datagrid) I perform some calculations which sets
the fields of other columns in the datagrid.
The problem I am facing is that not all columns are filled with values
resulting from the calculations. Only the first few rows are being
filled with results.
------------------------------------------------------------ ------------------------------------------------------------ ---------------------
The datagrid code follows :
BorderStyle="Groove">
Bold="True" HorizontalAlign="Center"
ForeColor="#FAFAD2"
BackColor="#4682B4">
asp:Label>
EditItemTemplate>
asp:Label>
EditItemTemplate>
ItemStyle>
EditItemTemplate>
ItemStyle>
EditItemTemplate>
ItemStyle>
EditItemTemplate>
ItemStyle>
EditItemTemplate>
ItemStyle>
EditItemTemplate>
ItemStyle>
EditItemTemplate>
------------------------------------------------------------ ------------------------------------------------------------ --------------------
------------------------------------------------------------ ------------------------------------------------------------ --------------------
code to fill in the columns :
Private Sub btnCal_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCal.Click
On Error GoTo er
If txtDateFrom.Text = "" Or txtDateTo.Text = "" Then
Call MessageBox("Date are Blank")
Else
For Each ditem In dg1.Items
empcode = ditem.FindControl("ecode")
wdays = ditem.FindControl("workdays")
off = ditem.FindControl("offdays")
hol = ditem.FindControl("holiday")
hol2 = ditem.FindControl("Holiday2")
leav = ditem.FindControl("Leave")
wdays.Text =
working_days(Format(DateValue(txtDateFrom.Text), "yyyy-MM-dd"),
Format(DateValue(txtDateTo.Text), "yyyy-MM-dd"), empcode.Text)
off.Text =
off_days(Format(DateValue(txtDateFrom.Text), "yyyy-MM-dd"),
Format(DateValue(txtDateTo.Text), "yyyy-MM-dd"))
hol.Text =
holiday(Format(DateValue(txtDateFrom.Text), "yyyy-MM-dd"),
Format(DateValue(txtDateTo.Text), "yyyy-MM-dd")) -
(hol_with_1_sal(Format(DateValue(txtDateFrom.Text), "yyyy-MM-dd"),
Format(DateValue(txtDateTo.Text), "yyyy-MM-dd"), empcode.Text) +
hol_with_2_sal(Format(DateValue(txtDateFrom.Text), "yyyy-MM-dd"),
Format(DateValue(txtDateTo.Text), "yyyy-MM-dd"), empcode.Text))
hol2.Text =
hol_with_2_sal(Format(DateValue(txtDateFrom.Text), "yyyy-MM-dd"),
Format(DateValue(txtDateTo.Text), "yyyy-MM-dd"), empcode.Text)
leav.Text =
Leave_count(Format(DateValue(txtDateFrom.Text), "yyyy-MM-dd"),
Format(DateValue(txtDateTo.Text), "yyyy-MM-dd"), empcode.Text,
Session("AccCompID"), Session("AccBranchID")) -
hol_leav(Format(DateValue(txtDateFrom.Text), "yyyy-MM-dd"),
Format(DateValue(txtDateTo.Text), "yyyy-MM-dd"), empcode.Text,
Session("AccCompID"), Session("AccBranchID"))
Next
End If
Exit Sub
er:
Err.Clear()
Exit Sub
End Sub
------------------------------------------------------------ ------------------------------------------------------------ --------------------
Help Needed !
Thank You.