Category Archives: C#

Check whether a string is null, empty, or only contains the white-space characters

If you are working with the .Net framework 4.5, you can use the String.IsNullOrWhiteSpace Method to specify the string is null, empty, or consists only of white-space characters.

The following example contains the five string type variables, we pass the each variable into the IsNullOrWhiteSpace method to check whether a string is null, empty, or only contains the white-space characters. Continue reading Check whether a string is null, empty, or only contains the white-space characters

Click event of a Button on Click event of another button in C#

The following code example demonstrates how to call the Click event of a Button on Click event of another button. The following code assumes that two Button and one TextBox controls have been instantiated on a form. On the click of the button1, we will generate the click event of the button2 if the the value of the textbox1 is numeric. Continue reading Click event of a Button on Click event of another button in C#

How to show Indian currency symbol in MVC WebGrid

is the new Indian Rupee currency sign.it was presented to the public by the Government of India on 15 July 2010. When you try to show ₹ currnecy symbol using Culture and UCulture, you get the default currency symbol ‘Rs’ not ₹ then you need to set customize the symbol. Same problem occurs when you want to show this symbol in WebGrid in MVC projects. Continue reading How to show Indian currency symbol in MVC WebGrid

Generate xml document with elements and attributes using LINQ to XML

To generate a XML document with elements and attributes is easy by using LINQ to XML. LINQ to XML provides the XDocument, XElement and XAttribute classes,with the help of XElement class we can create XML content and create a new XML file using the XDocument class. Continue reading Generate xml document with elements and attributes using LINQ to XML

Create the XML document using LINQ to XML in C#

XML document is widely used file in the projects where we can store the small or big data such as configuration settings or last used data on the form. .Net framework provides various way to create the XML files (such as DataSet.WriteXML), but my concern it is so easy to create the XML document by using the LINQ to XML. Continue reading Create the XML document using LINQ to XML in C#