Archive

Posts Tagged ‘.net’

Using Jquery Tabs with Asp.net

Jquery Tab Demo

http://stilbuero.de/jquery/tabs/#fragment-28

Jquery Tabs with asp.net

http://www.mikesdotnetting.com/Article/102/Lazy-Loading-jQuery-Tabs-with-ASP.NET

http://www.dotnetcurry.com/ShowArticle.aspx?ID=390

Dynamically Adding Tabs

http://blog.favrik.com/2009/08/11/dynamically-adding-jquery-tabs-round2/

http://www.jankoatwarpspeed.com/post/2010/01/26/dynamic-tabs-jquery.aspx

Advertisements

Download Cheatsheets – .Net, Sql Server, Php, Regular Expressions, CSS, Ajax,Javascript….

A cheat sheet or crib sheet is a concise set of notes used for quick reference.

You can download cheatsheets of various technologies like:

.Net

Actionscript

Ajax

Javascript

C#

HTML

Sql Server

CSS

JAVA

PHP

Regular Expressions

MySql

Asp/Vbscript

etc..

from

http://www.addedbytes.com/cheat-sheets/

http://www.cheat-sheets.org/

FCK Editor With Custom Validation in Asp.net

May 14, 2009 3 comments

I have to keep validation for fckeditor in my application, but then i came to know that Requiredfield Validator control of asp.net does not work with fckeditor. So I used CustomValidator control of asp.net and it worked perfectly.

You might be aware that customvalidator works in both ways. either clientsidevalidation function using javascript and servervalidate. Difference between them is servervalidate method takes server trip while in clientsidevalidation all validations fire at once without server trip.

I will be showing you both ways:

1) Using ClientValidationFunction

<script  language=”javascript” type=”text/javascript”>
function ValidateFCK(source, args) {

var fckBody = FCKeditorAPI.GetInstance(‘<%=FCKeditor1.ClientID %>’);
args.IsValid = fckBody.GetXHTML(true) != “”;
}
</script>

<FCKeditorV2:FCKeditor  ID=”FCKeditor1″ BasePath=”../fckeditor/” runat=”server”>
</FCKeditorV2:FCKeditor>

<asp:CustomValidator runat=”server” ErrorMessage=”Please Enter Description” ID=”CustValDesc” ControlToValidate=”FCKeditor1″
ClientValidationFunction=”ValidateFCK” ValidateEmptyText=”True”></asp:CustomValidator>

Note: Sometimes this method does not works with multiple browsers.

2) Using OnServerValidate

<FCKeditorV2:FCKeditor  ID=”FCKeditor1″ BasePath=”../fckeditor/” runat=”server”>
</FCKeditorV2:FCKeditor>

<asp:CustomValidator runat=”server” ErrorMessage=”Please Enter Description” ID=”CustValDesc” ControlToValidate=”FCKeditor1″
ValidateEmptyText=”True”
onservervalidate=”CustValDesc_ServerValidate”></asp:CustomValidator>

protected void CustValDesc_ServerValidate(object source, ServerValidateEventArgs args)
{
if (FCKeditor1.Value == string.Empty )
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}

Note:

Whenever you are submitting form and you have kept validations, always check whether the page is valid or not by:

if (Page.IsValid)
{

//your code

}

I also found some other method which works for Requiredfield validator with fckeditor is

EnableClientScript=”false” and

InitialValue=”<br/>”

<asp:RequiredFieldValidator ID=”req_Description” runat=”server” ControlToValidate=”FCKeditor1″
Display=”Dynamic”  InitialValue=”<br/>” Text=”Please Enter Description”
EnableClientScript=”false”></asp:RequiredFieldValidator>