Tuesday, October 30, 2012

JavaScript - Current Date less than Chosen Date


Example:


 var dateField = document.getElementById("txtAppDate").value;
           dateField=dateField.replace("-","/");
              var d=dateField.replace("-","/");        
            var stDate = new Date();
            var enDate = new Date(Date.parse(d));
            var compDate = enDate - stDate;



if(compDate<=0)
                {
                    alert('the entered appointment Date should be greater than todays date');
                    return false;
                }

Sunday, October 7, 2012

SSRS - HTTP 401: Unauthorized With the Reporting Services Web Service


Solution:
You would have to change the reporting services authentication mode to "Basic" from Windows. 

Open RSReportServer.config (by default, C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer) and replace 

<Authentication>
<AuthenticationTypes>
<RSWindowsNTLM/>
</AuthenticationTypes>
<EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>

with following entry -

<AuthenticationTypes>
<RSWindowsBasic/>
</AuthenticationTypes>

Wednesday, October 3, 2012

SSRS - Adding Date as Optional Parameter with NULL Check Box in SSRS


Chart Visibility if Date is null means set visible=false otherwise visible=true.


=IIF(Isnothing(Parameters!DATE_FROM_PARAM.Value) ,false,true)

SSRS - get Month Name function



Example:1
=MonthName(Month(Fields!datefield.Value))

Example:2
 =MonthName(Month(TODAY))

SSRS - Show All Skipped Labels on the X-Axis

My SSRS report does not show all the labels on the horizontal axis. Please see below.



Just about everyone who has worked with category names on the Microsoft Reporting Services or .NET chart has encountered this problem: you databind categorical values from a database, but when it is displayed on the chart, it skips labels on the x-axis, like below:
intervalauto

How Do I Show All Labels on the X-Axis?

The short answer is, set the Interval property on the x-axis to 1:
1// Show all labels on the x-axis
2Chart1.ChartAreas[0].AxisX.Interval = 1;

Issues Created by Solving the X-Axis Label Issue

Showing every x-axis label produces the intended effect of matching every name to a data point, but it also causes clutter if there are too many points or the names are too long.  For example, look at what happens when I databind first and last names of each sales person:
intervalautolabel1

Monday, October 1, 2012

ASP.NET - close child window and refresh parent window

Example:1
ASP.NET 2.0
Page.ClientScript.RegisterStartUpScript(this.GetType(),"close","<script language=javascript>window.opener.location.reload(true);self.close();</script>");

Example:2
ASP.NET 1.X
Page.RegisterStartUpScript("close","<script language=javascript>window.opener.location.reload(true);self.close();</script>");
Example:3
Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "&lt;script language=javascript>window.opener.location.reload(true);self.close();</script>");
     }
Example:4
 
protected void btn_submit_Click(object sender, EventArgs e){

string Isok = "";
//*****save data to database code here, if save ok, then set Isok="y", else set Isok="n". ******
if (Isok=="y"){ //close window and refresh parent winsow

Page.ClientScript.RegisterStartUpScript(this.GetType(),"close","<script language=javascript>window.opener.location.reload(true);self.close();</script>");
}


Example:5

window.opener.location.href="parentWindow.aspx"
self.close();
Example:6
<script language="JavaScript">
<!--
function refreshParent() {
  window.opener.location.href = window.opener.location.href;

  if (window.opener.progressWindow)
  
 {
    window.opener.progressWindow.close()
  }
  window.close();
}
//-->
</script>

Wednesday, September 26, 2012

SSRS - How to show a tablix inside a tablix

1.     Background

This article describes how we can show a tablix inside a tablix. Cascade tablix report is very useful in such cases where we need to show summary and detail data within the same report. One tablix can be used for summary data and another tablix can be used for detail data. The advantage of this kind of report is that we don’t need to create sub report to show detail data.

Let’s consider the below data for the article. Below table having information about Country, city and its population with respect to male and female:

2.     Steps to create cascade tablix report


                    I.            Create a data source that points to required server and database.

                  II.            Create a dataset having the below SQL query:
    SELECT * FROM Population

 Dataset output is same as above mentioned table.

Create a simple tabular report having two columns Country Name and Total Population:


               III.            The above report is simple report does not having any groupings. Now we will add a group for Country Name. For Grouping, Go to grouping paneè Row Grouping èright click on the Details groupè Group propertiesèGeneral tabè Group on should be “Country Name”è click.

 
                IV.            Now go to report layout and add sum function to numerical value(Population field):

                  V.            Preview the report. We can see all country names with total population. So this report is showing summary data for country and its population.


                VI.            Now create one more tablix using the same dataset that above report is using for showing detailed data:
              VII.            Preview the report. We can see first tablix showing summary data and second tablix showing detail data.

            VIII.            Go to Report layout è first tablixè right click on left most of the row è Insert rowè Insert Group below:


 It will add a new row to tablix within the same grouping:
                IX.            Merge the cells of newly created row:

                  X.            Right click on the second tablix, copy and paste on newly created row of first tablix. We can remove country column as it is already available in first tablix.

                      Preview the report:

                XI.            For better visibility, we can add drill down also. For adding drilldown,  right click on the row where second tablix is pastedèRow VisibilityèChange the display option – When the report is initially run to “Hide” and display can be toggled by Country Name textbox and click ok:


              XII.            Now preview the report. We can see the drilldown in the report. When initially report runs, it will show summary data:

            XIII.            For seeing the detail data, we can click on (+) sign :

3.     Conclusion


 We can show a tablix inside a tablix by inserting the tablix in any group of the parent tablix.