How getValue except from attribut ID in EXT.Net Razor Engine? - asp.net-mvc-3

code in listeners bellow get value from ID #{CheckAll},
I want get value from other attribute.
#Html.X().ResourceManager()
#Html.X().Checkbox()
.Name("CheckAll")
.BoxLabel("CheckAll")
.ID("CheckAll")
.Checked(false)
.Listeners(l => l.Change.Handler = #"var checkAll = #{CheckAll}.getValue();
if(checkAll){
#{CheckAll2}.setValue(true);
}");

I think your sample should work if you change #{CheckAll} to App.CheckAll and #{CheckAll2} to App.CheckAll2.
Hope this helps.

Related

Retrieve only left, right, propertyName from the javers Change class

I am using the following code to retreive the changes made to a version in my API response
List<Change> versionChanges = javers.findChanges(jqlQuery.build()).groupByCommit()get(0).get()
It gave me the following
https://user-images.githubusercontent.com/10185101/122550135-f3223b00-d050-11eb-9cc8-72982808cd2e.png
But I don't want this entire data to go as my API response
I just want to isolate left, right, propertyName in my response
I am not able to find an API on Change.class that can do me so ..
How can I achieve this
Thank you
List<ChangesByCommit> changes = javers.findChanges(jqlQuery.build()).groupByCommit();
ValueChange valueChange = (ValueChange)changes.get(0).get().get(0);
String property = valueChange.getPropertyName();
Object originalValue = valueChange.getLeft();
Object newValue = valueChange.getRight();

Send boolean to Parse

In Parse I have a class that has a string and a boolean column.
I want to update the object with new values and I do this:
RestSharp client =...
RestRequest request = new RestRequest(Method.PUT);
request.AddParameter("String column", "new string");
request.AddJsonBody("{"+"Boolean column"+":False\"}");
request.RequestFormat = DataFormat.Json;
var requestHandler = client.ExecuteAsync(...)
The response's status is OK and when I check with Parse dashboard on the server, the first column has changed. But the second column, the boolean one has not changed.
How should I set the boolean parameter?
I tried:
request.AddJsonBody("{"+"Boolean column"+":false\"}");
request.AddJsonBody("{"+"Boolean column"+":0\"}");
but none of them changed the value on the backend server.
When I tried:
request.AddParameter("Boolean column": false);
I got this error:
"{\"code\":111,\"error\":\"schema mismatch for ...; expected Boolean but got String\"}"
How can I fix this problem?
Thank you
check your mongodb collection 'SCHEMA' for the answer
Because the Parse will create a restricted condition according to the first record inserted for each collection.

how to use removeSheet and insertSheet on kendo Spreadsheet?

I already read the documentation in
http://docs.telerik.com/kendo-ui/api/javascript/ui/spreadsheet#methods-insertSheet
But on that link I didn't see the example for using this function.
Can someone give me the example for insertSheet method and removeSheet method?
Thanks.
//insertSheet:
var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
spreadsheet.insertSheet({name:'TEST'}); //you can set more than "name"
//removeSheet:
var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
var sheetWillBeDeleted = spreadsheet.sheetByName("TEST"); //you can also use sheetByIndex function to get the sheet by index.
spreadsheet.removeSheet(sheetWillBeDeleted);

Issue Retrieving a Screenshot from a database

I've got a bunch of screenshots and some screenshot meta data I'm trying to display in an ASP.NET MVC 3 web application, I'm trying to retrieve the data from my databse but I get this error:
LINQ to Entities does not recognize the method 'System.Drawing.Image
ByteArrayToImage(Byte[])' method, and this method cannot be translated
into a store expression.
Here's my code:
var screenshotData = (from screenshots in db.screenshots
where screenshots.projects_ID == projectID
select new ImageInformation
{
ID = screenshots.id,
Language = screenshots.language,
Screenshot = Utility.ByteArrayToImage(screenshots.screen_shot),
ProjectID = screenshots.projects_ID
});
foreach (ImageInformation info in screenshotData)
{
this.Add(info);
}
ImageInformation is just a simple class that contains the defintion the information stored (ID, Language, Screenshot, ProjectID).
Here's my ByteArrayToImage function:
public static Image ByteArrayToImage(byte[] byteArrayIn)
{
using (MemoryStream ms = new MemoryStream(byteArrayIn))
{
Image returnImage = Image.FromStream(ms);
return returnImage;
}
}
Can anybody tell me why I receive this error when this code runs?
Thanks.
I think it's because, with LINQ-to-Entities, the code is turned into server-side query and it can't do that in this case. I don't think you can mix client-side code like this directly with L2E.
I would suspect you will have to do the conversion from byte->image after you've retrieved the data from the database as a distinct step.
You can't do the function in a LINQ to Entities query... one option:
1) have a byte[] property on the object you are instantiating (ImageInformation) and copy the data in there along with another propery to read the image from this ImageInformation object.

$.getJSON difference between Firefox and Internet Explorer

Spent a while searching on this and found nothing that related directly. I have resolved the issue, but wonder why it is so. Maybe someone can answer this. Maybe this info will help someone else.
My javascript was as such:
var userServicePath = serverPath + '/Login/RegisterUserDetails/' + userId;
$.getJSON(userServicePath, null, createAndPopulateHiddenFields);
My Controller ran a query, populated an object and returned the object via:
return Json(qry, JsonRequestBehavior.AllowGet);
This worked fine until I added a few more fields. After modifying the object and controller, my response in IE showed null for my new fields. The breakpoint on the return value in the controller verified the new values were getting into the object properly. Even Firebug showed the values.
Just an FYI, my routing in MVC is set up with an id value for the third value in the url. Anyone have any ideas why this would work in FF, but not in IE.
And for the fix,... I removed the userId from the userServicePath string and added it as a parameter in the getJSON code.
var userServicePath = serverPath + '/Login/RegisterUserDetails';
$.getJSON(userServicePath, { id: userId }, createAndPopulateHiddenFields);
If anyone has an answer, that would be great. Otherwise, hopefully someone else in my shoes can spend less time searching for an answer and move on.
Answering my own question here:
var userServicePath = serverPath + '/Login/RegisterUserDetails';
$.getJSON(userServicePath, { id: userId }, createAndPopulateHiddenFields);

Resources