jQuery image plugin

Filed in Javascript Leave a comment

http://leandrovieira.com/projects/jquery/lightbox/#

Detecting the major browser names in javascript

Filed in Javascript Leave a comment

I found this very useful script on below website.

http://www.javascripter.net/faq/browsern.htm

Code from the above website.

Disable copy paste in textbox asp.net

Filed in .Net | Javascript Leave a comment

<asp:TextBox ID=”txtEmailAddress2″ runat=”server” MaxLength=”50″ oncut=”return false;” onpaste=”return false;” oncopy=”return false;” onkeydown=”return disableCtrlKeyCombination(event);”></asp:TextBox>

<script type=”text/javascript”>

function disableCtrlKeyCombination(e) {

key = e.which;     //firefox

if (e.ctrlKey) {

return false;

}

}

</script>

Getting values from label, hiddenfield in javascript for IE, Firefox

Filed in .Net | Javascript Leave a comment

var tot;

//Get cialis super active controls as below

var subTotals = document.getElementById(‘<%= lblSubTotals.ClientID %>’);

var promocodetype = document.getElementById(‘<%= hdnPromoCodeType.ClientID %>’);

if (document.all) {//IE

var pc = promocodetype.value;

tot = subTotals.innerText;

}

else{//Fire Fox

tot = subTotals.textContent;

}

Check at least one checkbox is selected in CheckBoxList using ASP.Net Validators

Filed in .Net | Javascript Leave a comment

I found a very good article to check that at least one chekbox is selected in a checkboxlist control. Works exactly like required field validator.

http://forums.asp.net/t/1000658.aspx (check answer from user yasserzaid)

<script type=”text/javascript”>

function ValidateRolesSelection(source, args)

{

//if your checkboxlist control is on simple asp.net page

var chkListModules = document.getElementById(‘<%= RolesCheckBoxList.ClientID %>’);

//if your checkboxlist control is inside some user control for e.g in CreateUserWizard

//var chkListModules = document.getElementById(‘<%= (CreateUserWizard1.WizardSteps[0].Controls[0].FindControl(“RolesCheckBoxList”) as CheckBoxList).ClientID %>’);

var chkListinputs = chkListModules.getElementsByTagName(“input”);

for (var i = 0; i < chkListinputs.length; i++)

{

if (chkListinputs[i].checked)

{

args.IsValid = true;

return;

}

}

args.IsValid = false;

}

</script>

Checking character/string length using .net validators

Filed in .Net | Javascript Leave a comment

I need to check character length between 9 to 24 need to be all numbers. I have applied below regular expression validator.

<asp:RegularExpressionValidator ID=”revBankAccountNo” runat=”server” ControlToValidate=”txtBankAccountNo” Display=”Dynamic” SetFocusOnError=”True” ValidationExpression=”^[0-9]{4,24}$”>*</asp:RegularExpressionValidator>

I need to check character length to be exact 9. I have applied below regular expression validator.

<asp:RegularExpressionValidator ID=”revBankAccountNo” runat=”server” ControlToValidate=”txtBankAccountNo” Display=”Dynamic” SetFocusOnError=”True” ValidationExpression=”^[0-9]{9}$”>*</asp:RegularExpressionValidator>

TOP