Wednesday, August 24, 2011

Row/Item Count in Repeater

Using below code you can get Repeater's Row/Item Count: in below code "Container.ItemIndex" is used to get current row number and "(string[])rpttags.DataSource).Length" is used to get total row/item count. in above line my datasource for repeater was a string array so i used string[] as datasourcetype and used length to get its count in same way you can get for all other types eg:- <%# (Container.ItemIndex < ((yourDataSourceDataType)rpttags.DataSource).Length...
Read More

Monday, August 22, 2011

HTML Encode/Decode using JQuery

using below code you can encode/decode html tags using jquery function htmlEncode(value){ return $('').text(value).html(); } function htmlDecode(value){ return $('').html(value).text(); } Compiled By: Rajesh Rol...
Read More

Friday, August 12, 2011

SQL Server parameter sniffing

While working on a project which has huge database interaction and i was using stored procedure to get good performance. But even though i was using stored procedure the performance was not so good all the time. I mean it was not consistent, for few queries on same stored procedure it was so good and some times it was going worst. I have done lots of google for it and finally i got the solution.. The easiest solution which...
Read More

Thursday, August 11, 2011

How to Query for single value for multiple column in fulltext search

Search a value in multiple column using fulltext search: select * from productmaster where FREETEXT((productName,productDetails),'Search this text') Compiled By: Rajesh Rol...
Read More

show multiple jquery scroller in single page

To show multiple jquery scroller in single page just add an extra div on outer side or every scroller. means place every scroller in seperate div and its done.. Compiled By: Rajesh Rol...
Read More

Wednesday, August 10, 2011

What is difference between Dictionary and Hashtable

The fact is that dictionary is a hashtable. The main difference is that dictionary is a hashtable where as hashtable is not. That means you get type safety with Dictionary, because you can't insert any random object into it, and you don't have to cast the values you take out. its almost similar what difference between array list and generic list. Compiled By: Rajesh Rol...
Read More

When caching is enabled for the XmlDataSource that is not in the page's control tree it requires a UniqueID that is unique throughout the application.

XmlDataSource class internally calls a private method called CreateCacheKey. Now, if you are using XmlDataSource without an ID, after upgrading the solution to ASP.NET 3.5, this might throw an exception - "When caching is enabled for the XmlDataSource that is not in the pages control tree it requires a UniqueID that is unique throughout the application." This is due to the absence of the UniqueID (which is read-only, but my experiment...
Read More

Tuesday, August 9, 2011

Query Xml File with Namespace using XPath

We all know how to get value from xml file in .net but we face issue when there is a namespace with that xml file. When a xml file contains a namespace then you will have to do some extra efforts to retrieve its value. Lets say my xml is like: Videos 119150 207463 somepath sometitle somelink ... http://someurl/standard-and-poors-india-connection/207463 Tue, 09 Aug 2011 6:26:48 IST 1312894608 Now i wants to access...
Read More

Wednesday, August 3, 2011

Handling null values with the Linq Aggregate methods

You can use it like: var value = (from t in _table where t.Id == id && t.Time >= intervalStartTime && t.Time <= intervalEndTime select (int?)t.Value).Average() Compiled By: Rajesh Rol...
Read More

For translation to SQL, the Math.Round method needs a MidpointRounding parameter. Use 'AwayFromZero' to specify the SQL function ROUND.

Whenever you will try to use Math.Round with LINQ, that time you will face this error: For translation to SQL, the Math.Round method needs a MidpointRounding parameter. Use 'AwayFromZero' to specify the SQL function ROUND. To overcome this problem. just do as its saying.. avgRate = Math.Round( (double) rmpd.Average(a => a.reate),1, MidpointRounding.AwayFromZero ) Compiled By: Rajesh Rol...
Read More

Tuesday, August 2, 2011

Find all possible combinations of a string

Using below function we can find all possible combinations of any string. static void Combination(string left, string right) { if (right.Length == 1) { Console.Write(left); Console.Write(right); Console.WriteLine(); return; } else { for (var index = 0; index < right.Length;...
Read More

Monday, August 1, 2011

Convert Integers to Binary, Octal or Hexadecimal

Console.WriteLine(Convert.ToString(value, 2)); // Outputs "10101010" Console.WriteLine(Convert.ToString(value, 8)); // Outputs "271" Console.WriteLine(Convert.ToString(value, 16)); // Outputs "b9" Compiled By: Rajesh Rol...
Read More
Powered By Blogger · Designed By Seo Blogger Templates