Welcome to ASP.NET Wiki

ASP.NET Wiki provides practical solutions for common problems found in the development of ASP.NET applications.



Is There a Topic You are Interested in?

Help determine what wiki articles are written next. Tell me what topic(s) you are interested in at Submit Topic Request : EMail Form


Recent Posts

From categories:
page 1123...next »

Hi Mauro,

I'm not sure where the problem is. Could you try setting a couple of breakpoints in firebug to see what is happening? Try putting a break point on the following:

  1. In the TaskManager.DataAccess.getAdv function on "callback(response.adv);"
  2. In the initWorkSpace function on "img.src = 'images/' + adv.Adv_img + '.png';"

Also, in the TaskManager.DataAccess.getAdv function, catch block, try putting "console.log(err);"

Regards,


John DeVight
Telerik MVP

by John DeVightJohn DeVight, 03 May 2012 12:32

Hi John, I've tried your code but nothing … it seems that there is an error but I can't find it :(

if you have any time to try it, I would be very grateful

thanks
Mauro

by Mauro CattaneoMauro Cattaneo, 02 May 2012 17:59

Hi Mauro,

JSONP is asyncronous. Therefore, the TaskManager.DataAccess.getAdv function is returning before the $.ajax request is completed. The approach that I have taken is to pass in a callback function that gets called when the $.ajax call is done.

Try this:

TaskManager.DataAccess.getAdv = function(id, callback) {
  try {
    $.ajax({
      url: TaskManager._server + "/GetAdv",
      data: { id: id },
      datatype: "jsonp",
      jsonp: "d",
      cache: false
    })
    .done(function(response) {
      callback(response.adv);
    });
  }
  catch (err) {
  }
}

In your initWorkSpace function, call the TaskManager.DataAccess.getAdv function like this:

function initWorkSpace() {
  TaskManager.DataAccess.getAdv(1, function(adv) {
    img.src = 'images/' + adv.Adv_img + '.png';
  });
 
  // Rest of your code...
}

Hope this helps. If not, let me know and we can continue to investigate…

Regards,


John DeVight
Telerik MVP

by John DeVightJohn DeVight, 01 May 2012 19:42

Hi John,

I've tried your code and it works fine, but in the end I can't get the object I need from another js that I have in my application:

function initWorkSpace() {
  var adv = TaskManager . DataAccess . getAdv(1);
  img . src = 'images/' + adv . Adv_img + ' . png';
}

I have sent to you also an email to John dot DeVight at gmail dot com with 3 screenshot of code I've test with firebug.

Thanks a lot
Mauro

by Mauro CattaneoMauro Cattaneo, 01 May 2012 12:31
Sreeni (guest) 30 Apr 2012 20:04
in discussion Hidden / Per page discussions » Telerik MVC : Extending the Client API

John,
Thanks for the very useful extensions.
I am having hide/show tab issues.
IE complains "Microsoft JScript runtime error: Object doesn't support property or method 'showTab'"
Firefox and Chrome do not complain but tabs are not hidden/shown.
I was able to validate that the extensions work using your demo application.
The only difference that I could see is I am using the latest version of Telerik MVC Extensions(2012.1.214).
Could the version be the problem?
Thanks

by Sreeni (guest), 30 Apr 2012 20:04

Hi Mauro,

In the MobileController, you would add the following Controller Action:

public JsonpResult Sprint(int id)
{
    Sprint sprint = SprintRepository.GetSprints().Where(s => s.Id == id).First();
    return new JsonpResult(new { sprint = sprint });
}

In the JavaScript, you would do the following:

TaskManager.DataAccess.getSprint = function(id, callback) {
    try {
        $.ajax({
            url: TaskManager._server + "/Sprint",
            data: { id: id },
            dataType: "jsonp",
            jsonp: "d",
            cache: false
        })
        .done(function (response) {
            callback(response.sprint);
        });
    } catch (err) {
    }
}

I haven't actually tested this code, so if you encounter any problems, please let me know.

Regards,


John DeVight
Telerik MVP

by John DeVightJohn DeVight, 30 Apr 2012 15:30

Hi John,

in your example you always get a list af record and then filter the one you want with js function:

TaskManager . DataAccess . getSprint = function(id) {
try {
return JSON . parse(JSON . stringify(JSON . find({ data: TaskManager . DataAccess . _sprints, criteria: [{ elementName: "Id", elementValue: id }] })));
} catch (err) {
}
}

but if I need to get from my DB just one record passing an id and filter this record in the "SprintRepository" how can I modify your function?

Thanks a lot
Mauro

by Mauro CattaneoMauro Cattaneo, 29 Apr 2012 14:36
Silpa (guest) 27 Apr 2012 15:37
in discussion Hidden / Per page discussions » Telerik MVC : Extending the Client API

Hi John,

Thanks much for the client-side sorting implementation of the grid. I have to implement paging in the grid along with sorting, so when I sort it on client-side in the first page, it appears sorted. On paging, is there any way that I can retrieve the next set of records by the default sort order.

Currently, on paging, I have to rely on Telerik's sorting which is again server-side.

Thanks,
Silpa

by Silpa (guest), 27 Apr 2012 15:37
guest (guest) 26 Apr 2012 13:00
in discussion Hidden / Per page discussions » ASP.NET MVC3 : Loading Partial View with jQuery

why are you not returning view as PartialView

In your controller
namespace MyApplication
{
public class DocumentController : Controller
{
public ActionResult GetSection(string documentType, string sectionName)
{
// Code here to get a section…

return PartialView(section);
}
}
}

by guest (guest), 26 Apr 2012 13:00

Hi Mauro,

I'm not sure there is a "best" way for handling complex pages. I think it comes down to preference. When I have a complex page, I use user controls and put them on a single page.

Authentication should work just like a traditional asp.net web application.

Regards,

John


John DeVight
Telerik MVP

twangchuk (guest) 25 Apr 2012 11:31
in discussion Hidden / Per page discussions » Telerik MVC : Extending the Telerik HTML Helper

how to use the extended telerik helpers in View page.

by twangchuk (guest), 25 Apr 2012 11:31

Hi John,

just other two questions about Kendo UI and asp net:

1. what do you think is the best way to manage different "complex" pages? In other words, is there a way to separate the code for each page to avoid putting everything on one page like in your example (views)? Is it better to create different .aspx files for each page or use ".ascx user controls" and put all them in one single page? I use Visual Studio 2010.

2. how about authentication? Is like a traditional asp net web application or I need to use something different?

Thanks a lot
Mauro

I've noticed that also in pages with scroller control or list views, if you put fingers on header or footer and drag them outside of the screen, they aren't fix. So I think that is the browser that do this … maybe using the site from a native app (made with phonegap) it's different …

Today I started to develop my application, and first of all I need to put a big button in the center of the screen (both horizontal and vertical center) … do you have any advice for me? I've thought that I need some js to read the screen with and height, but I'm not sure it's possible …

I hope I havn't obsessed you with my questions!
Have a nice week end … I try to go on with my webapp :)

