August 2008 - Posts - Web Dev And Stuff

August 2008 - Posts

Just a few hours ago the 1.2 version of the ultimate web development tool, Firebug , has been released. Several improvements and bug fixes come with this release. You can find more at John's post.

Update NOW!!!!

When I want to add a user control to a page I use the @Register directive at the top of the page. and the I add the control to the markup. But what if I want to add a user control programmatically but I have no reference of it via the markup? That is where the @Reference directive comes to action.

What's the story?

We have a user control with the name myUserControl.aspx

1

We add at the top of the page the control we want to programmatically add like this...

2

And finally the controls is being added to the page like this...

3

In general, when we declare a control in the page layout we use @Register and when we create the control programmatically we use @Reference.

That's it ...

kick it on DotNetKicks.com

Yesterday .NET SP1 released and many new features for ASP.NET where added. But yesterday i also discovered a feature that ASP.NET has from version 2.0

Let's say we have a button. We can decide what value will the properties have for different browsers!!! And we can do that with this way...

<asp:Button ie:Text="IEText" runat="server" mozilla:Text="FFText" />

The result in IE will be a button with IEText and in Firefox FFText.

Capture

The above works with all properties like OnClientClick!

This could be useful i.e. at file upload control where each browser handles different the rendering of the tag.

Cool eh?

kick it on DotNetKicks.com

 

Many times when i develop a user control i have the need to add some javascript to the header of the page. But the header doesn't have a method where you can add script and RegisterStartupScript inserts the script at the bottom of the page.

So i thought let's create an extension method...

This is how this method can be used for inserting javascript tags to a page's header...

Without the script tags....

And not only javascript but custom css files, meta tags etc...

That's it! Javascript, css files, meta tags and anything else can be inserted to the header dynamically!!

Enjoy...

 

kick it on DotNetKicks.com
More Posts