As you can see in the picture below I have a form for adding notes and a form for editing notes on my page. What I want to do is: When I click edit button ("Düzenle" in my page), I want to open the window on the right as a pop-up.
The part codes on the left side of the picture ProjeListPartial.cshtml:
#model List<tbl_Not>
#if (Model.Any())
{
<div class="col-md-12 col-sm-12">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption caption-md">
<i class="icon-bar-chart font-dark hide"></i>
<span class="caption-subject font-dark bold uppercase"><a>Proje Notları Toplam: #Model.Count() </a></span>
</div>
</div>
<div class="portlet-body">
<div class="scroller" style="height: 338px;" data-always-visible="1" data-rail-visible1="0" data-handle-color="#D7DCE2">
<div class="general-item-list">
#foreach (var item in Model)
{
<div class="item">
<div class="item-head">
<div class="item-details">
<a class="item-name primary-link">#item.Adi</a>
<br />
#if (Fonksiyonlar.KulYetSvys((int)Sabitler.YtkSeviyesi.TamYetki))
{
<span class="item-label">#item.tbl_Kullanici.Adi</span>
}
<span class="item-label">#item.EklenmeTarihi.ToString("dd.MM.yyy")</span>
#if (Fonksiyonlar.KulYetSvys((int)Sabitler.YtkSeviyesi.BirimTamYetki) || Fonksiyonlar.KulYetSvys((int)Sabitler.YtkSeviyesi.TamYetki))
{
<span class="item-status">
<!-- This is my edit code -->
Düzenle
<!-- -->
Sil
</span>
}
</div>
</div>
<div class="item-body"> #item.Icerik </div>
</div>
}
</div>
</div>
</div>
</div>
</div>
<div class="row" style="margin-left: 0px;">
<div class="col-md-12">
<div class="dataTables_paginate paging_bootstrap_number hidden-print" id="sample_3_paginate">
<ul class="pagination" style="visibility: visible;">
#Html.Raw(ViewBag.Sayfalama)
</ul>
</div>
</div>
</div>
}
else
{
<h3>Not Bulunmamaktadır.</h3>
}
The part codes on the right side of the picture Ekle.cshtml:
#model tbl_Not
#{
ViewBag.Title = "Not";
bool IsProjeNotu = Model.ProjeID > 0 ? true : false;
if (IsProjeNotu)
{
Layout = null;
}
}
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-file-o"></i>Not Ekle/Düzenle
</div>
<div class="tools">
</div>
</div>
<div class="portlet-body #(IsProjeNotu?"portlet-collapsed":"")">
<form method="post" role="form" action="#Url.Action("Ekle", "Not", new { ProjeID = Model.ProjeID, BirimID = Model.BirimID, IsProjeNotu = IsProjeNotu })">
<input type="hidden" name="ID" value="#Model.ID" />
<div class="form-body">
#if (!IsProjeNotu)
{
<div class="col-lg-6 formbox pl">
<span>Birim Adı:</span>
<select name="BirimID" id="Birim" class="form-control">
#Html.Raw(ViewBag.Birim)
</select>
</div>
<div class="col-lg-6 pl pr formbox" onchange="return IlGetir();">
<span>Proje Adı:</span>
<select name="ProjeID" id="Projeler" class="form-control"></select>
</div>
}
<div class="col-md-6 pl formbox">
<span>İl/İller:</span>
<select multiple id="Iller" class="form-control">
#foreach (tbl_Il item in ViewBag.Iller)
{
<option value="#item.ID">#item.Adi</option>
}
</select>
<button id="SolaYolla" type="button" class="btn blue btn-sm" data-style="slide-up" data-spinner-color="#333">
<i class="fa fa-plus"></i> Ekle
</button>
</div>
<div class="col-md-6 formbox pr">
<span>İl Çıkar</span>
<select multiple id="SecilenIller" name="IlID" class="form-control">
#foreach (tbl_NotIlIliski item in Model.tbl_NotIlIliski.ToList())
{
<option value="#item.IlID">#item.tbl_Il.Adi</option>
}
</select>
<button id="SagaYolla" type="button" class="btn blue btn-sm" data-style="slide-up" data-spinner-color="#333">
<i class="fa fa-close"></i> Çıkar
</button>
</div>
<div class="col-md-12 formbox pr pl">
<span>Başlık:</span>
<input type="text" maxlength="250" class="form-control" style="width: 230px;" value="#Model.Adi" name="Adi" />
</div>
<div class="col-md-12 formbox pr pl">
<span>İçerik:</span>
<textarea class="mceEditor" style="width: 230px;" name="Icerik">#Model.Icerik</textarea>
</div>
</div>
<div class="col-md-12 formbox pr pl">
<span>Not Durumu:</span>
#foreach (var item in Sabitler.NotDurum)
{
<label class="mt-radio mt-radio-outline" style="margin-left: 15px;">
#item.Adi
<input #( Model.DurumID == 0 ? (item.ID == 1 ? "checked='checked'" : "") : (item.ID == Model.DurumID ? "checked='checked'" : "") ) type="radio" value="#item.ID" name="DurumID" />
<span></span>
</label>
}
</div>
<input type="submit" class="btn blue" id="Kaydet" onclick="$('#SecilenIller option').prop('selected', true);" value="Kaydet" />
</form>
</div>
When I click edit button (Düzenle), this is how a screen comes out:
Related
I tray use ViewComponent in Razor Page with condition,
and each Viewcomponents are separate,
My razorpage is "/Subfolder/Index.cshtml"
<div class="row">
<div class="col-md-4">
#await Component.InvokeAsync("RightMenu")
</div>
<div class="col-md-8">
#if (Model.SIndex != 0)
{
#await Component.InvokeAsync("SubContent", new { id = Model.SIndex })
}
#if (Model.SIndex == 15)
{
<div class="row">
<div class="col-md-12">
<form method="post">
#await Component.InvokeAsync("QuestionUs", new { askLibrarian = new Lib.Model.AskLibrarian() })
<div class="form-group">
<input type="submit" value="ask Question" class="btn btn-default" asp-page-handler="question" />
</div>
</form>
</div>
</div>
}
</div>
and code behind of this is "/subfolder/index.cshtml.cs"
public class IndexModel : PageModel
{
private readonly Lib.Model.LibContext _context;
[BindProperty]
public int SIndex { get; set; }
public async Task OnGet(int Id)
{
SIndex = Id;
}
[BindProperty]
public AskLibrarian AskLibrarian { get; set; }
public async Task<IActionResult> OnPostquestionAsync()
{
if (!ModelState.IsValid)
{
return Page();
}
_context.AskLibrarians.Add(AskLibrarian);
await _context.SaveChangesAsync();
return RedirectToPage("./Index");
}
}
Now "questionViewcomponent" is a simple form that show many input elements
in "/subfolder/component/questionus/default.cshtml"
#model Lib.Model.AskLibrarian
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-row">
<div class="form-group col-md-6">
<label asp-for="FullName" class="control-label"></label>
<div class="input-group mb-2 mr-sm-2">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fas fa-user"></i></div>
</div>
<input asp-for="FullName" class="form-control" />
<span asp-validation-for="FullName" class="text-danger"></span>
</div>
</div>
<div class="form-group col-md-6">
<label asp-for="Email" class="control-label"></label>
<div class="input-group mb-2 mr-sm-2">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fas fa-envelope"></i></div>
</div>
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label asp-for="LibraryNameId" class="control-label"></label>
<div class="input-group mb-2 mr-sm-2">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fas fa-book"></i></div>
</div>
<select asp-for="LibraryNameId" class="form-control" asp-items="ViewBag.LibraryNameId"></select>
</div>
</div>
<div class="form-group col-md-8">
<label asp-for="Subject" class="control-label"></label>
<div class="input-group mb-2 mr-sm-2">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fas fa-book-reader"></i></div>
</div>
<input asp-for="Subject" class="form-control" />
<span asp-validation-for="Subject" class="text-danger"></span>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Text" class="control-label"></label>
<textarea asp-for="Text" class="form-control" style="min-height:250px;"></textarea>
<span asp-validation-for="Text" class="text-danger"></span>
</div>
set breakpoint on "OnpostQuestionAsync", When I click on submit button with "question" handler do nothing and show me a blank page instead question form.
how can I resolve That
After a long Time my problem resolved by remove
<input type="submit" value="ask Question" class="btn btn-default" asp-page-handler="question" />
and add in form tag
<form method="post" sp-page-handler="question">
I am strugling with Bootstrap 3 grid system.
Let me explain what I have implemented, what I need and what I did (fail attempt) to achieve.
This is the Layout (HTML | Razor) of the image. For you to have a live version of this This is the site link to this screen so you can see it and play.
<div class="row">
<div class="col-xs-12 col-md-6 nopadding">
<div id="showcaseSection" class="showcaseSection superVideo">
<ul class="media-list" id="showcaseMedia" itemscope itemtype="http://schema.org/UserComments"></ul>
</div>
<div class="hidden-xs">
<div class="col-xs-6 nopadding">
<p class="text-center no-margin" style="margin-top: 15px;">
<span>Equipo: #Model.Team1Name (<span id="team1Total">0</span>)</span>
</p>
<ul class="media-list team1ListShowCase" id="#Model.Team1Id" data-img="#Url.Action("GetLinkToImageTeam", "Home", new {Id = Model.Team1Id})" data-media="media-left" data-team="#Model.Team1Name" data-class="team1"></ul>
</div>
<div class="col-xs-6 nopadding">
<p class="text-center no-margin" style="margin-top: 15px;">
<span>Equipo: #Model.Team2Name (<span id="team2Total">0</span>)</span>
</p>
<ul class="media-list team2ListShowCase" id="#Model.Team2Id" data-img="#Url.Action("GetLinkToImageTeam", "Home", new {Id = Model.Team2Id})" data-media="media-right" data-team="#Model.Team2Name" data-class="team2"></ul>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="col-xs-12 col-md-6 nopadding">
<div id="chatcontainer">
<ul class="media-list" id="chatbody" itemscope itemtype="http://schema.org/UserComments"></ul>
<div id="chatOptions" class="collapse">
<p class="text-center">#Model.Title</p>
<button id="exitroom" class="btn btn-danger" title="Salir" disabled="disabled">
<span class="glyphicon glyphicon-log-out"></span> #Resources.Salir
</button>
<span>
<input type="checkbox" id="isAutoscroll" name="my-checkbox" checked>
<label>Actualizar Mensajes</label>
</span>
</div>
</div>
#if (!Model.IsReadOnly)
{
<div class="input-group">
<input type="hidden" style="display: none" class="form-control" aria-required="false" readonly id="inresponseto">
<textarea type="text" rows="2" class="form-control" required="required" aria-required="true" maxlength="500" placeholder="Comentario..." disabled="disabled" id="responseText"></textarea>
<input type="text" class="form-control" style="height: 25px;" aria-required="false" readonly id="inresponsetomessage">
<span class="input-group-btn">
<button id="sendresponse" type="button" title="Enviar" class="btn btn-primary" disabled="disabled">
<span class="glyphicon glyphicon-send"></span>
</button>
<button class="btn btn-info" data-toggle="collapse" title="Opciones" data-target="#chatOptions">
<span class="fa fa-cogs"></span>
</button>
</span>
</div>
}
</div>
</div>
As you can see everything is in one row.
I want to have the Video Section fixed on top and the TEXT AREA to comment fixed BOTTOM when on XS (viewports).
I tried adding this to the row, but I fix the video but I cannot see the TEXT AREA
.fixed2 {
position: fixed;
z-index: 10;
width: 100%;}
I don't know what else to do to show fixed top (video) and botton fixed (Chat Textbox) and scrollable comments in the middle when in XS.
Any help is welcome.
Override the height for #chatcontainer for tablet/mobile will fix the issue. Example:
#media(max-width: 767px) {
#chatcontainer{
height: calc(50vh - 80px);
}
}
So I manage to solve the original problem by updating the package but here is what follows, a dark background with dark font color
Below is the codes for the view
<div *ngSwitchCase="'Basic'">
<md-card>
<md-card-content>
<h4>Basic Institution Subscription Page</h4>
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">Your School or Institution Profile</div>
<div class="panel-body">
<md-card>
<md-card-content>
<div class="row" style="padding-left:10px;padding-bottom:10px;padding-top:20px">
<div class="col-md-6">
<img md-card-md-image [src]="'data:image/jpg;base64,' + institution.Crest" class="crest_image" style="margin-bottom:5px;margin-left:10px" />
<h6>Select Institution Crest</h6>
<input #crest type="file" (change)="crestChangeListner($event)" style="margin-left:20px" />
</div>
<div class="col-md-6">
<img md-card-md-image [src]="'data:image/jpg;base64,' + institution.BackGroundPicture" class="bgpic_image" style="margin-bottom:5px;margin-left:10px" />
<h6 *ngIf="!institution.BackGroundPicture">Select Background Image</h6>
<input #bgpic type="file" (change)="bgpicChangeListner($event)" style="margin-left:20px" />
</div>
</div>
<div class="row">
<div class="col-md-6">
<md-radio-group [(ngModel)]="institution.OwnershipCategory"
(change)="OwnershipCategorySelected($event.value)" name="ownershipCategory" class="example-margin"
[value]="institution.OwnershipCategory"
[align]="isAlignEnd ? 'end' : 'start'">
<md-radio-button class="icon-align-vertical" name="ownershipCategory" value="Public">
Public
</md-radio-button>
<md-radio-button class="icon-align-vertical" name="ownershipCategory" value="Private">
Private
</md-radio-button>
</md-radio-group>
</div>
</div>
<div class="row">
<div class="col-md-6">
<md-select placeholder="Select Country" style="width: 100%"
id="countryID" name="countryID" class="required"
[(ngModel)]="institution.Country"
(ngModelChange)="countrySelected()">
<md-option *ngFor="let country of countries" [value]="country.CountryID">
{{ country.CountryName }}
</md-option>
</md-select>
</div>
<div class="col-md-6">
<md-select placeholder="Select Office" style="width: 100%"
id="officeID" name="officeID" class="required"
[(ngModel)]="institution.OfficeID"
(ngModelChange)="officeSelected()">
<md-option *ngFor="let office of offices" [value]="office.AdministrativeStructureID">
{{ office.AdminStructName }}
</md-option>
</md-select>
</div>
</div>
<div class="row" *ngIf="offices">
</div>
<div class="row">
<div class="col-md-6">
<md-input-container style="width:100%">
<input mdInput name="InstitutionID" placeholder="Enter Institution ID"
[(ngModel)]="institution.InstitutionID" required id="InstitutionID" style="width: 100%"
#InstitutionID="ngModel">
<div [hidden]="InstitutionID.valid || InstitutionID.pristine"
class="alert alert-danger">
Institution ID is required
</div>
</md-input-container>
</div>
<div class="col-md-6">
<md-input-container style="width:100%">
<input mdInput placeholder="Enter Institution Name"
[(ngModel)]="institution.InstitutionName" name="InstitutionName" id="InstitutionName" required style="width: 100%"
#InstitutionName="ngModel">
<div [hidden]="InstitutionName.valid || InstitutionName.pristine"
class="alert alert-danger">
Institution Name is required
</div>
</md-input-container>
</div>
</div>
<div class="row">
<div class="col-md-6">
<md-input-container style="width:100%">
<input mdInput name="Website" placeholder="Enter Website Address"
[(ngModel)]="institution.Website" required id="Website" style="width: 100%"
#Website="ngModel">
<div [hidden]="Website.valid || Website.pristine"
class="alert alert-danger">
Website is required
</div>
</md-input-container>
</div>
<div class="col-md-6">
<md-input-container style="width:100%">
<input mdInput placeholder="Enter Email Address"
[(ngModel)]="institution.EmailAddress" name="EmailAddress" id="EmailAddress" required style="width: 100%"
#EmailAddress="ngModel">
<div [hidden]="EmailAddress.valid || EmailAddress.pristine"
class="alert alert-danger">
Email Address is required
</div>
</md-input-container>
</div>
</div>
<div class="row">
<div class="col-md-6">
<md-input-container style="width:100%">
<input mdInput name="PostalAddress" placeholder="Enter Postal Address"
[(ngModel)]="institution.PostalAddress" required id="PostalAddress" style="width: 100%"
#PostalAddress="ngModel">
<div [hidden]="PostalAddress.valid || PostalAddress.pristine"
class="alert alert-danger">
Postal Address is required
</div>
</md-input-container>
</div>
<div class="col-md-6">
<md-input-container style="width:100%">
<input mdInput placeholder="Enter Residential Address"
[(ngModel)]="institution.ResidentialAddress" name="ResidentialAddress" id="ResidentialAddress" required style="width: 100%"
#ResidentialAddress="ngModel">
<div [hidden]="ResidentialAddress.valid || ResidentialAddress.pristine"
class="alert alert-danger">
Residential Address is required
</div>
</md-input-container>
</div>
</div>
<div class="row">
<div class="col-md-6">
<md-input-container style="width:100%">
<input mdInput name="Phone1" placeholder="Enter Phone1"
[(ngModel)]="institution.Phone1" required id="Phone #1" style="width: 100%"
#Phone1="ngModel">
<div [hidden]="Phone1.valid || Phone1.pristine"
class="alert alert-danger">
Phone1 is required
</div>
</md-input-container>
</div>
<div class="col-md-6">
<md-input-container style="width:100%">
<input mdInput placeholder="Enter Phone2"
[(ngModel)]="institution.Phone2" name="Phone2" id="Phone #2" required style="width: 100%"
#Phone2="ngModel">
<div [hidden]="Phone2.valid || Phone2.pristine"
class="alert alert-danger">
Phone2 is required
</div>
</md-input-container>
</div>
</div>
<div class="row">
<div class="col-md-6">
<md2-datepicker
style="width:100%"
class="md-input-element"
placeholder="Select Date Founded"
name="DateFounded"
(ngModel)="institution.DateFounded"
[required]="isRequired"
[disabled]="isDisabled"
[openOnFocus]="isOpenOnFocus"
[isOpen]="isOpen"
[type]="type"
[min]="minDate"
[max]="maxDate">
</md2-datepicker>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-4"><h6>Select Institution Catgory</h6></div>
<div class="col-md-8">
<md-radio-group [(ngModel)]="institution.SchoolCategory"
(change)="SchoolCategorySelected($event.value)" name="schoolCategory" class="example-margin"
[value]="institution.SchoolCategory"
[align]="isAlignEnd ? 'end' : 'start'">
<md-radio-button class="icon-align-vertical" name="schoolCategory" value="A">
A
</md-radio-button>
<md-radio-button class="icon-align-vertical" name="schoolCategory" value="B">
B
</md-radio-button>
<md-radio-button class="icon-align-vertical" name="schoolCategory" value="C">
C
</md-radio-button>
<md-radio-button class="icon-align-vertical" name="schoolCategory" value="D">
D
</md-radio-button>
<md-radio-button class="icon-align-vertical" name="schoolCategory" value="E">
E
</md-radio-button>
<md-radio-button class="icon-align-vertical" name="schoolCategory" value="F">
F
</md-radio-button>
</md-radio-group>
</div>
</div>
</div>
</div>
</md-card-content>
</md-card>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Shool Ownership In formation</div>
<div class="panel-body">
<md-card>
<md-card-content>
<div class="row">
<md-select placeholder="Select Owner Type" style="width: 100%"
id="ownershipTye" name="ownershipType" class="required"
[(ngModel)]="ownershipType"
(ngModelChange)="ownershipTypeSelected()">
<md-option *ngFor="let option of ownershipTypes" [value]="option">
{{ option }}
</md-option>
</md-select>
</div>
<div class="row">
<md-input-container style="width:100%">
<input mdInput name="fullName" placeholder="Enter Full Name"
[(ngModel)]="ownership.FullName" required id="fullName" style="width: 100%"
#fullName="ngModel">
<div [hidden]="fullName.valid || fullName.pristine"
class="alert alert-danger">
fullName is required
</div>
</md-input-container>
</div>
<div class="row">
<ul class="list-group">
<li class="list-group-item" *ngFor="let owner of ownerships">
<span class="badge">{{owner.FullName}}</span>
<md-checkbox name="ownerName"
(change)="fullNameSelected(owner)"
[(ngModel)]="owner.Selected">
{{owner.OwnershipTye}}
</md-checkbox>
</li>
</ul>
</div>
</md-card-content>
</md-card>
</div>
<div class="panel-footer">
<div class="row">
<div class="col-md-6">
<button md-raised-button color="primary" type="button" (click)="AddOwner()">Add Owner</button>
</div>
<div class="col-md-6">
<span class="pull-right">
<button md-raised-button color="primary" type="button" (click)="removeOwner()">Remove Owner</button>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</md-card-content>
</md-card>
</div>
and this part of the code for the component
isRequired = false;
isDisabled = false;
isOpenOnFocus = false;
isOpen = false;
type: string = 'date';
types: Array<any> = [
{ text: 'Date', value: 'date' },
{ text: 'Time', value: 'time' },
{ text: 'Date Time', value: 'datetime' }];
openDatepicker() {
this.isOpen = true;
setTimeout(() => {
this.isOpen = false;
}, 1000);
}
//startDate: Date = null;
setDate() {
this.institution.DateFounded = new Date();
}
minDate: Date = null;
maxDate: Date = null;
setDateRange() {
this.minDate = new Date();
this.minDate.setMonth(this.minDate.getMonth() - 3);
this.maxDate = new Date();
this.maxDate.setMonth(this.maxDate.getMonth() + 3);
}
This question already has answers here:
What is a NullReferenceException, and how do I fix it?
(27 answers)
Closed 6 years ago.
Below is my partial view call:
<div id="div-reviewgrid">
#Html.Partial("_ReviewList", ViewBag.RewiewLists as List<Pollit.Data.Review>)
</div>
this is my partial view inside shared folder under Partial:
#using Pollit.Data;
#{
List<Review> reviewList = ViewBag.RewiewLists;
}
<br /><br />
#if (reviewList != null)
{
foreach (var review in reviewList)
{
<div class="col-lg-12">
<div id="#review.Id">
<div class="col-lg-1 col-md-1 col-xs-12 col-sm-12">
#if (review.Rating != null)
{
<img src="/images/ratings/#review.Rating.Number-bars.png" class="pull-left" style="max-height: 50px; max-width: 50px; margin-left: 30px" />
}
</div>
<div class="col-lg-11 col-md-11 col-xs-12 col-sm-12">
<span>#review.Creator.Name #String.Format("{0:d}", review.Created)</span>
<br />
<h4 class="custum-memphisfontmediumitalic ">#review.Content</h4>
#*<input type="submit" value="Like" class="btn btn-info" />
<input type="submit" id="click" value="Comment" class="btn btn-info" />
<input type="text" id="comment" placeholder="Enter your comment" class="form-control" />*#
</div>
</div>
<br />
#if (Request.IsAuthenticated == true)
{
if (review.Replys != null)
{
foreach (var reply in review.Replys.OrderBy(c => c.Created))
{
<div id="reply_#reply.ReplyID" class="col-lg-8 col-md-10 col-xs-12 col-sm-12 col-lg-offset-1 ">
<span>Reply By:#reply.Creator.Name #String.Format("{0:d}", #reply.Created)</span>
<br />
<h4 class="custum-memphisfontmediumitalic">#reply.ReplyContent</h4>
</div>
}
}
<div class="col-lg-8 col-md-10 col-xs-12 col-sm-12 col-lg-offset-1 form-group ">
<input type="text" id="txtReply_#review.Id" placeholder="Enter your reply" class="form-control" />
</div>
<div class="col-lg-2 form-group"><div class="demo">
Reply
<img src="/Images/Comment rate up.png" class="img-responsive" width="40px" ><img src="/Images/Comment rate down.png" class="img-responsive" width="40px" ></div>
</div>
}
</div>
}
}
<br /><br />
Above is my partial view code so guys let me know if I am doing something wrong. Please help me. Thanks in advance for help
when you are calling your partial view the way you have written its wrong. each time you call it the new model is generating and your model goes empty`
#Html.Partial("_ReviewList", ViewBag.RewiewLists as List<Pollit.Data.Review>)
write Model instead of ViewBag.RewiewLists as List<Pollit.Data.Review>
I'm running ReactJS.NET with ASP.NET MVC, and everything renders well, except... i cannot get any kind of events to fire...
What i have tried :
1) Eliminating all JQuery references/usages - no success
2) onHover, onClick, with functions both inside and outside of the React-component - no success
Here is my code :
Attaching ProductLine React component in index.cshtml
#Html.React("ProductLine", Model)
React component
function addToCart() {
alert("Hoohohoho!!!");
};
var ProductLine = React.createClass({
render: function () {
return(
<div className="col-md-12 col-sm-12 col-xs-12" key={this.props.productData.name}>
<button onClick={this.addToCart}>Click me!</button>
<div className="row" >
<div onClick={addToCart} className="col-md-12 col-sm-12 col-xs-12 nopadding row-default" >
<div className="col-md-3 col-sm-5 col-xs-5 nopadding">
<span className="table table-col ">
<input type="checkbox" id="cbxCheck2" className="jq_select_product" />
<label htmlFor="cbxCheck2" className="jq_select_product">{ this.props.productData.name }</label>
</span>
</div>
<div className="col-md-4 hidden-sm hidden-xs nopadding">
<span className="table table-col table-text-small">
{ this.props.productData.label }
</span>
</div>
<div className="col-md-3 col-sm-4 col-xs-4 nopadding">
<span className="table table-col">
849,- (12 mnd)
</span>
</div>
<div className="col-md-2 col-sm-3 col-xs-3 nopadding">
<span className="table table-col table-text-small text-right">
<img id="imgShowMore" src="../../Images/arrow_purple_down.png" className="show-more _icon jq_expand_listview" /><label className="show-more _lbl jq_expand_listview">Vis mer</label>
</span>
</div>
</div>
<ProductDetails productData={this.props.productData} />
</div>
</div>
);
},
addToCart: function (e) {
alert("Hooooo!!!");
},
});
After 1/2 a day of trial and error, i suddenly tried to put all the JSX file references at the bottom of the _Layout.cshtml page...
That solved it all actually...