Monday, June 9, 2014
How to Prevent Blank Page/white space when a Rectangle is hidden in RDLC
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#
This post is about how to convert your input string into TITLE case in C#.
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# :
Sunday, February 16, 2014
Make RDLC reports as alternate row color
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
Monday, September 16, 2013
How to find 2nd,3rd,4th ..... nth largest / smallest salary in a table
Just thought to share with you some simple SQL query that is used very frequently in our projects and mostly asked in interviews as well.
It is " Write a SQL Query to find the 2nd, 3rd, 4th ...........nth largest salary from a table".
So Here is the SQL Query to find out the 3rd largest query from a table :
Tuesday, September 10, 2013
Interview Questions :- .NET,ASP.NET , SQL Server , C#, SharePoint, Javascript, Jquery
Below are some Questions ( not answers :-) ) that are asked in interviews that I have faced. Hope they prove useful to you for your preparation at some point of time.
The Questions are mixed of : ASP.NET , SQL Server , .NET Framework , SharePoint , C# , OOPS
- What are magic tables in SQL Server
- How many and what are temp tables in Sql Server ?
- How will you call trigger in Sql Server ?
- How will you call function in Sql Server ?
- There are 2 tables A and B having 3 columns each...What is the output of " Select * from A,B?
- What is the maximum number of Clustered indexes a table can have ?
- when you update a table in SQL Server management studio .., what exactly happens ?
- What is project life cycle?
- What are the differences b/w SQL Server 2008 and SQL Server 2012?
- What is the difference between Site Template and Site Definition?
- What are Generics in C# ? What is the use of it ?
- Protected vs Protected Internal in C# ?
- can we create master page through sharepoint desginer ?
- what is the difference between creating items through sharepoint designer and sharepoint server?
- ASP.NET page life cycle?
- when can we change page's Viewstate ? on which event ?
- can you create site template ? how ?
- what is the prurpose of SPSecurity class in SharePoint ?
- what is Code access security in .NET ?
- There are 2 tables A and B... A has 3 columns , 5 rows ... B has 2 columns , 3 rows ..What will be the output of a) Select * from A,B b) cross join between 2 tables (how many rows and columns will a cross join between 2 tables return ?)
- What are Cross joins ?
- how will update sharepoint list ? write the code.
- what are extension methods in C#?
- what are anonymous methods in c#?
- why multiple inheritance is not possible in C#?
- what is a site column in SharePoint?
- Difference b/w sandboxed and Farm solution?
- Difference b/w Web Parts and Visual Web Parts.
- how to make a master page in Sharepoint Site?
- abstract class vs interfaces
- Explain Sharepoint Object Model
- What are SPutility and SPMetal in SharePoint ?
- What is .wsdl file in a web service ?
- how many ways you handle erors in a web page ?
- HttpUtility class vs Http Module
- Can you run JSP pages in IIS ? How ?
- which exception will first occur ?inside BAL , DAL , or UI layers'?
- What does theme in CSS contains ?
- What are views in SQL Server ? can we perform DML in Views?
- User Defined Functions Vs Stored Procedure?
- Difference b/w SQL variable @ and @@
- Difference between Hidden Field vs Viewstate ?
- Boxing and Unboxing difference
- What are extension methods and extension classes in C#?
- Inproc vs Outproc in Stored Procedures?
- HTTP module vs HTTP handler
- HTTP get vs HTTP Post?
- Abstraction vs Encapsulation
- overloded methods can have different return type?
- static class vs Sealed classes .. why are they used ?
- polymorphism in C#
- types of triggers in SQL SERVER
- Left outer join in SQL SERVER
- What are indexes in SQL SERVER
- What are cursors in SQL Server
- What is the new keyword in Method overriding?
- What are different types of views in SQL Server?
- what is a $ sign in Jquery ?
- How will you enable a website to run only for indian country?
- what are lambda expressions in C#?
- what is difference between array and arraylist ? when to use what and which one is faster?
- what is datareader ? how is it different from dataset?
- What are out, ref parameter in C# method?
- For vs ForEach loop
- what is the benefit of putting the .wsp or solution file inside GAC and inside BIN?
- what is RunWithElevatedPrivileges in SharePoint?
- what is the difference between webpart and Visual WebPart?
- what is the difference between Sytem.web.UI.WebControls.Webparts.WebPart vs Microsoft.Sharepoint.WebPart?
- Abstraction Vs Encapsulation
- What is viewstate ? Can you store collections in Viewstate?
- What is the difference between Stored Procedures and User Defined Functions in Sql Server ?
- What is LINQ and advantages of LINQ ?
- I have a collection of strings , Which will be more efficient LINQ or normal for / for each loop?
- What are the ways of storing information into clients computers?
- What are Selectors in Jquery ?
- What are the advantages of Entity Framework?
- Request vs Response Cycle of a Page?
- Limitations of sharepoint designer
- how will you create master pages and how will you deploy?
- what is a feature ? how will you deploy feature?
- how will you associate one content type to 3 lists ?
- What is caching ? How many types of caching is there?
- What is the difference between caching and session ?
- Generic list vs arraylist vs array in terms of performance and why ?
- why serialization is done and what are the types of serialization?
- What is the difference b/w caching and Session ?
- Difference b/w httphandlers and http modules.
- what are the limitations or disadvandtages of Generics
- how to find the 4th highest salary in table?
- .net 2.0 vs .net 4.0 features
- What is garbage collector ?
- garbage collector dispose vs finalize
- what are table valued functions in SQL Server
- What are shared assemblies
- What is Isnull and collasce operator in SQL Server?
- interface vs abstract class
- return server date in javascript
- how to increment each salary of all employees with 500
- how to work with cookies in asp.net
- javascript function on html control click and asp.net control clickALL THE VERY BEST !!!
Saturday, February 18, 2012
Fetch / Get Current Date from SQL Server in a specific format
Working on Saturday is really a pain...Phew...!!!!...
I came across a requirement where you have to get a Current Date from Sql Server in the following format :
So, here is the script with the Sql Server Replace function...:
And the Result is :
Thanks,
Nitin Sharma
Happy Coding....
Wednesday, November 23, 2011
Apply Custom Style to Gridview using Style class and ApplyStyle method
In this post I will apply my own style to the Gridview Control.
1) Add a new page say "GV.aspx" in your asp.net website/web application.
2) Drag and drop Gridview and a button control from the toolbox on the page.
3) Bind the Gridview on page load event. I have used LINQ to SQL In this example for binding the Gridview.
The database used is Northwind. The name of LINQ class here is DB and I have added two tables Product and Category.
Tuesday, August 10, 2010
Database Back up using SQL Query
Monday, February 8, 2010
How to find the Size of Database File and Log File
I just went through Pinal Dave's Blog Today and found a very simple script for finding out the Database File Size and the Size of the Log file.Here it how it goes :
SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeMB
FROM sys.master_files
WHERE DB_NAME(database_id) = 'AdventureWorks'
GO
For detailed post you can visit here
Thanks Pinal for such a wonderful script..
Thanks ,
Nitin Sharma
Tuesday, December 29, 2009
Get Date of All Weekdays or Weekends of the Year
I was going through the Pinal Dave's Blog today...He has posted a wondeful post today ....You guys may find it very very useful...
The topic is Get Date of All Weekdays or Weekends of the Year.
http://blog.sqlauthority.com/2009/12/29/sql-server-get-date-of-all-weekdays-or-weekends-of-the-year/
Thanks,
Nitin Sharma
Tuesday, May 5, 2009
SQL SERVER CURSOR
A Simple Example of CURSOR
USE [Test]
GO
/****** Object: StoredProcedure [dbo].[ResetSlNoInPart] Script Date: 05/05/2009 10:59:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[ResetSlNoInPart]
(
@Filter_AC int -- For which AC to perform action
)
AS
BEGIN
DECLARE
@ID int, -- To identify record in which SLNOINPART is to be updated
@AC int, -- AC
@Part int, -- Part
@OldAC int, -- Old AC (for comparison in loop)
@OldPart int, -- Old Part (for comparison in loop)
@SerialNo int -- Serial No.
-- Create a new cursor that gets the ID, AC and Part for selected AC ordered by requirements
DECLARE SerialLoop CURSOR FOR
SELECT id, ac_no, part_no
FROM E_Draft_2
WHERE ac_no=@Filter_AC
ORDER BY ac_no ASC, part_no ASC, section_no ASC, house_no_en ASC, age DESC
-- Initialize the comparison variables
SET @OldAC=0
SET @OldPart=0
-- Open and start the loop
OPEN SerialLoop
FETCH NEXT FROM SerialLoop
INTO @ID, @AC, @Part
-- Repeat the loop till records exist
WHILE @@FETCH_STATUS=0
BEGIN
-- Compare and see whether Part or AC have changed
IF (@OldAC<>@AC) OR (@OldPart<>@Part)
BEGIN
-- If AC or Part changed, reset serial to 1 and update the comparison varialbes
SET @SerialNo=1
SET @OldAc=@AC
SET @OldPart=@Part
END
-- Update the current record with whatever serial no is current
UPDATE E_DRAFT_2
SET SLNoInPart=@SerialNo
WHERE ID=@ID
-- Debug print
PRINT 'AC='+Convert(varchar, @ac)+', part='+Convert(varchar, @part)+', sl='+Convert(varchar,@serialno)
-- Increment Serial no
SET @SerialNo=@SerialNo+1
-- Move to next record
FETCH NEXT FROM SerialLoop
INTO @ID, @AC, @Part
END
-- Cleanup
CLOSE SerialLoop
DEALLOCATE SerialLoop
END
Thanks,
Nitin Sharma
Monday, March 9, 2009
Multiple Joins in LINQ
Hi All,
This Post will show how to implement multiple Joins in LINQ.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class JoinsInLINQ : System.Web.UI.Page
{
DemoDataContext DC = new DemoDataContext();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
}
}
private void Bind()
{
// How to Apply Joins in LINQ
var items = from P in DC.Emps
join Ep in DC.EmpProducts on P.SINo equals Ep.SINo
join TT in DC.TextTables on P.SINo equals TT.SINo
select new
{
Name = P.Name,
Age = P.Age,
Country = P.Country,
State = P.State
};
GVInJoins.DataSource = items;
GVInJoins.DataBind();
}
}
On Debugging the Query we will find it like as........
FROM [dbo].[Emp] AS [t0]
INNER JOIN [dbo].[EmpProduct] AS [t1] ON [t0].[SINo] = [t1].[SINo]
INNER JOIN [dbo].[TextTable] AS [t2] ON [t0].[SINo] = [t2].[SINo]
}
Now finally Bind the Output to the Gridview and its ready now...

Thanks to LINQ :)
Thanks,
Nitin Sharma






