Skip to main content

Posts

Set dropdown value by text in jquery

 var purpose = 'SomeText';                         $("#ddlPurpose option").each(function () {                             if ($(this).text() == purpose) {                                 $(this).attr('selected', 'selected');                             }                         });

STATIC METHOD in C#

Static methods are those methods which are known as a class level method. We call the static method with the name of class. Example Public Class1 { Public static int sum (int x, int y) { Return x+y; } } Calling of Static Method: Response. Write (Class1.sum (45, 55));

STATIC VARIABLE in C#

Static variables are those variables which persist their value throughout your project. Static veriable also known as class variable.Although there are the class variables so when the class load in the memory the static memory will be allocated. Example Public static int c;

COLLECTION in C#

When we need to store any kind of data then we use collection and can hold all data at run time.  The namespace which collection use is system collection. The only drawback of collection is that when we retrieve the data from collection we have to implement type casting.

2-d (Dimensional) ARRAY in C#

Two dimensional arrays are those arrays which are used to maintain data in the form of row and column. It stored in tabular format. Declaration of 2D array Int [,] marks = new int [3, 4]; For (int i = 0; i<3; i++) { For (int j=0; j<4; j++) { Marks [I,j] = 34; } }

What is Array in C#

Array is a collection of similar data types. In array we access the value using index. Declaration of array Int [ ] marks = new int [5]; Assigning value to the array Marks [0] = 90; Marks[1] = 80; Int [ ] marks = new int [ 5 ] { 2, 3,4,5,6 } Int [ ] marks = { 2, 3, 4,5, 6,7,8} Retrieving value from Array int Sum = 0; For (int i=0; i<= marks. Length; i++) { Sum = Sum + marks [i]; } Response. Write (sum);