Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

Error in Silverlight Application Property 'Xrm' is null and the Global Context is not available.

$
0
0

I have place one button in dashboards ribbon in ms dynamic crm 2011. I have created one simple silverlight application. I have successfully open this page on button click after uploading .xap and .html page in ms dynamic CRM solution. But getting error on Proceed button click which is place on silverlight page for second last line of                 

IOrganizationService myservice = SilverlightUtility.GetSoapService();:


Here is button click:

private void btnProceed_Click(object sender, RoutedEventArgs e)
        {

            foreach (var item in dataGrid1.ItemsSource)
            {
                string name = ((TextBox)dataGrid1.Columns[1].GetCellContent(item).FindName("txtName")).Text;
                string amount = ((TextBox)dataGrid1.Columns[4].GetCellContent(item).FindName("txtAmount")).Text;

                Entity entity = new Entity();
                entity.LogicalName = "new_test";
                entity.Id = new Guid();
                entity["new_name"] = name;
               
                IOrganizationService myservice = SilverlightUtility.GetSoapService();
                myservice.BeginCreate(entity, new AsyncCallback(CreateContact), myservice);

            }
}


Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; BRI/2; AskTbARS/5.14.1.20007)
Timestamp: Fri, 11 May 2012 04:18:22 UTC


Message: Unhandled Error in Silverlight Application Property 'Xrm' is null and the Global Context is not available.   at SampleExpense.SilverlightUtility.GetContext()
   at SampleExpense.SilverlightUtility.GetServerBaseUrl()
   at SampleExpense.SilverlightUtility.GetSoapService()
   at SampleExpense.MainPage.btnProceed_Click(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Line: 1
Char: 1
Code: 0
URI: https://crm5org9cf5c.crm5.dynamics.com//WebResources/new_/SampleExpenseTestPage.html

Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>