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>

ClickOnce application installed path

Filed in ClickOnce Leave a comment

The path of the ClickOnce installed application is sort of hidden. Below is the sample path;

C:\Documents and Settings\USERNAME\Local Settings\Apps\2.0\OZNAN8K7.K0W\P7TP6M3R.WZ4\AppDllName…..WEREWC.334

USERNAME: Is the logged user name.

The second last and third last folder name differ from machine to machine but sort of garbage name.

AppDllName…..WEREWC.334: Last folder name start from application dll name then “…” and then again some garbage.

Mailbox unavailable. The server response was: 5.7.1 Client does not have permission to send as this sender

Filed in .Net Leave a comment

I got this error when I am trying to send mail using System.Net.Mail. I got this error because our exchange server does not relay those emails in which From Address and Reply To Address are different. I have a requirement that both need to be different, for this network administrator must need to allow this thing in exchange server.

Encryption not supported on SQL Server – Error Message

Filed in SQL Leave a comment

I have got this error message when I am trying to import Integration Service package which I previously created on some other machine and have exported it to a file. Below link really help me in resolving the problem because I am using this Integration service first time.

Solution form the above link:

Roro: If you installed your SQL Server 2005 as an named instance with a default SQL Server 2000 on the machine, you might need to change the SSIS configuration file to point the MSDB to the right instance. After changing the configuration file, you need to restart the SSIS service.

Ailuz: To Add to Roro

Edit the config file MsDtsSrvr.ini.xml in C:\Program Files\Microsoft SQL Server\90\DTS\Binn as follwos:

=====================================
<?xml version=”1.0″ encoding=”utf-8″?>
<DtsServiceConfiguration xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“>
<StopExecutingPackagesOnShutdown>true</StopExecutingPackagesOnShutdown>
<TopLevelFolders>
<Folder xsi:type=”SqlServerFolder”>
<Name>MSDB</Name>
<ServerName>SQL_2K5_SERVER_NAME\INSTANCENAME</ServerName>
</Folder>
<Folder xsi:type=”FileSystemFolder”>
<Name>File System</Name>
<StorePath>..\Packages</StorePath>
</Folder>
</TopLevelFolders>
</DtsServiceConfiguration>
===============================

The original value for <ServerName> is just a dot (.)

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