16,022,798 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by ddgjgj (Top 45 by date)
ddgjgj
10-Jan-18 7:32am
View
yes.So the user is in the create view (to create an entity), he starts to fill the fields , he fills the ID field , he wrotes HAHAHA on it , i want now to create a readonly link inside the view that fills by itself like this : (on the fly ) :
<<1a 1href="h1ttp://localhost:49477/Contents/Details1/@Model.Id"> link<1/a>
and this Id is automatically filled with the text that user writes in the ID FIELD ,so if he types HAHAHA in the ID field , the link will be
<1a href="1http://l1ocalhost:49477/Contents/Details1/HAHAHA"> link<1/a>
ID is a string type , lets forget a little about validation , constratins and so on in mvc , i am just asking is this possible or not ?
ddgjgj
10-Jan-18 7:20am
View
Sir , lets be clear again , i am in the create view so i am about to create a new entity that does not exist and doesnt have already an ID , lets pretend the user is filling all the fields in the view ID TITLE and so on , i want that ON THE FLY to do that , if the user writes something in the ID Editor field ,ID is a string and lets say he wrote HAHAHA as ID , now i want to have that value to have that 'HAHAHA' and show in the view as readonly text ..so inside the create view @if (Html.EditorFor(model => model.Id) !=null){ SHOW what user wrote in ID field} , what i want is to create a link inside the view like this (on the fly ) : @Html.ActionLink("Details1", "Details1", new { id = Model.Id }) and this Id is automatically filled with the text that user writes in the ID FIELD , ID is a string , and let forget a little about validation , constratins and so on , is this possible or not ?thanks a lot
ddgjgj
10-Jan-18 7:06am
View
Sir , lets be clear again , i am in the create view so i am about to create a new entity that does not exist and doesnt have already an ID , lets pretend the user is filling all the fields in the view ID TITLE and so on , i want that ON THE FLY to do that , if the user writes something in the ID Editor field ,ID is a string and lets say he wrote HAHAHA as ID , now i want to have that value to have that 'HAHAHA' and show in the view as readonly text ..so inside the create view @if (Html.EditorFor(model => model.Id) !=null){ SHOW what user wrote in ID field}
ddgjgj
10-Jan-18 6:42am
View
Deleted
@if (Html.EditorFor(model => model.Id) !=null)
{
test
|
@Html.ActionLink("Details1", "Details1", new { id = Model.Id }) |
@Url.Action("Details1", new { Id = Model.Id }) |
test
}
ddgjgj
10-Jan-18 6:42am
View
Deleted
@if (Html.EditorFor(model => model.Id) !=null)
{
test
|
@Html.ActionLink("Details1", "Details1", new { id = Model.Id }) |
@Url.Action("Details1", new { Id = Model.Id }) |
test
}
ddgjgj
10-Jan-18 6:39am
View
?
ddgjgj
27-Dec-17 6:18am
View
HOLY GRAIL.THANKS MILION TIMES
ddgjgj
27-Dec-17 6:12am
View
Deleted
All database tables names and instead of that to concat create or read or update or delete like this, as one value :
student create
student delete
student update
student read
book create
book delete
book update
book read
author delete
author update
author read
author create
and so on..
ddgjgj
7-Nov-17 9:05am
View
thanks
ddgjgj
2-Nov-17 9:13am
View
no , i want in case of errors to show the alert2
ddgjgj
11-Sep-17 5:57am
View
i did ,but still same.
ddgjgj
11-Sep-17 5:06am
View
Im using partial views with different model class , and they are causing this error :
The model item passed into the dictionary is of type 'CMSFC.Models.Page', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[CMSFC.Models.PageConfig]'. RSS
ddgjgj
6-Sep-17 7:59am
View
U Genius , or somethin`. Thanks.
ddgjgj
6-Sep-17 5:24am
View
can you provide me any helping code about that ?
ddgjgj
5-Sep-17 3:01am
View
No its completely different.
ddgjgj
21-Aug-17 6:24am
View
This is the code:
@model IList<cmsfc.models.contenthtml>
@{var counter = 0; }
@foreach (var item in Model)
{
if (counter % 3 == 0)
{
@:
}
@counter++;
}
@Html.DisplayFor(modelItem => item.Id)
And thats the error:
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The foreach block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
Source Error:
Line 35: @{var counter = 0; }
Line 36:
Line 37: @foreach (var item in Model)
Line 38: {
Line 39:
Source File: /Views/ContentHtml/Tabelar.cshtml Line: 37
ddgjgj
21-Aug-17 5:48am
View
can you provide the full code
ddgjgj
21-Aug-17 4:55am
View
Not working
ddgjgj
21-Aug-17 4:49am
View
It says this :
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: ":" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.
Source Error:
Line 12: {
Line 13:
Line 14: @:
Line 15:
Line 16: }
ddgjgj
21-Aug-17 3:16am
View
Like how , can you provide the code here ?!How about my question ?!
ddgjgj
16-Aug-17 7:13am
View
GENIUS!
ddgjgj
16-Aug-17 6:56am
View
This the global.asax
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
//It's important to check whether session object is ready
if (HttpContext.Current.Session != null)
{
CultureInfo ci = (CultureInfo)this.Session["Culturee"];
//Checking first if there is no value in session
//and set default language
//this can happen for first user's request
if (ci == null)
{
//Sets default culture to english invariant
string langName = "en";
//Try to get values from Accept lang HTTP header
if (HttpContext.Current.Request.UserLanguages != null &&
HttpContext.Current.Request.UserLanguages.Length != 0)
{
//Gets accepted list
langName = HttpContext.Current.Request.UserLanguages[0].Substring(0, 2);
}
ci = new CultureInfo(langName);
this.Session["Culturee"] = ci;
}
//Finally setting culture for each request
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ci.Name);
}
}
And this is the controller :
public ActionResult ChangeCulturee(string lang, string returnUrl)
{
Session["Culturee"] = new CultureInfo(lang);
return Redirect(returnUrl);
}
What i should change here , exactly , where ?!
ddgjgj
16-Aug-17 6:47am
View
Yes , and save that value in session.
@Html.ActionLink("EN", "ChangeCulturee", "Language", new { lang = "en", returnUrl = this.Request.RawUrl }, null)
ddgjgj
7-Aug-17 7:28am
View
Sir , your a 10.
ddgjgj
7-Aug-17 4:30am
View
So this is the model class :
public int Id { get; set; }
public string Content { get; set; }
public string Ctl { get; set; }
public Nullable<system.datetime> PublishDate { get; set; }
public Nullable<system.datetime> ExpiryDate { get; set; }
public Nullable<int> Exclude { get; set; }
public string Title1 { get; set; }
public string Title2 { get; set; }
public string Title3 { get; set; }
public string Title4 { get; set; }
public string Title5 { get; set; }
[AllowHtml]
public string ShortDescription1 { get; set; }
[AllowHtml]
public string ShortDescription2 { get; set; }
[AllowHtml]
public string ShortDescription3 { get; set; }
[AllowHtml]
public string ShortDescription4 { get; set; }
[AllowHtml]
public string ShortDescription5 { get; set; }
[AllowHtml]
public string LongDescription1 { get; set; }
[AllowHtml]
public string LongDescription2 { get; set; }
[AllowHtml]
public string LongDescription3 { get; set; }
[AllowHtml]
public string LongDescription4 { get; set; }
[AllowHtml]
public string LongDescription5 { get; set; }
public Nullable<system.datetime> InsertDate { get; set; }
public string InsertBy { get; set; }
public int OrderBy { get; set; }
I want to make such a cms that when i press English , it shows me the news from database in English , i want to support 5 languages , thats why i created 5 titles fields , 5 long and short descriptioons and so on..
ddgjgj
4-Aug-17 3:29am
View
So , the code is above. That is my Create View in MVC. What i want is , to have ckeditor for field LongDescription1 , so if i type there SAMPLE TEXT and if I do some html formatting there , example
SAMPLE TEXT
, it should save the value SAMPLE TEXT in bold , in the field LongDescription1. And at the Edit view , if i try to edit that text , if should show me the exact formatted text , and not like in my case , example :
ITALIC
, i want just to show ITALIC in italic style in editor , and then try to edit that text .And in the index page , it should me show the exast formatted text how i saved it . First of all , should i add [AllowHtml]
in this field public string LongDescription1 { get; set; } .I would be thankful for any help.
ddgjgj
4-Aug-17 3:29am
View
So , the code is above. That is my Create View in MVC. What i want is , to have ckeditor for field LongDescription1 , so if i type there SAMPLE TEXT and if I do some html formatting there , example
SAMPLE TEXT
, it should save the value SAMPLE TEXT in bold , in the field LongDescription1. And at the Edit view , if i try to edit that text , if should show me the exact formatted text , and not like in my case , example :
ITALIC
, i want just to show ITALIC in italic style in editor , and then try to edit that text .And in the index page , it should me show the exast formatted text how i saved it . First of all , should i add [AllowHtml]
in this field public string LongDescription1 { get; set; } .I would be thankful for any help.
ddgjgj
22-Jun-17 3:35am
View
wow.
ddgjgj
30-May-17 9:02am
View
Now when i write this :
I can only view my 3 jpeg uploaded pictures , and not the others from database (image datatypes).
ddgjgj
30-May-17 2:55am
View
Sir , this cant be a stupid question , because i can see Northwind Employee's pictures which i read from database , i can not only see me uploaded pictures , which i upload at save and edit functions.
ddgjgj
26-May-17 6:58am
View
is it ok:
Employee employee = db.Employees.Include(player => player.Orders).Where(i => i.EmployeeID == id).SingleOrDefault();
ddgjgj
26-May-17 5:01am
View
at the Employee class , delete this
this.Customers = new HashSet<customer>(); and this
public virtual ICollection<customer> Customers { get; set; } , because these dont exist , i just added this for test , but its not right this way. And also at customer class delete these :
public int EmployeeID { get; set; } and
public virtual Employee Employee { get; set; } , they dont exist in database too.
ddgjgj
26-May-17 4:41am
View
namespace Northwind.Controllers
{
public class EmployeesController : Controller
{
private dbNorthwindEntities db = new dbNorthwindEntities();
// GET: Employees
public ActionResult Index()
{
var employees = db.Employees;
// var employees = db.Employees.Include(e => e.Employee1).Include(e => e.Employees1);
// var employees = db.Employees.Include(e => e.Employees1);
// var employees = db.Employees.Include(e => e.Employee1);
return View(employees.ToList());
}
// GET: Employees/Details/5
public ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Employee employee = db.Employees.Find(id);
if (employee == null)
{
return HttpNotFound();
}
return View(employee);
}
ddgjgj
26-May-17 4:23am
View
TO BE EVERYTHING CLEAR , I JUST POSTED A NEW QUESTION HERE :
https://www.codeproject.com/Questions/1189186/Many-to-many-relationship-in-MVC-view
ddgjgj
26-May-17 4:23am
View
TO BE EVERYTHING CLEAR , I JUST POSTED A NEW QUESTION HERE :
https://www.codeproject.com/Questions/1189186/Many-to-many-relationship-in-MVC-view
ddgjgj
25-May-17 10:51am
View
Sir , but is displays the list of customers in this way too, for every employee , what do you think , is it not OK this way ?
where to insert now this query in the controller ?
// GET: Employees/Details/5
public ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Employee employee = db.Employees.Find(id);
if (employee == null)
{
return HttpNotFound();
}
return View(employee);
}
ddgjgj
25-May-17 4:17am
View
Thank you so much Mr.Genius ! I really really appriciate every response you wrote .
ddgjgj
23-May-17 17:36pm
View
First, we assume the every Order has a Customer, so if an Employee has an Order, he must also have a Customer. So, we can forget about the Customer Table. We really just want to know, Which Employees have Orders. For that, we look at the Orders and gather a list of Employees that own them:
(from o in Orders
select o.Employee).Distinct()
So this is a part of how view looks like:
@model Northwind.Employees
@{
ViewBag.Title = "Me";
Layout = "~/Views/Shared/MasterDetailsLayoutPage.cshtml";
}
@Html.DisplayNameFor(model => model.EmployeeID)
@Html.DisplayFor(model => model.EmployeeID)
........AND SOME OTHER EMPLOYEES FIELD....
THEN HERE display a table:
foreach(item in Model.Customers)
.....display a table of customers for this employee(example EMPLOYEEID:5 ).
And this is the controller :
dbNorthwindEntities db = new dbNorthwindEntities();
// GET: Test
/* public ActionResult Details()
{
//query comes here
return View();
}*/
Can you correct me or help me with that now . I really really appriciate your explanation above , I was like 'WOW' !
ddgjgj
16-May-17 16:26pm
View
Deleted
I'll try it tomorow , thanks for the help.
ddgjgj
16-May-17 16:24pm
View
Ill try it tomorow , thanks for this help.
ddgjgj
16-May-17 16:08pm
View
I really don't know how.
ddgjgj
15-May-17 8:46am
View
Deleted
This is the view :
td.details-control {
background: url('/Content/images/details_open.png') no-repeat center center;
width:40px;
height:5px;
cursor: pointer;
}
tr.details td.details-control {
background: url('/Content/images/details_close.png') no-repeat center center;
width:40px;
height:5px;
}
Order IDCustomer IDContactNameEmployee IDOrder DateRequired DateShip ViaFreightShip nameShip AddressShip CityShip RegionShip PostalShip CountryOrder IDCustomer IDContactNameEmployee IDOrder DateRequired DateShip ViaFreightShip nameShip AddressShip CityShip RegionShip PostalShip Country
function format(d) {
return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
'<tr>' +
'<td>PRODUCT ID :</td>' +
'<td>' + d.ProductID + '</td>' +
'</tr>' +
'<tr>' +
'<td>PRODUCT NAME :</td>' +
'<td>' + d.ProductName + '</td>' +
'</tr>' +
'<tr>' +
'<td>UNIT :</td>' +
'<td>' + d.UnitPrice + '</td>' +
'</tr>' +
'<tr>' +
'<td>Quantity :</td>' +
'<td>' + d.Quantity + '</td>' +
'</tr>' +
'<tr>' +
'<td>Discount :</td>' +
'<td>' + d.Discount + '</td>' +
'</tr>' +
'</table>';
}
/* function format(d)
{
var jqxhr = $.getJSON("/Test/GetData1", function (jsonResult)
{
ParseJson(jsonResult);
})
function ParseJson(response)
{
var html = "";
for (var i = 0; i < response.length; i++)
{
html += "<tr>";
html += "<td>" + response[i].ProductID + "</td>";
html += "<td>" + response[i].ProductName + "</td>";
html += "<td>" + response[i].UnitPrice + "</td>";
html += "<td>" + response[i].Quantity + "</td>";
html += "<td>" + response[i].Discount + "</td>";
html += "</tr>";
}
$(document).find("#entrydata").html(html);
}
return '<table id = "entrydata" cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
'</table>';
*/
$(document).ready(function () {
var dt = $('#example').DataTable({
"ajax": {
"url": "/Test/GetData",
"type": "GET",
"dataSrc": "",
"method": "GET",
"dataType": "json",
" destroy": true
},
"columns":
[
{
"class": "details-control",
"orderable": false,
"data": null,
ddgjgj
15-May-17 8:07am
View
var jqxhr = $.getJSON("/Test/GetData" returns JSON like :
[
{
"OrderID": 10248,
"CustomerID": "VINET",
"ContactName": "Paul Henriot",
"EmployeeID": 5,
"OrderDate": "/Date(836431200000)/",
"RequiredDate": "/Date(838850400000)/",
"ShippedDate": "/Date(837468000000)/",
"ShipVia": 3,
"Freight": 32.38,
"ShipName": "Vins et alcools Chevalier",
"ShipAddress": "59 rue de l'Abbaye",
"ShipCity": "Reims",
"ShipRegion": null,
"ShipPostalCode": "51100",
"ShipCountry": "France",
"ProductID": 11,
"ProductName": "Queso Cabrales",
"UnitPrice": 14,
"Quantity": 12,
"Discount": 0},
{
"OrderID": 10248,
"CustomerID": "VINET",
"ContactName": "Paul Henriot",
"EmployeeID": 5,..............................and so on
Postman is a CHROME tool to test API .
So the loop should display the product details only to a certain ORDER ID .
ddgjgj
15-May-17 8:07am
View
var jqxhr = $.getJSON("/Test/GetData" returns JSON like :
[
{
"OrderID": 10248,
"CustomerID": "VINET",
"ContactName": "Paul Henriot",
"EmployeeID": 5,
"OrderDate": "/Date(836431200000)/",
"RequiredDate": "/Date(838850400000)/",
"ShippedDate": "/Date(837468000000)/",
"ShipVia": 3,
"Freight": 32.38,
"ShipName": "Vins et alcools Chevalier",
"ShipAddress": "59 rue de l'Abbaye",
"ShipCity": "Reims",
"ShipRegion": null,
"ShipPostalCode": "51100",
"ShipCountry": "France",
"ProductID": 11,
"ProductName": "Queso Cabrales",
"UnitPrice": 14,
"Quantity": 12,
"Discount": 0},
{
"OrderID": 10248,
"CustomerID": "VINET",
"ContactName": "Paul Henriot",
"EmployeeID": 5,..............................and so on
Postman is a CHROME tool to test API .
So the loop should display the product details only to a certain ORDER ID .
ddgjgj
12-May-17 7:35am
View
Now with this code , when i click to every row , it shows all database order details , i mean hundread lines .. Im trying something like this (based on ORDER ID) but doesnt work :
function format(d) {
var jqxhr = $.getJSON("/Test/GetData", function (jsonResult) {
ParseJson(jsonResult);
})
function ParseJson(response) {
var html = "";
for (var i = 0; i < response.length; i++)
{
for (var j = 0; i <= response[i].OrderID; j++)
{
html += ""
html += "" + response[j].ProductID + "";
html += "" + response[j].ProductName + "";
html += "" + response[j].UnitPrice + "";
html += "" + response[j].Quantity + "";
html += "" + response[j].Discount + "";
///other td
html += ""
}
}
$(document).find("#entrydata").html(html);
}
Show More