Monday, June 9, 2014

How to Prevent Blank Page/white space when a Rectangle is hidden in RDLC

Hi All,
   I had a requirement where in I want to hide Rectangle (which had tablix and charts inside it) to show and hide based on query string parameters. The requirement was working fine when it is showing the Rectangle but when the rectangle is hiding it is generating Blank Page.

I searched a lot for a solution and came to know one trick which i would like to share with you .

I took a  new Table(Tablix) . 
Select the Row of the tablix and apply the same visibility expression on the Row visibility that I have applied on Rectangle .
Now drag the rectangle inside the Table row cell , in which you have applied expression .Thats it...!!!
Now check , it will not render Blank page / white space any more... :-)


Point to Note : One thing that only I have noticed and would like to tell you..First apply the Row visibility Expression and then only drag the Rectangle inside the Row cell of the table. This is because , I wasn't able to select the row , if you dragged the Rectangle first.. If you try to select Row, Rectangle gets selected....



Hope it helps!!!

Thanks ,
Nitin Sharma

Saturday, June 7, 2014

Convert input string to Title case in C#

Hi All,
   
     This post is about how to convert your input string into TITLE case in C#.

First , let me tell you what is title case : 

When writing a name or a title, it is a common convention to only use capital letters to start the principal words. This is called Title Case. When using Title Case, do not use capital letters for prepositions, articles or conjunctions unless one is the first word.

Examples:
  • Snow White and the Seven Dwarfs.
  • Newcastle upon Tyne / Brighton on Sea .
  • The DiMaggio Line .
  • The Last of the Mohicans .



You can convert your input string either in C# code  or in SQL function (scalar function) :

Convert to Title case in C#

  public static String TitleCaseString(String s)
        {
            if (s == null) return s;

            String[] words = s.Split(' ');
            for (int i = 0; i < words.Length; i++)
            {
                if (words[i].Length == 0) continue;

                Char firstChar = Char.ToUpper(words[i][0]);
                String rest = "";
                if (words[i].Length > 1)
                {
                    rest = words[i].Substring(1).ToLower();
                }
                words[i] = firstChar + rest;
            }
            return String.Join(" ", words);

        }


Convert to Title case in SQL Server function :


CREATE FUNCTION udf_TitleCase (@InputString VARCHAR(4000) ) 
 RETURNS VARCHAR(4000) 
 AS 
 BEGIN 
 DECLARE @Index INT 
 DECLARE @Char CHAR(1) 
 DECLARE @OutputString VARCHAR(255) 
 SET @OutputString = LOWER(@InputString) 
 SET @Index =
 SET @OutputString = 
 STUFF(@OutputString, 1, 1,UPPER(SUBSTRING(@InputString,1,1))) 
 WHILE @Index <= LEN(@InputString) 
 BEGIN 
 SET @Char = SUBSTRING(@InputString, @Index, 1) 
 IF @Char IN (' ', ';', ':', '!', '?', ',', '.', '_', '-', '/', '&','''','(') 
 IF @Index + 1 <= LEN(@InputString) 
 BEGIN 
 IF @Char != '''' 
 OR 
 UPPER(SUBSTRING(@InputString, @Index + 1, 1)) != 'S' 
 SET @OutputString = 
 STUFF(@OutputString, @Index + 1, 1,UPPER(SUBSTRING(@InputString, @Index + 1, 1))) 
 END 
 SET @Index = @Index +
 END 
 RETURN ISNULL(@OutputString,'') 
 END


   Hope this will help!!
  Regards,
  Nitin  Sharma

Saturday, April 19, 2014

हनुमान जी की पूजा



हनुमान जी की पूजा में  इन पांच वस्तुओं को अवश्य शामिल करें :


  •  तुलसी के पत्ते 
  •  बेसन के लड्डू 
  •  लाल रंग का तिकोना झंडा 
  •  सिन्दूर 
  •  लाल वस्त्र 



धन्यवाद ,
नितिन शर्मा

Sunday, February 16, 2014

Make RDLC reports as alternate row color

Hi friends,
  Today I will let you know how to make the RDLC rows as alternate colors.
  Just select the row of the report in Design and press F4 , now you can see the properties.
  In the BackgroundColor , click on the Expression hyperlink and write the below expression :

 
=iif(RowNumber(
Nothing) mod 2, "LightBlue", "LightCyan")


Thats it.. you can change the color as you need. I have taken as LightBlue and LightCyan as an example.

Thanks,
Nitin Sharma