Wednesday, October 21, 2009

Dotnet Nuke

Recently started working on Dotnet Nuke CMS.
DotNetNuke provides extensive functionality out-of-the-box to create rich, functional and easy to use web sites. The content management system allows non-technical users to create and edit content, add custom features and personalize the site look and feel. It can be further expanded with addition of third party modules and tailored with custom graphics and layouts in a form of skins.
The DotNetNuke Corporation provides a free, open-source version of DotNetNuke called the Community Edition. It includes access to the source code of the entire framework and basic modules, and a BSD-style license [3] allowing very flexible modification and distribution rights.

Wednesday, June 24, 2009

Disabling an ASP.Net Validators through Javascript

If you want disable the asp.net validator through javascript then use below code.

function doSomething()
{
var myVal = document.getElementById('myValidatorClientID');
ValidatorEnable(myVal, false);
}

Tuesday, May 19, 2009

Access MasterPage ScriptManager from a Content Page

You probably know that each ASP.NET Ajax page MUST have ONLY ONE ScriptManager control.
No more, no less.

If you try to add more than one ScriptManager to ASP.NET page you will receive error:
"Only one instance of a ScriptManager can be added to the page."

Because of this, its common (and recommended) practice to use this approach:
Create MasterPage, and place ScriptManager control on it and then use this instance on each of ContentPages.

here is the code that you can place on your ContentPage to retrieve an instance of ScriptManager from MasterPage:


ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);

Tuesday, May 5, 2009

Highlight or BOLD a single item in a drop down list Asp.Net


Highlight or BOLD a single item in a drop down list in Html we can do using optgroup tag.


Coming to Asp.Net drop down we don't have any option like this.I found one control which can accomplish our task in Asp.Net.

You can get this from Click here

Thursday, April 23, 2009

Captilizing the first letter of all words in a sentence.

We need to capitalize the first letters of some word or some text (for example when we want to display users name or city name etc).
Since string class does not have a method to do this we could think that there is no built-in solution in C# for this problem...

But a little digging trough MSDN would help us find ToTitleCase method of TextInfo class in System.Globalization namespace that does exactly what we need: capitalizes the first letter of each word in the string.

here is how to use it:

using System.Globalization;

TextInfo UsaTextInfo = new CultureInfo("en-US", false).TextInfo;

string capitalized = UsaTextInfo.ToTitleCase("asp.net simply rocks!!!");


After the execution, capitalized string would have this value:
"Asp.Net Simply Rocks!!!".

Monday, April 20, 2009

Using body onload with ASP.net MasterPages

we want to use body onload tag in master pages but it will have effect other content pages.The onload function is for only one content page.for this purpose we have used below code in master page.
Master Page :
<script language="javascript">
function masterpage_onload()
{
if(window.content_onload != null)
window.content_onload();
//this condition check whether the rendered page has function are not.

}
</script>

Content Page :

<script language="javascript">
function content_onload()
{
//do something
}
</script>

Friday, March 13, 2009

Disable a button control during postback.

This example is a non-AJAX solution.

The trick is to use the OnClientClick and UseSubmitBehavior properties of the button control. There are other methods, involving code on the server side to add attributes, but I think the simplicity of doing it this way is much more attractive:

<asp:Button runat="server" ID="BtnSubmit"
OnClientClick="this.disabled = true; this.value = 'Submitting...';"
UseSubmitBehavior="false"
OnClick="BtnSubmit_Click"
Text="Submit Me!" />


OnClientClick allows you to add client side OnClick script. In this case, the JavaScript will disable the button element and change its text value to a progress message. When the postback completes, the newly rendered page will revert the button back its initial state without any additional work.

The one pitfall that comes with disabling a submit button on the client side is that it will cancel the browser’s submit, and thus the postback. Setting the UseSubmitBehavior property to false tells .NET to inject the necessary client script to fire the postback anyway, instead of relying on the browser’s form submission behavior.