473,320 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with data grid

I 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 :

<asp:datagrid id="dg1" runat="server" Width="920px" Height="145px"
PageSize="5" AutoGenerateColumns="False"
BorderStyle="Groove">
<ItemStyle ForeColor="Black"
BackColor="#B0C4DE"></ItemStyle>
<HeaderStyle Font-
Size="Smaller" Font-Names="Arial" Font-
Bold="True" HorizontalAlign="Center"
ForeColor="#FAFAD2"
BackColor="#4682B4"></HeaderStyle>
<Columns>
<asp:TemplateColumn
HeaderText="Employee Id">
<ItemStyle
ForeColor="Black"></ItemStyle>
<ItemTemplate>

<asp:Label ID="ecode" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem,"EmpIdCode") %>'>
</
asp:Label>
</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server"></asp:TextBox>
</
EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn
HeaderText="Employee Name">
<ItemStyle
ForeColor="Black"></ItemStyle>
<ItemTemplate>

<asp:Label ID="ename" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem,"name") %>'>
</
asp:Label>
</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server"></asp:TextBox>
</
EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn
HeaderText="Worked Days">
<ItemStyle
HorizontalAlign="Center" ForeColor="Black"></
ItemStyle>
<ItemTemplate>

<asp:Label ID="workdays" runat="server"></asp:Label>
</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server"></asp:TextBox>
</
EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn
HeaderText="Off Days">
<ItemStyle
HorizontalAlign="Center" ForeColor="Black"></
ItemStyle>
<ItemTemplate>

<asp:Label ID="offdays" runat="server"></asp:Label>
</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server"></asp:TextBox>
</
EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn
HeaderText="Holidays Payable">
<ItemStyle
HorizontalAlign="Center" ForeColor="Black"></
ItemStyle>
<ItemTemplate>

<asp:Label ID="holiday" runat="server"></asp:Label>
</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server"></asp:TextBox>
</
EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn
HeaderText="Holiday ( Double_Salary)">
<ItemStyle
HorizontalAlign="Center" ForeColor="Black"></
ItemStyle>
<ItemTemplate>

<asp:Label ID="Holiday2" runat="server"></asp:Label>
</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server"></asp:TextBox>
</
EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn
HeaderText="Payable Leave Days">
<ItemStyle
HorizontalAlign="Center" ForeColor="Black"></
ItemStyle>
<ItemTemplate>

<asp:Label ID="Leave" runat="server"></asp:Label>
</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server"></asp:TextBox>
</
EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn
HeaderText="Total Pay Days">
<ItemStyle
HorizontalAlign="Center" ForeColor="Black"></
ItemStyle>
<ItemTemplate>

<asp:Label ID="Total" runat="server"></asp:Label>
</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server"></asp:TextBox>
</
EditItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle
Mode="NumericPages"></PagerStyle>
</asp:datagrid>

--------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------
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.
Jun 27 '08 #1
0 902

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

Similar topics

2
by: Marc | last post by:
Hi all, I was using Tkinter.IntVar() to store values from a large list of parts that I pulled from a list. This is the code to initialize the instances: def initVariables(self): self.e =...
0
by: fowlertrainer | last post by:
Hello ! I want to create a tool for mp3 files in wx. Some sections of the code (see below) is copied from wx demo. Problems: 1.) the wxStaticText is not centered vertically 2.) the...
3
by: clyyy2002 | last post by:
At added two column and more column hereafter,I immediately click del button,the program is no problem. but if i first click the DataGrid columnHeader and then click the del button, i find when...
3
by: Matthew Woods | last post by:
Hi, is there any way to format and order the columns displayed in a datagrid bound to a class that inherits from IBindingList? i have used DataGridTableStyle and added DataGridTextBoxColumns to it...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
10
by: B. Chernick | last post by:
I am using a System.Web.UI.WebControls.Table control on a screen. (Dot Net 1.1) My problem is this: The table is programmatically reconstructed on every postback. Each table row contains two...
2
by: Lucky | last post by:
Hi guys! i've got very interesting problem. the problem is like this. i've 2 webpages. -- page1 contains DataGrid control of .Net 1.1 and -- Page2 contains GridView control of .Net 2.0. --...
12
by: NOO Recursion | last post by:
Hi everyone! I am trying to write a program that will search a 12x12 for a thing called a "blob". A blob in the grid is made up of asterisks. A blob contains at least one asterisk. If an...
6
by: Murray Hopkins | last post by:
Hi. THE QUESTION: How do I get a reference to my Object when processing an event handler bound to an html element ? CONTEXT: Sorry if it is a bit long. I am developing a JS calendar tool....
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.