|
Yes. We can create CSV file instead of XLS. But, there's only one thing that could be a little bit undesired - wizard that opens CSV file. I'm not sure, but I think MS Excel cannot open CSV file directly without using wizard. Is that right?
|
|
|
|
|
Nope. Excel can open a CSV file directly.
|
|
|
|
|
Right, and any of those security dialogs that come up - the users don't even notice that stuff. Even if the conversion wizard does come up, the users probably won't care. They complete those tasks by rote - it's a bad habit really, but it's not a huge interruption to their day. Which is not to say you shouldn't worry about it - it's a legitimate concern, but it's not as big a problem as we sometimes think.
|
|
|
|
|
Hi guys,
I am building a report, in the report i should display 7 site name with check box, and if the report belongs to 1st site that check box should be checked, if the report belongs 2 sites it should check both 1st and 3rd
any help will be appreciated.
Thanks and regards
VISHWA
|
|
|
|
|
Hi,
Basically you are going to print your report. So why don't you create jpg for checked and unchecked display. if report belong to 1st site then display checked jpg in that one and otherwise default one. and for two sites you can change checked jpg for those options.
It will look similar like it is checkbox. I suggest this solution because i do not have idea about checkbox in report. sorry for that.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Hi Amit,
Thanks for the reply, I was also thought the same, but not having idea how to make jpg files should be display depends on the condition, so put a question on the form, will try the possible ways,
Thanks and regards
Vishwa
|
|
|
|
|
Your welcome
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
There is a physical html file and I need to traverse through all the html elements in an html file.
And the constraint is I can't use any third party components like HtmlAgilityPack or SuperStarHtml.
I think the best way is to preparing a XmlDocument from the html. But it is erroring out if the html contains any characters like .
Anyone having any idea to resolve this please share with me.
Thanks in advance.
|
|
|
|
|
HTML is not XML; you can't use an XML parser to load HTML.
Why can't you use a third-party component? Writing your own version of HtmlAgilityPack seems like a lot of work to satisfy a "Not Invented Here" philosophy.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have developed a custom Comment Control using class library file
now i want to use the dll of this file in web application which is developing on MVC Framework
so what are the ways of adding and using this dll in this project
|
|
|
|
|
Are you having trouble with the normal ways? You know, adding the DLL directly as a reference, or adding your whole project and referencing the project?
|
|
|
|
|
I have added dll file in project reference, bin folder as well as bin_deployableAssemblies
now i want use this control in .cshtml file
how can i write syntax for use this control in this file
|
|
|
|
|
It would have been nice if you could have said that at the beginning. I haven't ever done that myself, but ten seconds on Google did find this article, which looks to be what you're trying to do.
Custom Controls in MVC[^]
WHY were you not able to find that on Google? Or did you read it and need help with it?
|
|
|
|
|
i had serach on google but i was not found anything that what i want
i hav done custom control(generic) in asp.net
and i want implement it in web application which has in MVC framework.
|
|
|
|
|
The article I posted should get you there. It is about MVC, like it says. I don't think it's standard procedure to use server controls in MVC, but it's possible to do if you want.
|
|
|
|
|
OK, I'm at my wit's end with this sucker! I basically think I have two options, and both options are doing something screwed up and I can't explain why, but would really just rather have it stop! I'm trying to integrate a KendoUI Grid control, and an ASMX page method. I got the "Read" method to work great - it did take some work to get the JSON running back and forth properly, but it works really nicely. Now, I'm trying to do the "Update" and "Create" methods. The problem is my grid isn't sending back the proper data format. It's sending the right data, but the encoding is screwed up in many different ways depending on how I do it.
Here's my JQuery code at the moment...
function getJson(input) {
var k = JSON.stringify(input);
return k;
}
$(document).ready(function () {
$("#PeopleGrid").kendoGrid({
columns: ["LastName", "FirstName", "Phone"],
dataSource: {
transport: {
read: {
type: "POST",
url: "TestKendoGrid.aspx/Read",
contentType: "application/json; charset=utf-8",
dataType: "json"
},
create: {
type: "POST",
url: "TestKendoGrid.aspx/Create",
contentType: "application/json; charset=utf-8",
dataType: "json"
},
update: {
type: "POST",
url: "TestKendoGrid.aspx/Update",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: function (x) { return getJson(x); }
}
},
schema: {
data: "d",
columns: ["ID", "LastName", "FirstName", "Phone"],
model: {
id: "ID",
fields: {
LastName: {
editable: true,
nullable: false
},
FirstName: {
editable: true,
nullable: false
},
Phone: {
editable: true,
nullable: false
}
}
}
},
batch: false
},
editable: {
update: true,
create: true,
destroy: false
},
toolbar: ["create", "save", "cancel"]
})
});
The little function at the top is just so I can see the values in the debugger. With the current code, "input" is the actual object I'm trying to send back and "k" actually IS the exact JSON string I want to POST back to my server. Problem is, when I look at what was actually sent, it's funky as hell! This is what the request looks like...
POST http://localhost:54346/TestKendoGrid.aspx/Update HTTP/1.1
Host: localhost:54346
Connection: keep-alive
Content-Length: 1930
Accept: application/json, text/javascript, */*; q=0.01
Origin: http://localhost:54346
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31
Content-Type: application/json; charset=UTF-8
Referer: http://localhost:54346/TestKendoGrid.aspx
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: ASP.NET_SessionId=dkmbybyaz0bitvat2wbdueti
0=%7B&1=%22&2=_&3=_&4=t&5=y&6=p&7=e&8=%22&9=%3A&10=%22&11=T&12=e&13=s
&14=t&15=W&16=e&17=b&18=S&19=i&20=t&21=e&22=.&23=P&24=e&25=r&26=s&27=o
&28=n&29=%22&30=%2C&31=%22&32=I&33=D&34=%22&35=%3A&36=5&37=%2C&38=%22&39=L
&40=a&41=s&42=t&43=N&44=a&45=m&46=e&47=%22&48=%3A&49=%22&50=A&51=d&52=a
&53=m&54=s&55=o&56=n&57=%22&58=%2C&59=%22&60=F&61=i&62=r&63=s&64=t&65=N
&66=a&67=m&68=e&69=%22&70=%3A&71=%22&72=D&73=a&74=n&75=i&76=e&77=l&78=l
&79=e&80=%22&81=%2C&82=%22&83=P&84=h&85=o&86=n&87=e&88=%22&89=%3A&90=%22
&91=3&92=0&93=3&94=-&95=5&96=2&97=3&98=-&99=8&100=7&101=1&102=9&103=%22
&104=%2C&105=%22&106=E&107=n&108=t&109=i
&110=t&111=y&112=S&113=t&114=a&115=t&116=e&117=%22&118=%3A&119=2&120=%2C
&121=%22&122=E&123=n&124=t&125=i&126=t&127=y&128=K&129=e&130=y&131=%22&132=%3A
&133=%7B&134=%22&135=E&136=n&137=t&138=i&139=t&140=y&141=S&142=e&143=t&144=N
&145=a&146=m&147=e&148=%22&149=%3A&150=%22&151=P&152=e&153=o&154=p&155=l
&156=e&157=%22&158=%2C&159=%22&160=E&161=n&162=t&163=i&164=t&165=y&166=C
&167=o&168=n&169=t&170=a&171=i&172=n&173=e&174=r&175=N&176=a&177=m&178=e
&179=%22&180=%3A&181=%22&182=S&183=a&184=n&185=d&186=b&187=o&188=x&189=E&190=n
&191=t&192=i&193=t&194=i&195=e&196=s&197=%22&198=%2C&199=%22&200=E&201=n&202=t
&203=i&204=t&205=y&206=K&207=e&208=y&209=V&210=a&211=l&212=u&213=e&214=s
&215=%22&216=%3A&217=%5B&218=%7B&219=%22&220=K&221=e&222=y&223=%22&224=%3A&225=%22
&226=I&227=D&228=%22&229=%2C&230=%22&231=V&232=a&233=l&234=u&235=e&236=%22
&237=%3A&238=5&239=%7D&240=%5D&241=%2C&242=%22&243=I&244=s&245=T&246=e&247=m&248=p
&249=o&250=r&251=a&252=r&253=y&254=%22&255=%3A&256=f&257=a&258=l&259=s&260=e
&261=%7D&262=%7D&__type=TestWebSite.Person&ID=5&LastName=Adamson&FirstName=Danielle&Phone=303-555-1212&EntityState=2&EntityKey%5BEntitySetName%5D=People&EntityKey%5BEntityContainerName%5D=SandboxEntities
&EntityKey%5BEntityKeyValues%5D%5B0%5D%5BKey%5D=ID&EntityKey%5BEntityKeyValues%5D%5B0%5D%5BValue%5D=5&EntityKey%5BIsTemporary%5D=false
LOL, wut?! It's encoding each character as if it's a separate parameter! What in the hell?!
If I don't "stringify" it posts the data as URL-encoded, like this:
POST http://localhost:54346/TestKendoGrid.aspx/Update HTTP/1.1
Host: localhost:54346
Connection: keep-alive
Content-Length: 320
Accept: application/json, text/javascript, */*; q=0.01
Origin: http://localhost:54346
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31
Content-Type: application/json; charset=UTF-8
Referer: http://localhost:54346/TestKendoGrid.aspx
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: ASP.NET_SessionId=dkmbybyaz0bitvat2wbdueti
__type=TestWebSite.Person&ID=18&LastName=Russell&FirstName=Graham&Phone=303-555-5000&EntityState=2&EntityKey%5BEntitySetName%5D=People&EntityKey%5BEntityContainerName%5D=SandboxEntities
&EntityKey%5BEntityKeyValues%5D%5B0%5D%5BKey%5D=ID&EntityKey%5BEntityKeyValues%5D%5B0%5D%5BValue%5D=18&EntityKey%5BIsTemporary%5D=false
And of course, ASP.Net responds to that with a 500 error of "Invalid JSON Primitive" which basically means it choked, according to http://encosia.com/asmx-scriptservice-mistake-invalid-json-primitive/[^]
So, I'm trying to follow the advice in the article, but that's causing the really weird request in the first snippet. So, I'm not sure what to do!
It should be posting this (the value of "k" in the little function):
{"__type":"TestWebSite.Person","ID":5,"LastName":"Adamson","FirstName":"Danielle","Phone":"303-555-1212","EntityState":2,"EntityKey":{"EntitySetName":"People","EntityContainerName":"SandboxEntities","EntityKeyValues":[{"Key":"ID","Value":5}],"IsTemporary":false}}
My WebMethod on the receiving side is here - the Read method works great, but the other two haven't even seen a proper request so I'm not sure if they are correct yet.
[WebMethod]
public static List<Person> Read() {
using (SandboxEntities entity = new SandboxEntities()) {
var q = from p in entity.People
select p;
return q.ToList<Person>();
}
}
[WebMethod]
public static void Create(Person pIn) {
using (SandboxEntities e = new SandboxEntities()) {
e.AddToPeople(pIn);
e.SaveChanges();
}
}
[WebMethod]
public static void Update(Person pIn) {
using (SandboxEntities e = new SandboxEntities()) {
Person pUpdate = (Person)(from p in e.People where p.ID == pIn.ID select p).First();
pUpdate.Phone = pIn.Phone;
pUpdate.FirstName = pIn.FirstName;
pUpdate.LastName = pIn.LastName;
e.SaveChanges();
}
}
I've dug myself a big hole here, please help me get out! TIA
modified 1-Apr-13 19:19pm.
|
|
|
|
|
|
Thanks! I did get it figured out. Something to do with the ParameterMap function. I added a basic stringify into that, and now it sends back the proper JSON in the POST request.
However, now I'm getting some kind of type conversion problem. The incoming object IS being parsed correctly into a Person object, but then the framework is trying to convert it into a Dictionary object, which fails and throws an exception and a 500 back to the browser. I have no additional information than that, so it's a pretty big mystery at the moment.
I think this question is maybe too advanced for this forum. I know there's smart people here like you and me, and I thought this question was interesting enough to attract those folks, but I'm stumped so maybe everybody else is too? If you looked at this question and tried to solve it, please let me know what you found! We might work it out together.
This is the Javascript right now - this sends the proper JSON back to the server (and the server even deserializes it correctly to a Person object, then it chokes trying to do something unnecessary).
$(document).ready(function () {
$("#PeopleGrid").kendoGrid({
columns: ["LastName", "FirstName", "Phone"],
dataSource: {
transport: {
read: {
type: "POST",
url: "TestKendoGrid.aspx/Read",
contentType: "application/json; charset=utf-8",
dataType: "json"
},
create: {
type: "POST",
url: "TestKendoGrid.aspx/Create",
contentType: "application/json; charset=utf-8",
dataType: "json"
},
update: {
type: "POST",
url: "TestKendoGrid.aspx/Update",
contentType: "application/json; charset=utf-8",
dataType: "json"
},
parameterMap: function (data, type) {
return kendo.stringify(data);
}
},
schema: {
data: "d",
columns: ["ID", "LastName", "FirstName", "Phone"],
model: {
id: "ID",
fields: {
LastName: {
editable: true,
nullable: false
},
FirstName: {
editable: true,
nullable: false
},
Phone: {
editable: true,
nullable: false
}
}
}
},
batch: false
},
editable: {
update: true,
create: true,
destroy: false
},
toolbar: ["create", "save", "cancel"]
})
});
|
|
|
|
|
|
It's failing on the server side, but before it gets to my function. It's failing somewhere in the .Net Framework code, because it's trying to turn the Person object into a Dictionary, which is not a conversion that can be done. What I don't understand is why it's trying to do that, when it has a Person object it could pass directly to my function. Something isn't right in the wiring and I don't know what. I'll take a look at the article you posted and see what it's about, but I think I've read it before.
|
|
|
|
|
|
BTW, this is the error I'm getting (returned to my page in perfect JSON)
{
"Message": "Cannot convert object of type \u0027TestWebSite.Person\u0027 to type \u0027System.Collections.Generic.IDictionary`2[System.String,System.Object]\u0027",
"StackTrace": " at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object\u0026 convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object\u0026 convertedObject)
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)
at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)
at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)",
"ExceptionType": "System.InvalidOperationException"
}
What is totally stupid about this is, I can debug in the ObjectConverter.ConvertObjectToTypeMain function, and when I inspect the parameter "o" - it is of type "Person" which is exactly what my WebMethod needs. I do not understand why it's trying to convert it to something else at that point.
|
|
|
|
|
I've come to the conclusion that KendoGrid is an advanced Jquery Object sort of like CKEditor, and that it has an code interface that is the go between the UI Object, and backend support for creating, updating and deleting records via a web service.
Let's take the Web Service first. I suspect that it should be registered on a asmx page, and not aspx page. I don't know if that is your mistake or the way it was packaged from Kendo Dojo as an example.
TestKendoGrid.asmx/Update
The following web method takes a non-primitive value. So instead of person being an integer or string, it's an object called person, that must be described somewhere on that page, or somewhere in the project.
Person pIn is the non-primitive. Once again, I don't if you wrote this, or if it was provided as a live example, but in order to consume person, it must be pre-consumed first and then consumed, and the object elements must be described somewhere in the web method or a seperate class.
So Update returns nothing, no exit code or anything. Only List returns data back as an object called person, and not a JSON String. That why you can't stringify the object. There must be something in the KendoGrid file that parses the Person Object, and updates the KendoGrid.
From what I can tell, People is an array or a table, collection, and person is a single record in People.
[WebMethod]
public static void Update(Person pIn) {
using (SandboxEntities e = new SandboxEntities()) {
Person pUpdate = (Person)(from p in e.People where p.ID == pIn.ID select p).First();
pUpdate.Phone = pIn.Phone;
pUpdate.FirstName = pIn.FirstName;
pUpdate.LastName = pIn.LastName;
e.SaveChanges();
}
}
In my opinion, this is a custom program or solution, made to be easy to use and customized, and that you need to get the example code working first, before making any changes. The Kendo DoJo must have a forum or help source that you can get a better answer from than here.
I'm not going to dive into downloading the demo, and setting up a complete project to figure this one out.
I deleted my other posts, because they are not relevant to this subject, just misleading for those that follow.
Let me know if this is pure demo code, or if you started writing code from scratch to support the Kendo Grid. If it's pure demo code, then you missing a file for person and people.
|
|
|
|
|
Oh heck no, this is way beyond the demo code. I've already got the demos working and played with those quite a bit. This is actually just a simple example seeing if I can use the Entity Framework on the back end. We have a considerable project that we are testing the Kendo controls for. So, I wanted to try something simple first. I made a DB-first Entity Framework class for a simple table back in the database. Then I just used what I know about JQuery AJAX and the various blogs I could find, and did this up from scratch. The problem is, since we're not sure we are using Kendo or not, we don't have a license and can't use their 'special' forums, I can only post on here or StackOverflow and stuff. There's a few other ASP.Net developers at my company, but they aren't familiar with the newer stuff like using JQuery and ASP together, or MVC/Razor pages and Entity Framework. So, I'm kinda on my own.
I really appreciate you taking the time to think about this for me. I think you've given me some very good ideas to try. I'll just have to give it a go when I get back to the office. I'll let you know how it goes. The ASMX suggestion is a good one - the blog I posted says ASPX page methods work with JQuery AJAX, but it's worth a try on the other method. FYI, the method at the top that returns a List - that does return JSON, as the blog says it can.
Anyway thanks again for looking at this, I hope I can help you in the future
And, your other messages were helpful, you should have left them. Anything that gives me something to think about in a different way moves me forward.
|
|
|
|
|
OK!
That clarifies things for me. I guess like Richard Says, The first guest is the best guess, and I was on the right track after all. So I deleted messages containing actual help, but after looking at the Kendo Project, I had to back up and question who wrote or modified something that was working.
The following JSON, is it going in, or being returned?
{
"__type": "TestWebSite.Person",
"ID": 5,
"LastName": "Adamson",
"FirstName": "Danielle",
"Phone": "303-555-1212",
"EntityState": 2,
"EntityKey": {
"EntitySetName": "People",
"EntityContainerName": "SandboxEntities",
"EntityKeyValues": [
{
"Key": "ID",
"Value": 5
}
],
"IsTemporary": false
}
}
You should post the header to the web service, and the 3 web services, can't tell if you have the required attributes needed for Jquery.
|
|
|
|
|