473,668 Members | 2,519 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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" AutoGenerateCol umns="False"
BorderStyle="Gr oove">
<ItemStyle ForeColor="Blac k"
BackColor="#B0C 4DE"></ItemStyle>
<HeaderStyle Font-
Size="Smaller" Font-Names="Arial" Font-
Bold="True" HorizontalAlign ="Center"
ForeColor="#FAF AD2"
BackColor="#468 2B4"></HeaderStyle>
<Columns>
<asp:TemplateCo lumn
HeaderText="Emp loyee Id">
<ItemStyle
ForeColor="Blac k"></ItemStyle>
<ItemTemplate >

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

<EditItemTempla te>

<asp:TextBox runat="server"> </asp:TextBox>
</
EditItemTemplat e>
</asp:TemplateCol umn>
<asp:TemplateCo lumn
HeaderText="Emp loyee Name">
<ItemStyle
ForeColor="Blac k"></ItemStyle>
<ItemTemplate >

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

<EditItemTempla te>

<asp:TextBox runat="server"> </asp:TextBox>
</
EditItemTemplat e>
</asp:TemplateCol umn>
<asp:TemplateCo lumn
HeaderText="Wor ked Days">
<ItemStyle
HorizontalAlign ="Center" ForeColor="Blac k"></
ItemStyle>
<ItemTemplate >

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

<EditItemTempla te>

<asp:TextBox runat="server"> </asp:TextBox>
</
EditItemTemplat e>
</asp:TemplateCol umn>
<asp:TemplateCo lumn
HeaderText="Off Days">
<ItemStyle
HorizontalAlign ="Center" ForeColor="Blac k"></
ItemStyle>
<ItemTemplate >

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

<EditItemTempla te>

<asp:TextBox runat="server"> </asp:TextBox>
</
EditItemTemplat e>
</asp:TemplateCol umn>
<asp:TemplateCo lumn
HeaderText="Hol idays Payable">
<ItemStyle
HorizontalAlign ="Center" ForeColor="Blac k"></
ItemStyle>
<ItemTemplate >

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

<EditItemTempla te>

<asp:TextBox runat="server"> </asp:TextBox>
</
EditItemTemplat e>
</asp:TemplateCol umn>
<asp:TemplateCo lumn
HeaderText="Hol iday ( Double_Salary)" >
<ItemStyle
HorizontalAlign ="Center" ForeColor="Blac k"></
ItemStyle>
<ItemTemplate >

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

<EditItemTempla te>

<asp:TextBox runat="server"> </asp:TextBox>
</
EditItemTemplat e>
</asp:TemplateCol umn>
<asp:TemplateCo lumn
HeaderText="Pay able Leave Days">
<ItemStyle
HorizontalAlign ="Center" ForeColor="Blac k"></
ItemStyle>
<ItemTemplate >

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

<EditItemTempla te>

<asp:TextBox runat="server"> </asp:TextBox>
</
EditItemTemplat e>
</asp:TemplateCol umn>
<asp:TemplateCo lumn
HeaderText="Tot al Pay Days">
<ItemStyle
HorizontalAlign ="Center" ForeColor="Blac k"></
ItemStyle>
<ItemTemplate >

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

<EditItemTempla te>

<asp:TextBox runat="server"> </asp:TextBox>
</
EditItemTemplat e>
</asp:TemplateCol umn>
</Columns>
<PagerStyle
Mode="NumericPa ges"></PagerStyle>
</asp:datagrid>

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

--------------------------------------------------------------------------------------------------------------------------------------------
code to fill in the columns :

Private Sub btnCal_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btnCal.Click
On Error GoTo er
If txtDateFrom.Tex t = "" Or txtDateTo.Text = "" Then
Call MessageBox("Dat e are Blank")

Else
For Each ditem In dg1.Items
empcode = ditem.FindContr ol("ecode")
wdays = ditem.FindContr ol("workdays")
off = ditem.FindContr ol("offdays")
hol = ditem.FindContr ol("holiday")
hol2 = ditem.FindContr ol("Holiday2")
leav = ditem.FindContr ol("Leave")
wdays.Text =
working_days(Fo rmat(DateValue( txtDateFrom.Tex t), "yyyy-MM-dd"),
Format(DateValu e(txtDateTo.Tex t), "yyyy-MM-dd"), empcode.Text)
off.Text =
off_days(Format (DateValue(txtD ateFrom.Text), "yyyy-MM-dd"),
Format(DateValu e(txtDateTo.Tex t), "yyyy-MM-dd"))
hol.Text =
holiday(Format( DateValue(txtDa teFrom.Text), "yyyy-MM-dd"),
Format(DateValu e(txtDateTo.Tex t), "yyyy-MM-dd")) -
(hol_with_1_sal (Format(DateVal ue(txtDateFrom. Text), "yyyy-MM-dd"),
Format(DateValu e(txtDateTo.Tex t), "yyyy-MM-dd"), empcode.Text) +
hol_with_2_sal( Format(DateValu e(txtDateFrom.T ext), "yyyy-MM-dd"),
Format(DateValu e(txtDateTo.Tex t), "yyyy-MM-dd"), empcode.Text))
hol2.Text =
hol_with_2_sal( Format(DateValu e(txtDateFrom.T ext), "yyyy-MM-dd"),
Format(DateValu e(txtDateTo.Tex t), "yyyy-MM-dd"), empcode.Text)
leav.Text =
Leave_count(For mat(DateValue(t xtDateFrom.Text ), "yyyy-MM-dd"),
Format(DateValu e(txtDateTo.Tex t), "yyyy-MM-dd"), empcode.Text,
Session("AccCom pID"), Session("AccBra nchID")) -
hol_leav(Format (DateValue(txtD ateFrom.Text), "yyyy-MM-dd"),
Format(DateValu e(txtDateTo.Tex t), "yyyy-MM-dd"), empcode.Text,
Session("AccCom pID"), Session("AccBra nchID"))
Next
End If
Exit Sub
er:
Err.Clear()
Exit Sub

End Sub
--------------------------------------------------------------------------------------------------------------------------------------------

Help Needed !
Thank You.
Jun 27 '08 #1
0 919

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

Similar topics

2
4704
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 = IntVar() for part, list in info.masterList.items():
0
1524
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 wxTextCtrl is not editable, it is cannot get the focus. Why ?
3
1640
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 column is finally ,a error is happen underside is my program.
3
1788
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 in the correct order which works fine if the dataGrid.dataSource = "ArrayList", but it doesn't work for my IBindingList wrapper. If i bind the datasource to the arraylist method then the ListChangedEventHandler is never invoked and my grid only...
14
2117
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 grid and write to the database and I set the new Primary Keys and related Fields to the new asigned atuonumbers in the Access.
10
1915
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 textboxes that are intially set from the database. None of the items in the table are 'databound'. As of now, if the previous instance of the screen contained data in the first row boxes, that data is carried over, even if the boxes text value...
2
1930
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. -- both grid displays same data and same function is used to fetch data from the database.
12
5821
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 asterisk is in a blob, an asterisk that is contiguous to it is in the same blob. If a blob has more than two asterisks, then each asterisk in the blob is contiguous to at least one other asterisk in the blob. For example this 12x12 grid has 6 blobs. ...
6
1813
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. One of the requirements is that the calendar will need to display a varying number of months (1..3)
2
6583
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 in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
8367
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8570
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7391
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.