开发者

Creating a "Mobile Adapter" for Visual Web parts in Sharepoint 2010

I've followed this guide on how to create mobile web parts in Sharepoint 2010, but no content is listed when I access the page with a mobile device, or use the "/m"-url. Are there any other sources on how to create a mobile adapter for visual web parts for Sharepoint 2010?

My adapter-class looks like this:

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint;
using Microsoft.SharePoint.MobileControls;

namespace MyProject.MyOrderList
{
   public class MyOrderListMobileAdapter : WebPartMobileAdapter
   {
    protected override void CreateControlsForDetailView()
    {
        Microsoft.SharePoint.MobileControls.SPMobileLabel lblHello = new Microsoft.SharePoint.MobileControls.SPMobileLabel();
        lblHello.Text = "Hello World. This is the Mobile version of the SharePoint web part.";
        Controls.Add(lblHello);                       
    }
  }
}

I've also added an entry to the "controlAdapters" in the "compat.browser"-file:

<adapter controlType="MyProject.MyOrderList, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=be5098001a913377" 
              开发者_StackOverflow   adapterType="MyProject.MyOrderList.MyOrderListMobileAdapter, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=be5098001a913377" />            

The safecontrol-entry looks like this:

<SafeControl Assembly="MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=be5098001a913377" Namespace="MyProject.MyOrderList" TypeName="*" Safe="True" SafeAgainstScript="False" />

Basicly I want to just create a simplified version of my visual web part without having to create a whole new web part that's just for mobile access, which is what I should be able to accomplish this adapter-method.

Thanks.


Check this out: Creating a Mobile Adapter for SharePoint 2010 http://allthingsdotnet.net/?p=603

They won't let me post more than one hyperlink, so for the next subject:

Custom VWP Not Visible in Mobile Mode use the same as above, with this as the querystring - - ?p=518

Also, there's a new application that helps create the correct syntax for the Safe Control section in the Web.Config and the Compat.Browser entry: Mobile Adapter Tool:

ma.augustwind.com


The MSDN hands on lab was pretty helpful in getting mobile web parts going.

http://msdn.microsoft.com/en-us/sharepointandwindowsphone7trainingcourse_creatingmobilewebpartslab_topic2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