Sreevani replied to the topic 'Can you gove some examples on how to create properties' in the forum. 5 months ago

Inside the class, we can create properties. Few examples of properties are :

public string UserName { get; set; }

public string Password { get; set; }

public long MobileNumber { get; set; }

public DateTime DateofBirth { get; set; }

public bool Indian { get; set; }

Read More...

Sreevani replied to the topic 'How to create Views in Asp.Net MVC' in the forum. 5 months ago

To create View:

Step 1: Right click on the default view named 'Index' and select Add View.



Step 2: Now give the View name as "Login" and then select Template as 'Create'.



Step 3: Select Model class as your Class Name "MyClass".



Step 4: Clickk on Add.



Step 5: Now the view is created in the Views folder.



View Code looks like:



Read More...

Sreevani replied to the topic 'How to create controller in Asp.Net MVC' in the forum. 5 months ago

What is Controller?
Asp.net MVC Controllers are responsible for controlling the flow of the application execution. When you make a request to MVC applications, a controller is responsible for returning the response to that request. A controller can have one or more actions. A controller action can return different types of action results to a particular request.

Creating a Controller:

After creating new Asp.net MVC project and Model with required properties we have to create Controller.
Step 1: In Solution Explorer, right-click on the Controllers folder and select the option Add and then Controller.



Step 2: After selecting the 'Add Controller', dialog box is being displayed. In that Add Scaffold dialog box, click 'MVC 5 Controller - Empty', and then click Add.



Step 3: Name your new controller as "MyFirstController".



Step 4: Now the New Controller is created under Controllers folder.



Read More...

Deebhana is friends with Sreevani

Tarun is friends with Sreevani

Sreevani replied to the topic 'How to write login inside a controller?' in the forum. 7 months ago

A controller is a JavaScript Object, created by a standard JavaScript object constructor.Logic is always written inside the controller.

Below is example to write Logic inside the controller.

<script>
var app = angular.module("myModule", []);
app.controller("ctrl1", function($scope) {
<!-- Logic always comes here -->
});
</script>

Read More...

Sreevani replied to the topic 'How to bind scope variables inside HTML Div s' in the forum. 7 months ago

We can bind scope variables inside HTML Divs by writing expression inside the double parenthesis {{ }}.

For Example:

<script src=" ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js "></script>

<div ng-app="myModule">
<div ng-controller="ctrl1">
<b>
{{ Greeting }}
</b>
</div>
</div>

<script>
var app = angular.module("myModule", []);
app.controller("ctrl1", function($scope) {
$scope.Greeting = "Welcome";
});
</script>

Read More...

In below example created three controllers to declare string, arrays and json objects in each controller.

<script src=" ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js "></script>


<div ng-app="myModule">
<div ng-controller="Ctrl1">
{{Greeting}}
</div>
<br/>
<div ng-controller="Ctrl2">
{{GreetingArray}}
</div>
<br/>
<div ng-controller="Ctrl3">
<div ng-repeat="dm in Dayobject">
{{dm.Day}} :
{{dm.Month}}
</div>
</div>
</div>

<script>
var app = angular.module("myModule",[]);

<!-- String Declaration -->
app.controller("Ctrl1",function($scope){
$scope.Greeting = "Welcome";});

<!-- Array Declaration -->
app.controller("Ctrl2",function($scope){
$scope.GreetingArray = ["Welcome","To","AngularJs"];}
);

<!--Object Declaration -->
app.controller("Ctrl3",function($scope){
$scope.Dayobject =
[
{Day:"Sunday",Month:"January"},
{Day:"Monday",Month:"February"},
{Day:"Tuesday",Month:"March"},
]
}
);
</script>

Read More...

Like foreach loop in Asp.net there is keyword 'ng-repeat' to loop a object in Angular Js.
We can display values on the user interface by giving expression inside the double parenthesis.

For Exampe:

<script src=" ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js "></script>

<div ng-app="myModule">
<div ng-controller="Ctrl1">
<div ng-repeat="dm in DayM | filter: abc | orderBy: 'Subject' ">
{{dm.Name}} :
{{dm.Address}}
</div>
</div>
</div>

<script>
var app = angular.module("myModule",[]);

app.controller("Ctrl1",function($scope){
$scope.DayM =
[
{Name:"James",Address:"USA"},
{Name:"Jack",Address:"Russia"},
{Name:"Jill",Address:"Paris"},
]
}
);

</script>

Read More...

Sreevani replied to the topic 'Can someone give 2or 3 examples for filters?' in the forum. 7 months ago

In below example, the filters that are used : OrderBy, Uppercase and Lowercase.

<script src=" ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js "></script>

<div ng-app="GmailModule">
<div ng-controller="GmailCtrl">
<div ng-repeat="dm in DayM | filter: abc | orderBy: 'Subject' ">
<!-- orderBy used to order by in ascending order. -->
<!-- uppercase used to convert all letters into uppercase -->
<!-- Lowercase used to convert all letters into Lowercase -->
{{dm.Day | uppercase}} :
{{dm.Month | lowercase}}
</div>
</div>
</div>

<script>
var app = angular.module("GmailModule",[]);

app.controller("GmailCtrl",function($scope){
$scope.DayM =
[
{Day:"Sunday",Month:"January"},
{Day:"Monday",Month:"February"},
{Day:"Tuesday",Month:"March"},
]
}
);

</script>

Read More...

Sreevani replied to the topic 'How to link your controller to HTML code?' in the forum. 7 months ago

To link controller to HTML code syntax:
ng-controller keyword is used to bind html code.

<script src=" ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js "></script>

<div ng-app="myModule">
<div ng-controller="myCtrl">
{{ Greeting}}
</div>
</div>

<script>
var app = angular.module("myModule",[]);
app.controller("myCtrl",function($scope){
$scope.Greeting = "Welcome";
});

</script>

Read More...

Sreevani replied to the topic 'How to see table with border' in the forum. 7 months ago

The following HTML table will be displayed with borders :
<table border="1">
<tr style="color:blue">
<th>column1</th>
<th>column2</th>
</tr>
<tr>
<td>Hi</td>
<td>Welcome</td>
</tr>
<tr>
<td>To</td>
<td>AngularJs</td>
</tr>
</table>

Read More...