applied to a DOM element will render nice flat scrollbars:
Yes, it’s not standard CSS, but other browsers offer similar extensions (WebKit, I am looking at you). So, it works nice and well, but what if you want to style scrollbars of an IFRAME? Continue reading 'Style IFRAME scrollbars in IE'»
Would set style of grid header and rows via external CSS class. You would expect that simple defining classes like this:
.HeaderStyle { /* style definition goes here */ }
.RowStyle { /* style definition goes here */ }
should do the trick, but you may experience some unwanted, erratic behavior: styles getting lost, styles getting mixed up (row would get a header style and vise versa).
To fix this we should let grid know that header style should apply only to header row (THEAD/TH HTML elements) and row style applies only to rows with data (TBODY/TD elements). This is done via slight adjustments of the above CSS to point it to specific elements:
This way there’s no confusion, styles apply exactly were they belong. Also you may need to set grids MergeStyles property to False and make each class fully define it’s element (including fonts, colors, backgrounds etc.)
It’s a common scenario: user needs to download a file from the server by clicking link or a button in your ASPX page. The server-side code for this is pretty straightforward and looks something like this:
Sub DownloadFile(ByVal i_sServerPath As String, ByVal i_sDisplayName As String)
Dim oFile As FileInfo = New FileInfo(i_sServerPath)
With Response
.Clear()
.ClearHeaders()
.AddHeader("Content-Length", oFile.Length.ToString())
.ContentType = ReturnContentType(oFile.Extension.ToLower())
.AddHeader("Content-Disposition", "attachment; filename=" & i_sDisplayName)
.TransmitFile(oFile.FullName)
.End()
End With
End Sub
The code accepts 2 parameters: i_sServerPath – full path to the file on the server and i_sDisplayName – file name that will be displayed to the user in the “Save As” dialog. Code also populates response headers based on file information. I use this handy function to populate ContentType based on file extention:
Function ReturnContentType(ByVal i_sfileExtension As String) As String
Select Case i_sfileExtension
Case ".htm", ".html", ".log" : Return "text/HTML"
Case ".txt" : Return "text/plain"
Case ".doc" : Return "application/ms-word"
Case ".tiff", ".tif" : Return "image/tiff"
Case ".asf" : Return "video/x-ms-asf"
Case ".avi" : Return "video/avi"
Case ".zip" : Return "application/zip"
Case ".xls", ".csv" : Return "application/vnd.ms-excel"
Case ".gif" : Return "image/gif"
Case ".jpg", "jpeg" : Return "image/jpeg"
Case ".bmp" : Return "image/bmp"
Case ".wav" : Return "audio/wav"
Case ".mp3" : Return "audio/mpeg3"
Case ".mpg", "mpeg" : Return "video/mpeg"
Case ".rtf" : Return "application/rtf"
Case ".asp" : Return "text/asp"
Case ".pdf" : Return "application/pdf"
Case ".fdf" : Return "application/vnd.fdf"
Case ".ppt" : Return "application/mspowerpoint"
Case ".dwg" : Return "image/vnd.dwg"
Case ".msg" : Return "application/msoutlook"
Case ".xml", ".sdxl" : Return "application/xml"
Case ".xdp" : Return "application/vnd.adobe.xdp+xml"
Case Else : Return "application/octet-stream"
End Select
End Function