Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/chridpkm/chrisrios.com/wp-includes/functions.php on line 6114
c# Archives - Christian Rios' Blog

jQuery Star Rating Plugin Web Method Call with ASP.Net

I started playing with the jQuery Star Rating Plugin v3.14. But, I could not really find a good way to make web method calls or a decent write up of how to use it with ASP.Net.

So, I added auto-submit-star to the markup for it to make the callback, added runat=”server”, and a hidden field with the record id.

<input name="star1" type="radio" class="auto-submit-star" runat="server">
<input name="star1" type="radio" class="auto-submit-star" runat="server">
<input name="star1" type="radio" class="auto-submit-star" runat="server">
<input name="star1" type="radio" class="auto-submit-star" runat="server">
<input name="star1" type="radio" class="auto-submit-star" runat="server">
<asp:HiddenValue id="hfRatingID" runat="server"/> 

After that, added the following script that performs the jQuery Web Method call

$(".auto-submit-star").rating({ callback: function (a, b) { 
PageMethods.RateIt( $(this).siblings('input[id*="hfRatingID"]').val(), a) 
}})

Then makes web method call to a static class in code behind

[System.Web.Services.WebMethod()]
[System.Web.Script.Services.ScriptMethod()]
public static void RateIt(int id, string value) // Method have to be static { 
// Make call to update DB rating value 
}

Now you should be able to make an asynchronous call for users to rate an item. Hope this helps.

Simple way to customize pushpins in Bing Maps for WP7

Having trouble finding a quick and simple way to customize and add images to pushpins? I came up with the following.

The stardard pushpin looks pretty bad, as you can see, it is just a black square with a pointing arrow.

The easiest way to get rid of it is to set the template of your pushpin to null.

Pushpin myPushpin = new Pushpin();
myPushpin.Template = null;

Continue reading “Simple way to customize pushpins in Bing Maps for WP7”

Open Websites and Emails from a Windows Phone 7 Silverlight App

First,  make sure to reference the Microsoft.Phone.Tasks Library

In your XAML you can add a HyperlinkButton with a click even like this:

<HyperlinkButton x:Name="Email" Content="email@domain.com" Click="Email_Click"/>

Then use the EmailComposeTask class to bring up the mail client.

private void Email_Click(object sender, RoutedEventArgs e)
{
EmailComposeTask email = new EmailComposeTask();
email.To = "email@domain.com";
email.Subject = "Thanks";
email.Show();
}

In a similar manner, you instantiate WebBrowserTask to bring up the browser with the provided link

private void MyBlog_Click(object sender, RoutedEventArgs e)
{
WebBrowserTask web = new WebBrowserTask();
web.URL = "http://chrisrios.com";
web.Show();
}

Continue reading “Open Websites and Emails from a Windows Phone 7 Silverlight App”