Showing posts with label asir. Show all posts
Showing posts with label asir. Show all posts

Friday, June 13, 2008

Dynamically Adding multiple row header to a datagrid

To add a row to a datagrid header dynamically use following code. Here we just adding new cells to the the datagrid at header ItemDataBound Event.

#VB.Net code:

Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal ev As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid.ItemDataBound ' Add a second header on a datagrid
If ev.Item.ItemType = ListItemType.Header Then ' Get the collection of cells from the datagrid
Dim totCells As TableCellCollection
' Get the collection of existing cells so we can get a count
totCells = ev.Item.Cells
' Create a new datagrid header object
Dim dgHeader As New DataGridItem(0, 0, ListItemType.Header) ' Add the created cell to the header
Dim vblCount As Integer
Dim vblCounter As Integer
vblCount = totCells.Count
vblCounter = 0
While vblCount > 0

'Creation of a new cell for datagrid
Dim CreatedCell As New TableCell
'To skip first cell of our grid
If vblCounter > 1 Then
CreatedCell.Text = "Text for New Cell"
End If

dgHeader.Cells.Add(CreatedCell)

vblCounter = vblCounter + 1
vblCount = vblCount - 1

End While
'While Closes here

dgHeader.Visible = True ' Add the header to the datagrid
DataGrid.Controls(0).Controls.Add(dgHeader)
End If
' If ends here
End Sub ' ItemDataBound Ends here

Thursday, June 5, 2008

Internet Explorer ( IE ) Shortcuts for Latest Version

Keyboard shortcuts

To Open links in a new tab in the background CTRL+click
To Open links in a new tab in the foreground CTRL+SHIFT+click
To Open a new tab in the foreground CTRL+T
To Open a new tab from the Address bar ALT+ENTER
To Open a new tab from the search box ALT+ENTER
To Open Quick Tabs (thumbnail view) CTRL+Q
To Switch between tabs CTRL+TAB/CTRL+SHIFT+TAB
To Switch to a specific tab number CTRL+n (n can be 1-8)
To Switch to the last tab CTRL+9
To Close current tab CTRL+W
To Close all tabs ALT+F4
To Close other tabs CTRL+ALT+F4



Mouse shortcuts

To Open a link in a background tab - Click the middle mouse button on a link
To Open a new tab - Double-click the empty space to the right of the last tab
To Close a tab - Click the middle mouse button on the tab

Wednesday, April 30, 2008

Compare two Dates in SQL Server

The below QUERY can compare two dates in sql server. In that query CONVERT() function is exist. Date value is changed into varchar data type by using CONVERT() function . Here we change the DATETIME data type into varchar. So we got exact date alone. The query as follows....

SELECT *
FROM Login_Attendance
WHERE (DATEDIFF(day, CONVERT(varchar(10), currdate, 101), CONVERT(varchar(10), '4/25/2008', 101)) = 0)

Here,

101----> denotes the required format(mm/dd/yyyy) of the date

For eg:
currdate='4/25/2008 2:23:34 PM'