.NET, ASP, microsoft



ASP.NET Add Sub Header Row (Group) To GridView Control

    ''' <summary>
    ''' Insert a sub header in a grid view.
    ''' </summary>
    ''' <param name="gv">The GridView to insert the sub header row into.</param>
    ''' <param name="gvrBeforeRow">The GridViewRow to insert the sub header before.</param>
    ''' <param name="sSubHeaderText">The text to render in the sub header.</param>
    ''' <remarks></remarks>
    Protected Sub insertGroupHeaderToGridView(ByRef gv As GridView, ByVal gvrBeforeRow As GridViewRow, ByVal sSubHeaderText As String)
 
        Dim visibleColumns As Integer = gv.Columns.Count
 
        Dim tbl As Table = gv.Controls(0)
        Dim newRowIndex As Integer = tbl.Rows.GetRowIndex(gvrBeforeRow)
        Dim newRow As GridViewRow = New GridViewRow(newRowIndex, newRowIndex, DataControlRowType.DataRow, DataControlRowState.Normal)
 
        newRow.Cells.Add(New TableCell())
 
        If (visibleColumns > 1) Then
            newRow.Cells(0).ColumnSpan = visibleColumns
            newRow.Cells(0).Text = sSubHeaderText
        End If
 
        tbl.Controls.AddAt(newRowIndex, newRow)
 
    End Sub

Post Comment Now


Windows Media Player 11: How to share media files that are located on other computers on your home network (to share to your xbox 360 or other pc’s).

To enable remote content sharing

Perform the following steps on the computer that contains the library you are sharing.
1. Click Start, click Run, type regedit, and then click OK.
2. In the registry tree (on the left), expand HKEY_LOCAL_MACHINE, SOFTWARE, Microsoft, MediaPlayer, and Preferences.
3. Right-click HME, point to New, and then click DWORD Value.
4. Type EnableRemoteContentSharing, and then press ENTER.
5. Right-click EnableRemoteContentSharing, and then click Modify.
6. In the Value data text box, type 1, and then click OK. If you later decide to disable remote content sharing, you can repeat this procedure and change the value to 0.
Caution: Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on your computer.

To grant one user account permission to access folders on other computers

1. Click Start, click Control Panel, click Performance and Maintenance or System and Maintenance, click Administrative Tools, and then double-click Services.
2. Scroll down the list of services, right-click Windows Media Player Network Sharing Service, and then click Properties.
3. On the Log On tab, click This account, and specify a user account that has Read permission for the remote folders containing media that you want to share. This account should have a password that never expires.
4. On the General tab, click Stop, click Start, and then click OK.
5. On the computer containing the library you are sharing, click Start, click Run, type regedit, and then click OK.
6. In the registry tree (on the left), expand HKEY_LOCAL_MACHINE, SOFTWARE, Microsoft, and Windows Media Player NSS.
7. Right-click 3.0, and then click Permissions.
8. Click Add.
9. In the Enter the object names to select box, type the name of the account you specified in step 3 of the preceding procedure.
10. Click OK.
11. In the Group or user names box, click the name of the account you specified in step 3 of the preceding procedure.
12. In the Permissions box, on the Full Control row, select the Allow check box.
13. Click OK, and then close Registry Editor.
Caution: Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on your computer.

To enable sharing in Windows Media Player

1. Click the arrow below the Library tab, and then click Media Sharing.
2. In the Media Sharing dialog box, select the Share my media to check box.
3. In the list of devices below the Share my media to check box, select a device.
4. Do one of the following:
–If you want to share your media with the computer or device you have selected, click Allow.
–If you don’t want to share your media with the computer or device you have selected, click Deny.

More info here…

http://www.microsoft.com/windows/windowsmedia/player/faq/sharing.mspx


Post Comment Now


IIS 6.0 Registry Tweaks

Microsoft TechNet Article on Global Registry Entries

My main point of interest is the IIS logging. I would like to flush the log to disk before I run a script that gathers up all the logs and build useage reports every hour.

Although interesting, the following registry entry is no help. If you set the value to small the server performance will degrade quickly.

LogBufferSize
Registry Path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Http\Parameters\LogBufferSize
Data Type: REG_DWORD
Default Value: N/A
Range: 12,288 – 65,536 (12K – 64K)

Overrides the default logging buffer (per site) of 64K. Using this key, administrators can prevent excessive memory usage when running many thousands of sites on a server. This registry key does not exist by default and must be added to the registry.


Post Comment Now


Create and populate a simple calendar table in MS SQL

Edit as required…

USE master
go
 
IF  EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'tCalendar')
BEGIN
DROP TABLE tCalendar
END
go
 
CREATE TABLE tCalendar (
DateID INT IDENTITY(1,1) CONSTRAINT tCalendar_PK PRIMARY KEY CLUSTERED,
DATE DATETIME,
Holiday BIT DEFAULT 0,
Workday BIT DEFAULT 0)
go
CREATE UNIQUE NONCLUSTERED INDEX
tCalendar_date_N_Idx ON tCalendar(DATE)
go
 
--Populate all days
 
DECLARE @n INT
DECLARE @maxn INT
DECLARE @begindate DATETIME
SET @n =1
SET @maxn=36500    -- Number of days added to the calendar
SET @begindate =CONVERT(DATETIME,'01/01/1995')
-- Initial date for the first run is todays date
-- or Jan 1st
SET @begindate =@begindate -1
 
WHILE @n <= @maxn
BEGIN
INSERT INTO tCalendar(DATE) SELECT @begindate+@n
SET @n=@n+1
END
 
--update the holiday and workday flags
 
go
UPDATE tCalendar
SET holiday=1 WHERE DATENAME(dw,DATE) in ('Saturday','Sunday')
go
UPDATE tCalendar
SET workday=1 WHERE holiday=0
go
 
SELECT * FROM tCalendar

Post Comment Now


Add an indentity feild to an existing MS SQL table.

There is no easy way that I am aware of (in MS SQL 2000). You basically have to create a table with an additional identity field and import the data. Here is how you do it:

-From *Enterprise Manager, backup the original table by renaming it.
-From Query Analyzer, create new table…
-Right click the old table “Script Object to new window as ” -> “create”.
-Edit the ALL table names in the query to the original. (this makes a copy of the table structure)
-Execute.
-In Enterprise manager create new ID (identity column) and set the identity property to “yes, not for replication” in the newly created table (you may also want to set this column as the primary key).
-Import the data…
-Run this query in Query Analyzer, replacing the appropriate table names and column names. NOTE: the column names must be in the same order for both tables!
INSERT INTO [new_table] (list_all_the_column_names_to_import) SELECT list_all_the_column_names_to_import FROM [old_table]

* If you know your SQL query lingo well enough you can do everything from Query Analyzer.

:)


Post Comment Now


Blog | Contact | Gallery | Links | Sandbox | Social Networking | Weather | Web Design


Copyright © 1997-2009 KCSH. All rights reserved.