Posts

Showing posts from September, 2010

“Razor” – a new view engine for ASP.NET

Razor” – a new view engine for ASP.NET developed by Microsoft.

The new view-engine option have been working on is optimized around HTML generation using a code-focused templating approach. The codename for this new view engine is “Razor”,

Microsoft had a number of design goals when building and testing Razor, attempting to create a compact, expressive, and fluid ASP.NET view engine.

In addition, the Redmond company worked to ensure that customers would be able to leverage Razor immediately, by using their existing language and HTML skills.

Design Goals for "Razor"

Access Properties of a UserControl from other UserControl in ASP.Net Page

Few days ago I have posted an article "How To Access One UserControl from Another UserControl Using ASP.NET". When I try to find out solution for this I have got some nice articles about this issue. Rami vermula shows how to access properties of UserControl from another UserControl In asp.net.

This is really very helpful to solved my problem and immedidately me implement it in my solution.Now share for you .....

WebUserControl1.ascx
===================
This is the first UserControl on the page, from which we access the other UserControl (WebUserControl2.ascx) Properties.

Code
======

Automatic URL re-basing in the HtmlHead control

If you're using Master Pages in ASP.NET and trying to resolve <script> or <style> references in the page head, you may have run into this this show-stopper. If so, here's why it's happening, and here's an easy way to fix it.

If you've worked with ASP.NET Master Pages, you've no doubt taken advantage of automatic URL re-basing within the HtmlHead control. This bit of ASP.NET magic helps assure that a content page has access to the correct resources:

<head id="head1" runat="server">
<title>My Page</title>
<link href="css/common.css" rel="stylesheet" type="text/css" />
</head >
When you add the runat="server" attribute to the tag,

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Server Error in 'ASP.Net' Application. The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
____________________________________________________________________________

Recently I have faced this type of error on browse my application after add JavaScript method. This is the first time I have faced this issue. Newly written method is double checked by me but nothing found. Then try to find in asp.net forum now this time got the solution :).

Very silly mistake......now I have share with you.

DateTime Custom Picture Formatting

Using Picture Formats for Custom FormattingThe standard format specifiers are useful in most cases whilst still maintaining the correct style of date and time for the user's location. On some occasions however, it is necessary to have complete control over the positioning and styling of each element of date and time information.

For this, picture formats must be used. These allow an exact format to be created using any combination of elements from a DateTime.

DateTime theDate = DateTime.Parse("3 Jan 2007 21:25:30"); string result; result = theDate.ToString("d-MM-yy");//result ="3-01-07" result = theDate.ToString("HH:mm");//result ="21:25" result = theDate.ToString("h:mm tt");//result ="9:25 PM" Available Picture Formatting CodesThe above example shows several formats and the results. The full list of available formatting codes is as follows:
SpecifierDescriptionExamplesyOne-digit year. If the year cannot be sp…

How To Access One UserControl from Another UserControl Using ASP.NET

Few days ago, I need to access one UserControlfrom to another UserControl.The scenario is like,When I press a button it will assign a value from UserControl-1's TextBox to UserControl-2's TextBox. I have developed it but I made a silly mistake so that it was not working.

Now this is the time turn to google......:). Fortunately I have got almost similar solution from KaushaL PariK(MVP). Very simple.....from his solution I found out my problem....now place this here for you guys....hope that you enjoy it.

Some known tips

Missing debug menu on Visual Studio 2008

Before using Visual Studio 2010 I had usually developed application in Visual studio 2008. I don't remember, for some reason I can't find debug menu on my VS 2008. After goggling I have found the solution. I would like to share with you. It may help other guys.

Its very simple just use it:

Run "devenv /resetskippkgs" from command prompt, it will solve your problem.

"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level" in asp.net

Very recently, I have got this error message when try to browsing my developed application in asp.net. So I try to solve in many ways but failed then move to google...:). I got some nice solutions...now share with you:

This error occurs primarily out of 2 scenarios.

First scenario:

When you create an new web application using visual studio.net, it automatically creates the virtual directory and configures it as an application.

However, if you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and may get the above error. The debug information you get as mentioned above, is applicable to this scenario.