Thursday, January 7, 2010
In ValidationSummary remove duplicate ErrorMessage
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns="http://www.w3.org/1999/xhtml" >
< head runat="server" >
< title >Untitled Page< /title >
< script type="text/javascript" >
function test()
{
Page_ClientValidate('test');
if (typeof(Page_ValidationSummaries) == "undefined")
return;
var summary, sums, s;
for (sums = 0; sums < Page_ValidationSummaries.length; sums++) {
summary = Page_ValidationSummaries[sums];
summary.style.display = "none";
if (!Page_IsValid) {
if (summary.showsummary != "False") {
summary.style.display = "";
if (typeof(summary.displaymode) != "string") {
summary.displaymode = "BulletList";
}
switch (summary.displaymode) {
case "List":
headerSep = "< br >";
first = "";
pre = "";
post = "< br >";
final = "";
break;
case "BulletList":
default:
headerSep = "";
first = "< ul >";
pre = "< li >";
post = "< /li >";
final = "< /ul >";
break;
case "SingleParagraph":
headerSep = " ";
first = "";
pre = "";
post = " ";
final = "< br >";
break;
}
s = "";
if (typeof(summary.headertext) == "string") {
s += summary.headertext + headerSep;
}
s += first;
for (i=0; i< Page_Validators.length; i++) {
if (!Page_Validators[i].isvalid && typeof(Page_Validators[i].errormessage) == "string") {
var tempstr=pre + Page_Validators[i].errormessage + post;
var isExist=s.search(tempstr);
if(isExist==-1)
s += pre + Page_Validators[i].errormessage + post;
}
}
s += final;
summary.innerHTML = s;
window.scrollTo(0,0);
var val=document.getElementById('ValidationSummary1');
val.InnnerHTML=s;
}
}
}
}
< /script >
< /head >
< body >
< form id="form1" runat="server" >
< div >
< asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="test"/ >
< asp:TextBox ID="TextBox1" runat="server" >< /asp:TextBox >
< asp:RequiredFieldValidator ControlToValidate="TextBox1" ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ValidationGroup="test" >< /asp:RequiredFieldValidator >
< br / >
< asp:TextBox ID="TextBox2" runat="server" >< /asp:TextBox >
< asp:RequiredFieldValidator ControlToValidate="TextBox2" ID="RequiredFieldValidator2" runat="server" ErrorMessage="RequiredFieldValidator" ValidationGroup="test" >< /asp:RequiredFieldValidator >
< br / >
< asp:TextBox ID="TextBox4" runat="server" >< /asp:TextBox >
< asp:RequiredFieldValidator ControlToValidate="TextBox4" ID="RequiredFieldValidator4" runat="server" ErrorMessage="RequiredFieldValidator1" ValidationGroup="test" >< /asp:RequiredFieldValidator >
< br / >
< asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="test()"/ >
< /div >
< /form >
< /body >
< /html >
Friday, June 12, 2009
System stored procedures every developer should know
Top 5 SQL System stored procedures every developer should know
There are a number of documented and undocumented system stored procedures in MS SQL Server that are helpful for every web developer working with databases. From the developer’s perspective, here’s a list of 5 System stored procedures that are my favorite.1. sp_help
Purpose
sp_help gives information about database objects. If you wanted to quickly know the structure of a table but are too lazy to look for the schema diagram or to dig for the table you are interested in within the Object explorer, sp_help is here to help
Syntax : sp_help
It can be used without parameters to get the information of objects in the database.
2. sp_helptextPurpose
sp_help gives definition information of objects such as system stored procedures, user defined stored procedures, user defined functions, triggers etc.
Syntax : p_helptext
sp_helptext
On the testdb database:
Executing a sp_helptext 'dbo.Materialsbill' yields the following definition of the user defined stored procedure
3. sp_MSforeachtablePurpose
Caution – This is an undocument stored procedure and should not be relied on. It is not listed in SQL BOL and should be used at your own risk.
This is a very useful stored procedure for executing a command for ALL the tables in the database. Say you wanted to get the number of rows in all the tables in your database, you could write:
Example : EXEC sp_MSforeachtable 'SELECT ''?'', COUNT(*) FROM ?'
EXEC sp_MSforeachtable 'SELECT ''?'', COUNT(*) FROM ?'
4. sp_depends
Purpose
Ever wanted to make a change to a table but were not sure what other objects are dependent on this table? There could be views or stored procedures that could break due to this change. In situations like this, sp_depends come to the rescue.
Syntax : sp_depends
sp_depends
In the testdb database, say I wanted to find out all the objects that are dependent on the Person.Address table.
5. sp_spaceusedPurpose
This is a simple stored procedure that gives information on the size of the database or the database objects
Syntax sp_spaceused
If it is used without parameters, it would return the database information
sp_spaceused
sp_spaceused
If it is used with a parameter, it would return the information on the object
Friday, April 24, 2009
C# and VB.NET classes uses in the App_Code folder
Add a web.config file to your web site and add the following to it:
add compilation tag in web.config file and add codeSubDirectories as it subtag in that add these two line
< directoryname="CScd">< /add >
< directoryname="VBcd">< /add >
crystal report toolbar images not display on server
\CrystalReportWebFormViewer3
2. and add these two properties
< id="CrystalReportViewer1" runat="server" autodatabind="true" hascrystallogo="False" enabledatabaselogonprompt="False" enableparameterprompt="False" grouptreeimagesfolderurl="CrystalReportWebFormViewer3/images/tree/" toolbarimagesfolderurl="CrystalReportWebFormViewer3/images/toolbar/">
3. upload CrystalReportWebFormViewer3 folder also on server
Monday, April 13, 2009
Tactics of forex trading
2. Put emotions down. Trade calm.
3. Go with the trend! Trade with the trend to maximize your chances to succeed
4. Always take a look at the time frame bigger than the one you've chosen to trade in.
5. Learn about overlapping market hours
6. Gamblers go to casino. All unproved, spontaneous actions in Forex trading — are a part of pure gambling.
7. Choose the time frame that is right for you.
8. Allow at least 2 month for demo trading.
9. Never risk more than 2-3% of the total trading account.
10. By moving a stop loss further a trader increases his chances to end up with much bigger loss.
11. create a simple but working method of trading Forex.
12. Never invest money into a real Forex account until you practice on a Forex Demo account!
Competibility level of sql server
for that just right this code in new query window and run it
sp_dbcmptlevel 'databasename'