Mauro

Re: virtual dir path by Mauro CattaneoMauro Cattaneo, 20 Apr 2012 19:14

Hi Mauro,

Glad to hear it works! :-)

I need to spend some time looking at Kendo UI Mobile to see if I can answer your question, but I think the solution might be to use the Scroller control: http://demos.kendoui.com/mobile/scroller/index.html

I'll take a look over the weekend and get back to you…

Regards,


John DeVight
Telerik MVP

Re: virtual dir path by John DeVightJohn DeVight, 20 Apr 2012 14:38

Hi John,
now it runs! It's fantastic… great job!
I was able to run it doing in IIS "Convert to Application" on the virtual directory. I don't know why but it's ok!

I have already tested the index html file from my iphone and ipad inside my wLAN and it's great :)

Now I have to connect all this with my Entity Framework project and I can start to develop my application!

Only last question: you know if it's possible, on iphone, to avoid the scrolling of the entire page: if you do "add to home" from safari, in a page with a list-view you can scoll only the list, but header and footer are fixed (like in a native app). Instead, if you try with a page without a list-view, all the page scrolls, header and footer included (in a native app not).

Thanks again for your support…

Best Regards
Mauro

Re: virtual dir path by Mauro CattaneoMauro Cattaneo, 19 Apr 2012 21:31

Hi Mauro,

No worries. I'm happy to help.

The path that you want to set as the virtual directory is:

\kendouiaspnetsamples-14684\Web\TaskManager\TaskManager.Mvc

I wasn't able to figure out the url for the screen shot. Could you email it to me? John dot DeVight at gmail dot com.

If you are new to MVC, there are a couple of things you will need to do. If you are using Visual Studio 2010, ASP.NET MVC 3 doesn't come with Visual Studio 2010. You will need to download and install it if you haven't done so already.

Regards,


John DeVight
Telerik MVP

Re: virtual dir path by John DeVightJohn DeVight, 19 Apr 2012 17:29

Hi John,
thanks a lot for your quick reply…

in IIS I've created a virtual directory, but I don't know to wich path it has to be linked.

In the source zip I've downloaded there are different folder:

\kendouiaspnetsamples-14684\DataViz
\kendouiaspnetsamples-14684\Mobile
\kendouiaspnetsamples-14684\Web

and other folder inside…I can't publish link on this post, but if you type this in browser: softyweb it altro_catta kendo png you can see my screen shot.

I want to know the correct folder of the project to link…

Sorry for the question but I'm new with MVC…

thanks

Re: virtual dir path by Mauro CattaneoMauro Cattaneo, 19 Apr 2012 15:59

Hi Mauro,

In the TaskManager/Android/assets/www/js/taskmanager.js, I set the url for the server as:

TaskManager._server = "http://192.168.56.102/TaskManager.Mvc/Mobile";

TaskManager.Mvc is the virtual directory. Mobile is the name of the Controller.

You can change it to whatever you need it to be for your specific environment.

Hope this helps. Let me know if you have any additional questions.

Regards,


John DeVight
Telerik MVP

Re: virtual dir path by John DeVightJohn DeVight, 19 Apr 2012 15:17

Hi, I've downloaded the source code but I'm not able to create the virtual directory on IIS (on localhost).

I've created on IIS the virtual directory, but what is the path of the directoty I've to use under the virtual directory?

Thanks a lot

virtual dir path by Mauro CattaneoMauro Cattaneo, 19 Apr 2012 14:59

Glad to hear it :-)


John DeVight
Telerik MVP

by John DeVightJohn DeVight, 11 Apr 2012 19:34
page 1123...next »

Support ASP.NET Wiki

If you like this page, click on the "Share on" links in the wikidot toolbar at the top of the page to share it with your friends.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License