TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
611
128.1k
Null value in error mvc.
Aug 7 2020 3:51 AM
I want to click a viewDetails button and show user profile. But I have faced an issue.
it's me get code
public
IActionResult UserDetail(
int
? UserId)-Here
null
userid
{
UserViewFullDetail obj_Detail =
new
UserViewFullDetail();
try
{
var Result = (from UM
in
_context.UserProfileMaster
join U
in
_context.UserMaster on UM.UserId equals U.UserId
where UM.UserId == U.UserId
where Convert.ToBoolean(UM.UserId == UserId)
select
new
{
UM.UserImage,
UM.FirstName,
UM.MobileNumber,
UM.Country,
UM.UserId,
UM.ZipCode,
UM.InstaUserName,
UM.LevelBaseBall,
UM.Address,
U.Dob
}).FirstOrDefault();
if
(Result !=
null
)
{
obj_Detail.Name = Result.FirstName;
DateTime dt = Convert.ToDateTime(Result.Dob);
obj_Detail.DOB =
string
.Format(
"{0:dd MMMM yyyy}"
, dt);
var Mob = Result.MobileNumber;
obj_Detail.MobileNumber = String.Format(
"{0:##########}"
,
double
.Parse(Mob));
obj_Detail.Country = Result.Country;
obj_Detail.UserImage = Result.UserImage;
obj_Detail.InstaUserName = Result.InstaUserName;
obj_Detail.Address = Result.Address;
obj_Detail.LevelBaseBall = Result.LevelBaseBall;
it's me view code
@model NBP_BaseBallAdmin.ViewModel.UserViewFullDetail
@{
ViewData[
"Title"
] =
"UserDetail"
;
Layout =
"~/Views/Shared/_Layout.cshtml"
;
}
<!-- Body Content Wrapper -->
<div
class
=
"ms-content-wrapper categories"
>
<div
class
=
"row"
>
<div
class
=
"col-md-12"
>
<nav aria-label=
"breadcrumb"
>
<div
class
=
"row"
>
<div
class
=
"col-md-6"
>
<ol
class
=
"breadcrumb pl-0"
>
<li
class
=
"breadcrumb-item"
><a href=
""
>User Management</a></li>
<li
class
=
"breadcrumb-item active"
aria-current=
"page"
>User Detail</li>
</ol>
</div>
<div
class
=
"col-md-6"
>
<div
class
=
"invoice-buttons text-right"
>
<a href=
"#"
class
=
"btn btn-danger"
data-toggle=
"modal"
data-target=
"#warning-user"
>Report User</a>
</div>
</div>
</div>
</nav>
<div
class
=
"ms-panel"
>
<div
class
=
"ms-panel-header"
>
<div
class
=
"d-flex justify-content-between"
>
<div
class
=
"align-self-center align-left "
>
<h6>User Details</h6>
</div>
<div
class
=
"col-md-6"
>
<div
class
=
"invoice-buttons text-right"
>
<a href=
"player-stats.html"
class
=
"btn btn-dark mr-2"
>View Stats</a>
<a href=
"update-user.html"
class
=
"btn btn-info"
>Update Profile</a>
</div>
</div>
</div>
</div>
<div
class
=
"ms-panel-body"
>
<div
class
=
"row"
>
<div
class
=
"col-lg-3"
>
<div
class
=
"master-img"
>
<img src=
" @Html.DisplayFor(x => x.UserImage)"
alt=
"doctor-img"
>
</div>
</div>
<div
class
=
"col-lg-9"
>
<div
class
=
"detail-sec"
>
<div
class
=
"d-flex align-item-center justify-content-between"
>
<h5
class
=
"bold text-capitalize"
>William Rose</h5>
</div>
<ul
class
=
"Consultant-info"
>
@Html.HiddenFor(x => x.UserId)
<li><p>Instagram Username:</p> <span> @Html.DisplayFor(x => x.InstaUserName)</span></li>
<li><p>Date of Birth:</p> <span> @Html.DisplayFor(x => x.DOB)</span></li>
<li><p>Mobile no:</p><span> @Html.DisplayFor(x => x.MobileNumber) </span></li>
<li><p>Country:</p> <span> @Html.DisplayFor(x => x.Country)</span></li>
<li><p>Level of Baseball:</p> <span>@Html.DisplayFor(x => x.LevelBaseBall)</span></li>
<li><p>Zipcode:</p> <span>@Html.DisplayFor(x => x.ZipCode)</span></li>
<li><p>Address:</p><span>@Html.DisplayFor(x => x.ZipCode) </span></li>
</ul>
</div>
</div>
</div>
</div>
</div>
Please check this
Reply
Answers (
1
)
How to get current and last 10 financial years list
MVC Dropdownlist selected index changed event