October 2008 - Posts - Web Dev And Stuff

October 2008 - Posts

I always had the question if I could add a LiteralControl via Markup code. Let's say something like that :

<div class="header">
    <asp:LiteralControl runat="server" ID="ltrHeader"></asp:LiteralControl>
</div>
<div class="sub-header">
    <asp:LiteralControl runat="server" ID="ltrSubHeader" Text="Some Text" ></asp:LiteralControl>
</div>

Well It IS possible and simple to be honest. Just Register the control at the top of the page like that :

<%@ Register Assembly="System.Web" Namespace="System.Web.UI" TagPrefix="asp" %>

You might have a warning that "Element 'LiteralControl' is not a known element." but it will compile just fine and you can set the Text programmatically!

Hope that helps anyone who wants to use a LiteralControl over Literal!

Enjoy!

How about a sneak peek  into the .NET Framework 4.0?

At Steven Martin's blog you can see about  WCF και WF improvements, Dublin etc...

More to come of course at PDC..

Yeaaaaah...!

Finally a solution!!!!!!!! How can we stream a shoutcast radio via a Silverlight application?

Well in 6 steps...

1. Open Expression Blend

2. Create a Project

3. Add a media element

4. Add the code below at the cs (or vb) file

public Page()
{
// Required to initialize variables
InitializeComponent();
this.Loaded += new RoutedEventHandler(Page_Loaded);
}

void Page_Loaded(object sender, RoutedEventArgs e)
{
try
{

myElem.Source = new Uri("http://mystation:port/;");
myElem.Play();
}
catch (Exception ex)
{

}
}

5. We put mms instead of http and at the end "/;" without the quotes

6. We hit F5 and listen our radio!!!

Enjoy!

Edit : it works with http really good but i never tried until now... So no need for mms at the beginning of the URL.

More Posts