16,004,647 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 Javascript questions
View Visual Basic 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 Member 10435696 (Top 63 by date)
Member 10435696
28-Mar-14 4:09am
View
I have a ImageViewer Page With Iframe in it..And Server code like this-
frmShowImage.Attributes["src"] = "ImageViewerDownload.aspx?file=" + ContentData;
Then in ImageViewerDownload.aspx i have this code-
protected void Page_Load(object sender, EventArgs e)
{
try
{
Response.ContentType = "image/png";
var filePath = Server.MapPath("~/CmsImage/" + Request.QueryString["file"]);
System.Drawing.Image orignalImage = System.Drawing.Image.FromFile(filePath);
System.Drawing.Image resizedImage = FixedSize(orignalImage, 640, 480);
Response.WriteFile(Server.MapPath("~/CmsImage/" + resizedImage));
Response.Flush();
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
catch (Exception Ex)
{
LoggingBase.ErrorLog(CommonConstants.DISCOM_CODE, Ex.Message, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
// mPopupMessage.ShowPopup("Application not Responding : please try later ", false);
}
}
internal static System.Drawing.Image FixedSize(System.Drawing.Image imgPhoto, int Width, int Height)
{
int sourceWidth = Convert.ToInt32(imgPhoto.Width);
int sourceHeight = Convert.ToInt32(imgPhoto.Height);
int sourceX = 0;
int sourceY = 0;
int destX = 0;
int destY = 0;
float nPercent = 0;
float nPercentW = 0;
float nPercentH = 0;
nPercentW = ((float)Width / (float)sourceWidth);
nPercentH = ((float)Height / (float)sourceHeight);
if (nPercentH < nPercentW)
{
nPercent = nPercentH;
destX = System.Convert.ToInt16((Width -
(sourceWidth * nPercent)) / 2);
}
else
{
nPercent = nPercentW;
destY = System.Convert.ToInt16((Height -
(sourceHeight * nPercent)) / 2);
}
int destWidth = (int)(sourceWidth * nPercent);
int destHeight = (int)(sourceHeight * nPercent);
Bitmap bmPhoto = new Bitmap(Width, Height,
PixelFormat.Format24bppRgb);
bmPhoto.SetResolution(imgPhoto.HorizontalResolution,
imgPhoto.VerticalResolution);
Graphics grPhoto = Graphics.FromImage(bmPhoto);
grPhoto.Clear(Color.Black);
grPhoto.InterpolationMode =
InterpolationMode.HighQualityBicubic;
grPhoto.DrawImage(imgPhoto,
new Rectangle(destX, destY, destWidth, destHeight),
new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),
GraphicsUnit.Pixel);
grPhoto.Dispose();
return bmPhoto;
}
Now how to write a file which is not saved anywhere on folder.
Response.WriteFile(Server.MapPath("~/CmsImage/" + resizedImage));--->How to write this resized file in frame.Currently this line is giving error
Member 10435696
26-Mar-14 8:50am
View
but all these ways are using server side code but i want it in client side..As i am using Gridview..Plz help
Member 10435696
28-Feb-14 5:35am
View
Hey sory 4 late reply..
My this code starting working..my alerts are giving the correct data..
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: 'POST',
"url": 'Employee/GetAllNodes',
"contentType": "application/json; charset=utf-8",
"dataType": 'json',
"data": "{}",
success: function (msg) {
alert(msg[0].EMP_ID);
alert(msg[0].PARENT_EMP_ID);
alert(msg[0].EMP_NAME);
alert((msg));
$('#treeViewDiv').jstree({
"json_data": { "data": msg[0].EMP_NAME},--------->This is printing steve
"plugins": ["themes", "json_data"]
});
}
, timeout: 60000
});
});
Member 10435696
27-Feb-14 5:46am
View
i thnk their is prob in my js..can u give ma a link from where i can have js +jstree jquery download latest version
Member 10435696
27-Feb-14 4:46am
View
sorry but how to find that version i have...sory forr this queston
Member 10435696
27-Feb-14 4:30am
View
Your code is perfect..bt it give me the same result..
Member 10435696
27-Feb-14 2:53am
View
PARENT_EMP_ID=0 Means they are the parent and have child nodes below them
For eg i want steve to be parent and Joe & Eric to be his child node..
Member 10435696
27-Feb-14 2:09am
View
Sorry it gives same tree again
since we are using getjson,in my controller i have done this
[httpGet]
public JsonResult GetAllNodes()
{
List<employee> pEmployee = new List<employee>();
Employee tEmployee = new Employee();
tEmployee.EMP_ID = 1;
tEmployee.EMP_NAME = "steve";
tEmployee.PARENT_EMP_ID= 0;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 2;
tEmployee.EMP_NAME = "Joe";
tEmployee.PARENT_EMP_ID = 1;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 3;
tEmployee.EMP_NAME = "Eric";
tEmployee.PARENT_EMP_ID = 1;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 4;
tEmployee.EMP_NAME = "Henry";
tEmployee.PARENT_EMP_ID = 0;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 5;
tEmployee.EMP_NAME = "Katie";
tEmployee.PARENT_EMP_ID = 4;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 6;
tEmployee.EMP_NAME = "george";
tEmployee.PARENT_EMP_ID = 4;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 7;
tEmployee.EMP_NAME = "Renai";
tEmployee.PARENT_EMP_ID = 0;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 8;
tEmployee.EMP_NAME = "Marc";
tEmployee.PARENT_EMP_ID = 7;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 9;
tEmployee.EMP_NAME = "John";
tEmployee.PARENT_EMP_ID = 7;
pEmployee.Add(tEmployee);
tEmployee = new Employee();
tEmployee.EMP_ID = 10;
tEmployee.EMP_NAME = "Andrew";
tEmployee.PARENT_EMP_ID = 0;
pEmployee.Add(tEmployee);
return Json(pEmployee, JsonRequestBehavior.AllowGet);
}
}
n my view
$.getJSON("Employee/GetAllNodes", function (result) {
var allEmployees = '';
alert(result);
$.each(result, function (keyEmployees, employee) {
// var nodeData = { "data": { title: employee.EMP_NAME }, "metadata": { id: employee.EMP_ID} };
var nodeData = { "data": { title: employee.EMP_NAME }, "metadata": { id: employee.EMP_ID, parent: employee.PARENT_EMP_ID} };
if (allEmployees.length == 0) {
allEmployees = [nodeData];
}
else {
allEmployees = [allEmployees, nodeData];
}
});
$("#treeViewDiv").jstree({
"json_data": { "data": allEmployees },
"plugins": ["themes", "json_data"]
});
});
bt it doesnt work..it give the name of employees
Member 10435696
27-Feb-14 1:52am
View
NO ALL ACT AS PARENT..THEIR IS NO CHILD AND PARENT RELATIONSHIP BETWEEN THEM
Member 10435696
27-Feb-14 1:37am
View
steve
Joe
Eric
Henry
Katie
george
Renai
Marc
John
Andrew
hey your code gave me this output..
Member 10435696
27-Feb-14 1:20am
View
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: 'POST',
"url": 'Employee/GetAllNodes',
"contentType": "application/json; charset=utf-8",
"dataType": 'json',
"data": "{}",
success: function (msg) {
alert(msg[0].EMP_ID);
alert(msg[0].PARENT_EMP_ID);
alert(msg[0].EMP_NAME);
alert((msg));
$('#treeViewDiv').jstree({
"json_data": { "data": msg.EMP_NAME},
"plugins": ["themes", "json_data"]
});
}
, timeout: 60000
});
});
Member 10435696
27-Feb-14 0:58am
View
alert(msg[0].EMP_ID);
alert(msg[0].PARENT_EMP_ID);
alert(msg[0].EMP_NAME);
THIS ALL are giving undefined
Member 10435696
27-Feb-14 0:42am
View
I have this data coming from controller
[{"EMP_ID":1,"EMP_NAME":"steve","PARENT_EMP_ID":0},{"EMP_ID":2,"EMP_NAME":"Joe","PARENT_EMP_ID":1},{"EMP_ID":3,"EMP_NAME":"Eric","PARENT_EMP_ID":1},{"EMP_ID":4,"EMP_NAME":"Henry","PARENT_EMP_ID":0},{"EMP_ID":5,"EMP_NAME":"Katie","PARENT_EMP_ID":4},{"EMP_ID":6,"EMP_NAME":"george","PARENT_EMP_ID":4},{"EMP_ID":7,"EMP_NAME":"Renai","PARENT_EMP_ID":0},{"EMP_ID":8,"EMP_NAME":"Marc","PARENT_EMP_ID":7},{"EMP_ID":9,"EMP_NAME":"John","PARENT_EMP_ID":7},{"EMP_ID":10,"EMP_NAME":"Andrew","PARENT_EMP_ID":0}]
and when i am trying msg.EMP_NAME..It is giving undefined
Member 10435696
26-Feb-14 5:47am
View
I have done some changes to my view but still it doesnt work..Any help will be appreciated
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: 'POST',
url: 'Employee/GetAllNodes',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: "{}",
success: function(msg) {
alert((msg));
$('#treeViewDiv').jstree({
"json_data": { "data":msg},
"plugins": ["themes", "json_data"]
});
}
, timeout: 60000
});
});
</script>
and in my controller i have changed last 2 lines
var jsonData = new JavaScriptSerializer().Serialize(pEmployee);
return Json(jsonData);
bt jstree doesnt bind
Member 10435696
24-Feb-14 1:50am
View
no then also it doesnt work.In case of single employee,it gives
[object Object]
and this also doesnt bind
Member 10435696
22-Feb-14 5:08am
View
I am using ur 2nd solution..Bt issue still exists.I am getting this from controller in my 'result'..
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Now this doesnt bind to my jstree
Member 10435696
18-Feb-14 4:39am
View
Plz Have a Look
http://www.codeproject.com/Questions/729408/Consume-data-from-wcf-client-in-current-applicatio
Member 10435696
15-Feb-14 7:56am
View
Yes i am..In view how to use jquery..plz help
Member 10435696
15-Feb-14 7:52am
View
This disables textbox on load..Now when checkbox checked is true then my textbox doesnt enable..???
Member 10435696
15-Feb-14 7:39am
View
Yes i want textbox disabled at load time.then when checkbox change to true then textbox get enabled & vice versa
Member 10435696
15-Feb-14 7:23am
View
Above issues are resolved..Plz have a look at below link
http://www.codeproject.com/Questions/727843/How-to-disable-textbox-on-checkbox-check-is-true-v
Member 10435696
12-Feb-14 7:32am
View
Uncaught TypeError: Cannot read property 'length' of undefined jquery.dataTables.js:2541
Member 10435696
12-Feb-14 6:57am
View
Still the same..data doesnt show up in table..
Member 10435696
12-Feb-14 6:40am
View
Yes my json(aaData) is returning correct data..
{[
{
"USER_NAME": "alpa",
"MOBILE_NO": "000",
"EMAIL_ID": "alpa.sae",
"COLOR_NAME": "Red",
"COLOR_ID": 0
},
{
"USER_NAME": "alpas",
"MOBILE_NO": "000",
"EMAIL_ID": "alpa.sae",
"COLOR_NAME": "Green",
"COLOR_ID": 0
}
]}
Member 10435696
12-Feb-14 6:33am
View
i have posted it method name getresult
Member 10435696
12-Feb-14 6:29am
View
Now it is rediecting to Url.bt it doesnt show data which is coming from controller in this format in mvc2---->
{[
{
"USER_NAME": "alpa",
"MOBILE_NO": "000",
"EMAIL_ID": "alpa.sae",
"COLOR_NAME": "Red",
"COLOR_ID": 0
},
{
"USER_NAME": "alpas",
"MOBILE_NO": "000",
"EMAIL_ID": "alpa.sae",
"COLOR_NAME": "Green",
"COLOR_ID": 0
}
]}
My controller
[HttpGet]
public JsonResult GetResult()
{
JArray JsonArray = new JArray();
JObject jo = new JObject();
List<user> plist = new List<models.user>();
User tUser = new User();
tUser.USER_NAME = "alpa";
tUser.EMAIL_ID = "alpa.sae";
tUser.MOBILE_NO = "000";
tUser.COLOR_NAME = "Red";
plist.Add(tUser);
tUser = new User();
tUser.USER_NAME = "alpas";
tUser.EMAIL_ID = "alpa.sae";
tUser.MOBILE_NO = "000";
tUser.COLOR_NAME = "Green";
plist.Add(tUser);
JsonArray = (JArray)JToken.FromObject(plist);
jo["Message"] = "Data Saved Succeffully";
jo["data"] = JsonArray;
// return Json(plist, JsonRequestBehavior.AllowGet);
var aaData = new Response(true, "Contact Successfully Submitted", jo["data"].ToString());
return Json(aaData);
}
}
Member 10435696
12-Feb-14 5:39am
View
http://www.codeproject.com/Questions/725359/datatable-in-mvc2-not-working
Plz check above link
Member 10435696
12-Feb-14 1:32am
View
Thanks..I have resolved my issue
Member 10435696
11-Feb-14 23:53pm
View
can u share your model class
Member 10435696
11-Feb-14 23:47pm
View
Thanks for replying..I want to change this bec i dont know how i will pick values of dropdown selected item through this method.
Member 10435696
11-Feb-14 8:04am
View
Hey i have resolved it...Just look at my solution..Only 1 issue is pending that the way i am sending my textbox data to controller,I jst dont want to do that way..jst have a look & help me to resolve my last issue...
<fieldset id="infoForm">
<input type="text" name="USER_NAME" id="USER_NAME" />
<input type="text" name="MOBILE_NO" id="MOBILE_NO" />
<input type="text" name="EMAIL_ID" id="EMAIL_ID"/>
<input type="button" id="submitButton" value="Save"/>
</fieldset>
<script type="text/javascript">
$(function () {
var submitButton = $("#submitButton");
var infoForm = $("#infoForm");
// var infoForm = USER_NAME=USER_NAME.val()&MOBILE_NO==MOBILE_NO.val()&EMAIL_ID==EMAIL_ID.val();
alert(infoForm);
// Attach event handler to submit button
submitButton.click(function () {
SubmitInfo(infoForm);
});
});
</script>
<script type="text/javascript">
function SubmitInfo(formContainer)
{
alert("in fun");
alert(formContainer.serialize());
$.ajax({
url: "User/Index",
type: 'post',
// contentType: "application/json;charset=utf-8",
dataType: "json",
data: formContainer.serialize(),
// ------ I WANT THIS WAY----But this doesnt work//
// data: "{'USER_NAME':'" + escape(txtname.val()) + "', 'MOBILE_NO':'" + escape(txtmobile.val()) + "' ,'EMAIL_ID':'" + escape(txtemail.val()) + "'}",
success: function (data) {
alert("fff");
if (data.IsSuccess) {
// Clear the input tags
formContainer.find("input[type='text']").each(function (i, element) {
$(this).val('');
});
alert(data.data);
$('#table').dataTable().fnAddData(data.data);
alert("again");
filltable();
}
alert("giii");
alert(data.data);
},
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
</script>
My controller action mthod
[HttpPost]
public JsonResult Index(User model)
{
if (ModelState.IsValid)
{
JArray JsonArray = new JArray();
JObject jo = new JObject();
User puser=new User();
puser.USER_NAME = model.USER_NAME.Trim();
puser.EMAIL_ID = model.EMAIL_ID.Trim();
puser.MOBILE_NO = model.MOBILE_NO.Trim();
List<user> tUser = new List<models.user>();
tUser.Add(puser);
JsonArray = (JArray)JToken.FromObject(tUser);
jo["Message"] = "Data Saved Succeffully";
jo["data"] = JsonArray;
var response = new Response(true, "Contact Successfully Submitted",jo["data"].ToString());
return Json(response);
}
else
{
return Json(false);
}
}
}
My issue is that i want to pick value from each textbox and then send whole data to contoller..I dont want to use that fieldset method mentioned above...
Member 10435696
11-Feb-14 7:07am
View
I am not able to get the response from controller to view in success function???
Member 10435696
11-Feb-14 6:45am
View
Actually I was trying to send data through json..It was not working..Then i found that mvc2 doesnt support jsondata type and to achieve it we need to add JsonValueProviderFactory..Bt that is also giving error..
What i have posted is related to this issue only..
Member 10435696
11-Feb-14 6:12am
View
My view -><input type="text" name="USER_NAME" id="USER_NAME" />
<input type="text" name="MOBILE_NO" id="MOBILE_NO" />
<input type="text" name="EMAIL_ID" id="EMAIL_ID"/>
<input type="button" id="submitButton" value="Save"/>
Now on submit button->
<script type="text/javascript">
$(function () {
var submitButton = $("#submitButton");
// var infoForm = $("#infoForm");
// alert(infoForm);
// Attach event handler to submit button
submitButton.click(function () {
SubmitInfo();
});
});
</script>
<script type="text/javascript">
function SubmitInfo() {
alert("in fun");
$.ajax({
url: "User/Index",
type: 'post',
datatype:'json',
contentType: "application/json;charset=utf-8",
data: "{'USER_NAME':'" + escape(USER_NAME.val()) + "', 'MOBILE_NO':'" + escape(MOBILE_NO.val()) + "' ,'EMAIL_ID':'" + escape(EMAIL_ID.val()) + "'}",
success: function (data) {
alert("fff");
if (data) {
// Clear the input tags
formContainer.find("input[type='text']").each(function (i, element) {
$(this).val('');
});
}
alert("giii");
alert(data.Message);
},
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
</script>
Plz help me to resolve this issue..Does mvc2 support json datatype.Bec when i use 'data' as mentioned above..It dosnt rediect to above url
Member 10435696
11-Feb-14 6:00am
View
Deleted
This is my View:
<input type="text" name="USER_NAME" id="USER_NAME" />
<input type="text" name="MOBILE_NO" id="MOBILE_NO" />
<input type="text" name="EMAIL_ID" id="EMAIL_ID"/>
<input type="button" id="submitButton" value="Save"/>
<script type="text/javascript"> $(function () {
var submitButton = $("#submitButton");
//var infoForm = $("#infoForm"); alert(infoForm);
// Attach event handler to submit button
submitButton.click(function () { SubmitInfo(); });
});</script><script type="text/javascript">
function SubmitInfo() { alert("in fun"); $.ajax({
url: "User/Index", type: 'post',
contentType: "application/json;charset=utf-8",
dataType: "json",
data: "{'USER_NAME':'" + escape(USER_NAME.val()) + "', 'MOBILE_NO':'" + escape(MOBILE_NO.val()) + "' ,'EMAIL_ID':'" + escape(EMAIL_ID.val()) + "'}",
success: function (data) { alert("fff");
if (data) { // Clear the input tags
formContainer.find("input[type='text']").each(function (i, element) {
$(this).val(''); });
} alert("giii");
alert(data.Message); },
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown); } }); }
</script>Now First Problem I am facing is-When I use
data: "{'USER_NAME':'" + escape(USER_NAME.val()) + "', 'MOBILE_NO':'" + escape(MOBILE_NO.val()) + "' ,'EMAIL_ID':'" + escape(EMAIL_ID.val()) + "'}",
It doesnt Redirect to the url I have Specified..
So to resolve my first Problem i used this Method- My view
<fieldset id="infoForm"> <div style="margin: 1em .5em">
<%: Html.LabelFor(model => model.USER_NAME)%>
<%: Html.TextBoxFor(model => model.USER_NAME)%>
</div> <div style="margin: 1em .5em">
<%: Html.LabelFor(model => model.EMAIL_ID)%>
<%: Html.TextBoxFor(model => model.EMAIL_ID)%>
</div> <div style="margin: 1em .5em">
<%: Html.LabelFor(model => model.MOBILE_NO)%>
<%: Html.TextBoxFor(model => model.MOBILE_NO)%>
</div> <p>
<input id="submitButton" type="button" value="Submit Info" />
</p> </fieldset><script type="text/javascript">
$(function () { var submitButton = $("#submitButton");
var infoForm = $("#infoForm"); // alert(infoForm);
// Attach event handler to submit button
submitButton.click(function () { SubmitInfo(infoForm );
}); });</script> <script type="text/javascript">
function SubmitInfo(formContainer) { alert("in fun");
$.ajax({ url: "User/Index", type: 'post',
data: formContainer.serialize(),
success: function (data) { alert("fff");
if (data) { // Clear the input tags
formContainer.find("input[type='text']").each(function (i, element) {
$(this).val(''); });
} alert("giii");
alert(data.Message); },
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown); } }); }
</script>This Resolves my issue..and It Redirect to Url i.e controller
[HttpPost]
public JsonResult Index(User model)
Member 10435696
11-Feb-14 5:17am
View
I have followed the steps...Getting error in JsonDotNetValueProviderFactory class->
Unexpected character encountered while parsing value: U. Path '', line 0, position 0.
Getting Error in This Line-
return String.IsNullOrEmpty(bodyText) ? null : new DictionaryValueProvider<object>(JsonConvert.DeserializeObject<expandoobject>(bodyText, new ExpandoObjectConverter()) ,
CultureInfo.CurrentCulture);
Member 10435696
11-Feb-14 4:37am
View
I am getting the same error with this also...It gives red mark on JsonDotNetValueProviderFactory()..
Member 10435696
11-Feb-14 2:56am
View
http://www.codeproject.com/Questions/724472/Error-21-The-type-or-namespace-name-JsonValueProvi
Member 10435696
10-Feb-14 23:39pm
View
http://www.codeproject.com/Questions/723917/SyntaxError-JSON-parse-unexpected-non-whitespace-c
Member 10435696
10-Feb-14 6:20am
View
[HttpPost]
public JsonResult Index(User model)
{
if (ModelState.IsValid)
{
JArray JsonArray = new JArray();
JObject jo = new JObject();
User puser=new User();
puser.USER_NAME = model.USER_NAME.Trim();
puser.EMAIL_ID = model.EMAIL_ID.Trim();
puser.MOBILE_NO = model.MOBILE_NO.Trim();
List<user> tUser = new List<models.user>();
tUser.Add(puser);
//GetPageBaseObject.Add(puser);
JsonArray = (JArray)JToken.FromObject(tUser);//.Replace(new Regex("\\n","g"),"");//.Replace(new Regex("\\n", "g"),"");
Response.Write(JsonArray);
jo["Message"] = "Data Saved Succeffully";
jo["data"] = JsonArray;
Response.Write(jo.ToString());
return Json(jo["data"]);
}
else
{
return Json(false);
}
}
}
here when i print Response.Write(JsonArray);
it gives this error and doesnt go to ajax success function on view
Member 10435696
10-Feb-14 6:18am
View
yes..i am getting SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data Error On controller
Member 10435696
10-Feb-14 4:55am
View
what are u editing???plz let me know???
Member 10435696
10-Feb-14 1:10am
View
I have posted a new question..help have a look..
Member 10435696
10-Feb-14 0:41am
View
What changes were done..I am not able to find
Member 10435696
8-Feb-14 6:28am
View
k i will ask that question in another post
Member 10435696
8-Feb-14 6:27am
View
No it is still pending..Was waiting for your reply
Member 10435696
8-Feb-14 4:49am
View
Can u post a simple eg of saving data through json...I am jst posting an rough layout
<script type="text/javascript">
$(document).ready(function () {
alert("yy");
$("#save").click(function () {
var json = "{'USER_NAME':'" + escape(USER_NAME.val()) + "','MOBILE_NO':'" + escape(MOBILE_NO.val()) + "'}";
alert(json);
alert("RRR");
var ajaxPage = "~/User/Index/{0}";
alert(ajaxPage);
$.ajax(
{
type: "POST",
url: ajaxPage,
data: json,
contentType: "application/json;charset=utf-8",
dataType: "json",
async: false,
success: function (data) {
if (data.Message == "Data Deleted Succeffully") {
showMessage(data.Message);
$('#table').dataTable().fnAddData();
filltable();
}
else {
showMessage(data.Message);
}
},
error: function (msg) { alert("failed: " + msg); }
});
})
});
</script>
And in the controller
[HttpPost]
public ActionResult Index(User model)
{
if (ModelState.IsValid)
{
System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
string line = "";
line = sr.ReadToEnd();
JObject jo = JObject.Parse(line);
var email = model.EMAIL_ID;
return View();
// return Redirect("/Book/Employee");
}
else
{
return View();
}
}
}
Can anybody post this type of eg
Member 10435696
8-Feb-14 4:24am
View
Yes it give only 1 record EMP_ID 1
EMP_NAME XYZ
Member 10435696
8-Feb-14 3:07am
View
public ActionResult ShowUpdateView(int id)
{
var em =from p in GetPageBaseObject where p.EMP_ID==id select p;
ViewData["Emp"] = GetPageBaseObject;
ViewData["ee"] = em.ToList();
return View();
}
This is how i am using viewdata
Member 10435696
8-Feb-14 3:06am
View
I have used your code and it is giving this line in textbox
System.Collections.Generic.List`1[MvcApplication2.Models.Employee]
Member 10435696
8-Feb-14 2:51am
View
actually on page load event doesnt support <input type...> n all control..
its the problem ..otherwise my viewdata is getting the whole data from controller
Member 10435696
8-Feb-14 2:49am
View
plz help me out..If i assign textbox this way in mvc
<%: Html.TextBoxFor(m => m.EMP_NAME, ViewData["ee"])%>
Then if i want to use id of textbox anywhere on viewpage...how can i do that..What is the id of textbox of above line?
Member 10435696
8-Feb-14 2:36am
View
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
<input type="text" name="EMP_NAME" value=ViewData["ee"].ToString()>
ddl.DataSource = ViewData["Emp"];
ddl.DataBind();
}<pre><pre lang="text"></pre></pre>
</script>
It doesnt allow me to assign value in this code
Member 10435696
4-Feb-14 1:52am
View
Is it necessary for everyone to add this reference.Bec my application was running ealier bt when a added a reference of telerik it is giving a problem.
and When i am clicking on ADD Reference on Bin->In .Net tab->I am not getting System.Web.WebPages.Deployment
Member 10435696
30-Jan-14 23:58pm
View
k thanks..U have resolved my issue..Thanks
Member 10435696
30-Jan-14 7:55am
View
SQLCMD -S YOURCOMPUTERNAME\SQLEXPRESS -E -w 166 -e -i C:\BAT\ShrinkDB.sql -o C:\BAT\ShrinkDB.log
plz explain -E -W & 166 -E
Member 10435696
30-Jan-14 7:33am
View
k Thanks for reply and what you store in ShrinkDB and how you do it??
Member 10435696
30-Jan-14 6:46am
View
Your 1st Point Says Create C:\BAT\SHRINKDB.BAT
But i cant find BAT Folder in C drive...Plz help how to create BATCH file.I want to schedule a procedure for daily execution at midnight
Member 10435696
28-Jan-14 8:04am
View
what is nugget package?
Member 10435696
28-Jan-14 7:57am
View
after clicking browse where to search my dll...where are all dll..whether i have to use google
Member 10435696
28-Jan-14 7:56am
View
no 2010
Member 10435696
28-Jan-14 7:56am
View
Could not load file or assembly 'Telerik.Web.UI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have added refernce but it is giving this error
Member 10435696
25-Jan-14 0:57am
View
Ok.You want to say that first i call method in server side then from that method which retrieve data ,i use that in success function???
Show More