I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
If you want to search string from given string then you should use String class. A String class have different methods through them we can search any text from the given Text. In this example, i will take indexOf() method , its a more popular method. Actually This method work when your search characters sequence match with the given text. Now , take a simple example of it.
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.10.2.js"></script>
<script>
$(function () {
$('#Button1').click(function () {
if ($('#Text1').val().indexOf('jacob') != -1) {
alert('string match');
return true;
}
else {
alert('string doesnt match');
return false;
}
});
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Example of string , exist or not
</div>
<input id="Text1" type="text" value="jacob" /><br />
<input id="Button1" type="button" value="button" />
</form>
</body>
</html>
In this example when we press the button,the entered text in the textbox match with the 'jacob' string which is defined in the index( ) method. If your entered text match then Jquery Return true other wise else. Here '-1' means , null value search.
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.10.2.js"></script>
<script>
$(function () {
$('#Button1').click(function () {
if ($('#Text1').val().indexOf('jacob') != -1) {
alert('string match');
return true;
}
else {
alert('string doesnt match');
return false;
}
});
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Example of string , exist or not
</div>
<input id="Text1" type="text" value="jacob" /><br />
<input id="Button1" type="button" value="button" />
</form>
</body>
</html>
In this example when we press the button,the entered text in the textbox match with the 'jacob' string which is defined in the index( ) method. If your entered text match then Jquery Return true other wise else. Here '-1' means , null value search.
Comments
Post a Comment