Tuesday, October 20, 2009
JavaScript
1) Disabling an item in a dropdown list:
2) Restriction in number of characters or lines in a multiline textbox
3) Blocking the right click / left click
To call it:
onMouseDown="whichButton(event)"
4) Cleaning the clipboard:
Encoding Problems
To Recover this value, we do not need to do anything special just:
References:
http://msdn.microsoft.com/en-us/library/zttxte6w.aspx
http://www.w3.org/International/tutorials/tutorial-char-enc/
Wednesday, July 22, 2009
Friday, July 17, 2009
External Stylesheets issue in Telerik Reporting
I was able to create an stylesheet, exported into an xml file and then referenced it into another report and even though I could see the styles in the designer, when I run my project the styles simply disappeared.
Solution 1:
In the page where the report is called add the following code (replace the path properly):
Dim ess As New Telerik.Reporting.Drawing.ExternalStyleSheet("..\StyleSheets\TahomaSmall.xml")
myReport.ExternalStyleSheets.Add(ess)
Me.ReportViewer1.Report = myReport
Solution 2:
Replace the path properly in the rpt.designer.vb
Me.ExternalStyleSheets.Add(New Telerik.Reporting.Drawing.ExternalStyleSheet("..\StyleSheets\TahomaSmall.xml"))
Issue cause:
Even though the report has a reference to the external stylesheet in its vb code if your report is not in the same directory as your stylesheet it has to be estated like that in the reference.
Telerik Reporting Report
Wednesday, July 15, 2009
Issues with generated WebProject dll
Unable to copy file "obj\Debug\MyProjectXXX.dll" to "bin\Debug\MyProjectXXX.dll". The process cannot access the file 'bin\Debug\MyProjectXXX.dll' because it is being used by another process.
The project it's trying to build is a class library referenced by a couple of other projects in the solution.
Solution
1. Delete whatever files exist in obj/Debug (just files)
2. Add these two lines to the "Pre-build event command line" in the MyProjectXXX properties:
if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
1. Build the project again.
Reference:
http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/68648642-08d8-4cff-b0c3-c2782f010589
Wednesday, July 8, 2009
Telerik Reporting
Advantages over SRS:
1. It doesn't need to work with SQL Server, thus it doesn't depend on any SQL upgrade.
2.Since it doesn't need SQL Server information, the program (VStudio) can perfectly send a dataset which will be directly read by the telerik reporting report control.
3.We can easily define user functions using vb sintaxis and everything we are used to use in VStudio.
4.Stylesheets are easy to implement.
Using stylesheets in Telerik Reporting Reports
To use stylesheets in a Telerik reporting report you just need to do this two steps:
1. Define your own styles for a report (template report)
2. Export your styles to a xml file in order to be called from other reports.
http://www.telerik.com/help/reporting/style-exportingand-reusing-style-sheets.html
How to send a Telerik Reporting Report by email?
I will explain it step by step following the architecture I have here, which is one complete project for all the application reports, so that all the reports will be stored in only one place and called from wherever is needed.
MyWebProject - Architecture
rptFilters.aspx.- It contains the report filters (user input to get the data). These pages are created by report.
ReportPreview.aspx.- It contains the ReportViewer control. It is only one ReportPreview page for all the report filters pages because the filter page from it gets the data is a parameter.
Report.vb.- This is the report.
Report.vb code extract
Getting the information from a dll method (the hatParams table has been filled in the rptFilters.aspx.vb page)
Public Sub New(ByVal strParams As String, ByVal strUser As String, ByVal strServer As String, ByVal strPort As String, ByVal intComp As Integer, ByVal strLang As String)
Dim cSynergy As DLLSynReports.clsReports
Dim hatParams As Hashtable = Nothing
Dim dsData As System.Data.DataSet = Nothing
Dim iResult As Integer
cSynergy = New DLLSynReports.clsReports(strUser, strServer, strPort, intComp, strLang, strPath, strModName)
hatParams = FillHashTableByReports(strUser, "rptOrderStatus", strParams)
InitializeComponent()
Try
iResult = cSynergy.GetUnicSOReport(CType(hatParams("WhseFrom"), Integer), _
CType(hatParams("WhseTo"), Integer), CType(hatParams("ReqDateFrom"), Integer), _
CType(hatParams("ReqDateTo"), Integer), CType(hatParams("PlantDateFrom"), Integer), _
CType(hatParams("PlantDateTo"), Integer), CType(hatParams("ShipDateFrom"), Integer), _
CType(hatParams("ShipDateTo"), Integer), hatParams("ProductFrom").ToString, _
hatParams("ProductTo").ToString, CType(hatParams("GroupProdFrom"), Integer), _
CType(hatParams("GroupProdTo"), Integer), CType(hatParams("ShipToFrom"), Integer), _
CType(hatParams("ShipToTo"), Integer), CType(hatParams("Dept"), Integer), _
CType(hatParams("SalesManFrom"), Integer), CType(hatParams("SalesManTo"), Integer))
Me.DataSource = dsData
Catch ex As System.Exception
'An error has occurred while filling the data set. Please check the exception for more information.
System.Diagnostics.Debug.WriteLine(ex.Message)
End Try
End Sub
ReportPreview.aspx.vb