none
Custom Mobile Web Part

    Question

  • Hi All,

     I have created a simple web part. And a mobile adapter for this web part. When I deploy web part it is throwing an exception saying "

    "Server could not create MobileDemo.SharePoint.WebPartPages.MobileAdapters.VisualWebPart1MobileAdapter." I have followed all the steps dont know what is worng.

    Help is appriciated. I am attaching the code snippet .

    Here is the code snippet

    Visual Web Part Code


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

    namespace MobileDemo.VisualWebPart1
    {
        public partial class VisualWebPart1UserControl : UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                Label lbl = new Label();
                lbl.Text = "Madhura";
                this.Controls.Add(lbl);

            }
        }
    }
    ---------------------------------------------------------------

    Code for Mobile Web Part

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Web.UI.MobileControls;
     
    using Microsoft.SharePoint.MobileControls;
    using Microsoft.SharePoint.WebPartPages;
    using Microsoft.SharePoint.WebControls;

    namespace MobileDemo.SharePoint.WebPartPages.MobileAdapters
    {
        class VisualWebPart1MobileAdapter:WebPartMobileAdapter
        {
            protected override void CreateControlsForSummaryView()
            {
               
                System.Web.UI.MobileControls.Label lbl = new Label();
                lbl.Text = "Mobile";
                Controls.Add(lbl);
            }
        }
    }


    -----------------------------------------------------------------------------
    Compat.browser entries
    <adapter controlType="MobileDemo.VisualWebPart1.VisualWebPart1,MobileDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8eae676e81733fc6"
             adapterType="MobileDemo.SharePoint.WebPartPages.MobileAdapters.VisualWebPart1MobileAdapter,MobileDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8eae676e81733fc6" />

    Web.config entries
    <SafeControl Assembly="MobileDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8eae676e81733fc6" Namespace="MobileDemo.VisualWebPart1" TypeName="*" Safe="True" SafeAgainstScript="False" />

    Thanks

    Madhura

    jeudi 14 juin 2012 13:39

Toutes les réponses