Custom Search

jobs

Populating Gridview using Rowdatabound Event

The Html Code

<asp:GridView ID="OrderGrid" runat="server" DataKeyNames="OrderTotal,OrderDate" AutoGenerateColumns="false">
       <Columns>
         <asp:TemplateField>
           <HeaderTemplate>
               <asp:Label ID="Label2" runat="server" Text="Order Total"></asp:Label>
           </HeaderTemplate>
           <ItemTemplate>
               <asp:Label ID="OrderTotalTxt" runat="server" Text="Label"></asp:Label>
           </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField>
           <HeaderTemplate>
               <asp:Label ID="Label3" runat="server" Text="Order Date"></asp:Label>
           </HeaderTemplate>
           <ItemTemplate>
               <asp:Label ID="OrderDateTxt" runat="server" Text="Label"></asp:Label>
           </ItemTemplate>
         </asp:TemplateField>
       </Columns>
    </asp:GridView>

the code behinde vb.net
Loading the Grid

Protected Sub LoadOrderGrid()
        OrderGrid.DataSource = ObjectOrder.GetOrdersAdminAll()
        OrderGrid.DataBind()
    End Sub

Populating during Rowdatabound

Protected Sub OrderGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)  Handles OrderGrid.RowDataBound

        If e.Row.RowType = DataControlRowType.DataRow Then
             Dim OrderTotalTxt As New Label
             OrderTotalTxt = DirectCast(e.Row.FindControl("OrderTotalTxt"), Label)
             OrderTotalTxt.Text = OrderGrid.DataKeys(e.Row.RowIndex).Values("OrderTotal").ToString()
             TotalAmount += Convert.ToDecimal(OrderTotalTxt.Text)
             Dim OrderDateTxt As New Label
                OrderDateTxt = DirectCast(e.Row.FindControl("OrderDateTxt"), Label)
                OrderDateTxt.Text = OrderGrid.DataKeys(e.Row.RowIndex).Values("OrderDate").ToString()

                OrderDateTxt.Dispose()
                OrderTotalTxt.Dispose()

        ElseIf e.Row.RowType = DataControlRowType.Footer Then

        NumberOfOrders.Text = OrderGrid.Rows.Count()
        TotalAmountofOrders.Text = "$ " & TotalAmount
        End If

    End Sub

Computer programmed the Programmer

I just came out from the toilet, and I just got a brilliant idea while I was dumping… I came up an idea of having a story about a computer gained an unknown demonic or unnatural energy programmed its user.

The story will start from a Programmer 26 years of aged, he had a PC which he loves so much, coming home late from work… he then go straight to his PC like a husband going straight to his wife… then suddenly… he notice something is not right.. the computer has now a mind of its own and it is the one telling him what to do…

can you finish the story??? sorry for my bad grammar… but this will be a good start… I am very sleepy now thanks…

Work in Singapore

how to work in singapore in times of crisis. Many people around the world are blah. blah.. blah….