Monday, July 12, 2010

Using C# and VB.NET classes together in the App_Code folder

Create two folders under App_Code filder named CSCode and VBCode. Move Class1.cs inside CSCode folder and Class2.vb inside VBCode folder.


Error 1 The files ‘/VBandCSharptogether/App_Code/Class2.vb’ and ‘/VBandCSharptogether/App_Code/Class1.cs’ use a
different language, which is not allowed since they need to be compiled together.


if You got error this then add this following code to web.config file


<compilation debug="true">
<codeSubDirectories>
<add directoryName="CSCode"/>
<add directoryName="VBCode"/>
</codeSubDirectories>
</compilation>

Tuesday, July 6, 2010

Compare multiple TextField through javascript

this code not allow the same text in any two text field

function comp_txt(present)
{
dml=document.forms['aspnetForm'];
var i;
var per=document.getElementById(present);
for(i=0;i {
if(per.name == dml.elements[i].name)
{
}
else if(per.value == dml.elements[i].value)
{
per.value="";
}
}
}



you can call on onChange event and pass argument id of current

text field

Only Numeric Value Allow In TextBox in JavaScript


function funi(t) {

//var t=document.getElementById(r);
if (!(t.keyCode >= 48 && t.keyCode <= 57)) {
t.keyCode = 0;
}
}

Call this like following

<input type="text" onkeypress="funi(event)"></input>