473,396 Members | 2,026 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,396 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 998

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.