Uncategorized

Multiline in LinkLabel Control

tarihinde yayınlandı

LinkLabel control doesn’t have a property named “Multiline” perhaps but there’s a similar behaviour that does the job: “MaximumSize”

You just need to assign a number of characters allowed in a line:

linklabel

Set it to a number and it will show as Multiline.

Sharepoint 2013

Problem and Solution : Dynamic operations can only be performed in homogenous AppDomain.

tarihinde yayınlandı

If u have ever used “dynamic” keyword in your webpart code,its 100% possibility you will meet this error.

Its because using dynamic operation in same appdomain as sharepoint is not supported in new LegacyCASModel.

So heres a workaround i did to make it work:

if you wrote a timerjob, edit owstimer.config otherwise edit web.config:

Instead of this:
<trust level=”Full” originUrl=”” legacyCasModel=”true” />

Use this:
<trust level=”Full”  />

and add this to <configuration><runtime>:
<NetFx40_LegacySecurityPolicy enabled=”false”/>

Hope it helps

Sharepoint 2013

Get Yahoo Weather and Parse it in C#

tarihinde yayınlandı

Here’s a code i wrote for a sharepoint 2013 visual webpart which retrieves Istanbul’s temperature and condition text from Yahoo Weather (YQL) in JSON format and parsing.


string results = "";
using (WebClient wc = new WebClient())
{
results = wc.DownloadString("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%3D2344116&format=json");
}

dynamic jo = JObject.Parse(results);
var items = jo.query.results.channel.item.condition;
var code = items.code;
var temp = items.temp;
var text = items.text;

Console.WriteLine(code + " - " + temp + " - " + text);

Console.Read();