Wednesday 23 November 2011

Sql Adapter Parameter

Giving parameter to SQL Adapter:



as you use for-
SqlDataAdapter cmd = new SqlDataAdapter(rer, con);
        cmd.Parameters.Add("@hh", SqlDbType.VarChar).Value = ((Label)GridView1.Rows[e.RowIndex].FindControl("HAID")).Text;


just use-
SqlDataAdapter cmd = new SqlDataAdapter(rer, con);
        cmd.SelectCommand.Parameters.Add("@hh", SqlDbType.VarChar).Value = ((Label)GridView1.Rows[e.RowIndex].FindControl("HAID")).Text;



Sunday 20 November 2011

Format ur PC using pendrive


How To Format PC using Pendrive

Before You Continue you need to know that your pendrive is empty/formatted and dont do just copy WindowCD files from a folder or CD to Pen Drive.
there is software who will take care of it.

Second Thing Is You Must Know Your System Support USB Booting Or Not!
Select USB Priority First So That On Booting ,It Will USB Boot Prior to HardDisk
Now just follow below Steps...

(I am using word WindowCD which means is any of your OS CD/OS File,you can use this process for any OS )

1. Download WinSetupFromUSB and  install it.

Unable to Find : Download it From here



2.So Where You Have Your WindowCD file Have window CD?or an?ISO of it?

If you have iso file of window then you need to extract it.

3.Now Plugin your Pen Drive,run WinSetupFromUSB,
Select output as pendrive
and browse WindowFile(where you have extracted iso file or where you have saved all file of windowCD)

["Now If You Get Any Error In This Stage,Like "FAT May Cause Error" ,It Means You Must Format Your PEN DRIVE as File System NTFS (also Format Complete More Speedly In  NTFS ).

As Below Images






4. Clik GO


For XP Use Top One Browse Source..............For Vista Or Window 7 Use To Tick And Add Source Where I've Selected H:/ as My Source
5. Done.

Saturday 19 November 2011

Error 80070005


The error code 80070005 usually means that you do not have enough permission to install updates.

First please confirm you have logged on an account with administrative privileges.

If the issue still occurs, lets’ try the following method to reset the permissions:

1. Download the subinacl.msi file from the following link and save the installation patch onto the Desktop:


2. Go to the Desktop and double click the downloaded file.
3. Select the C:\Windows\System32 folder as the Destination Folder during the installation. Later we will use this tool to reset the permission settings on the current machine.



 

Note: If the UAC (User Account Control) window is prompted for permission to continue, please click Continue.

4. Click Start, in the Start Search bar, type: "notepad" (without quotes) and press Enter.
5. Copy the following commands and then paste them into the open Notepad window:

@echo off

subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f
subinacl /subdirectories %SystemDrive% /grant=administrators=f

subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=system=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=system=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=system=f
subinacl /subdirectories %SystemDrive% /grant=system=f

@Echo =========================
@Echo Finished.
@Echo =========================
@pause

6. After pasting the above commands, please close the Notepad window. Choose Save when you are prompted to save the file. Type "reset.bat" as the file name and choose Desktop from the left panel as the save location.
7. Refer to the Desktop and right click the reset.bat file, and then choose "Run as administrator."
8. You will see a DOS-like window processing.

Note: It may take several minutes. Please be patient. When it is completed, you will be prompted with the message: "Finished, press any key to continue".

Try to install the updates again.

This issue can be also caused by third-party security programs such as firewalls and anti-virus software. You can disable or remove them to check the issue.

Let us know how is goes

C# Validation for Email,Contact No and AutoText in TextBox



 Regex Validation
1)for email:

public static bool IsValidEmail(string Email)
      {
          return Regex.IsMatch(Email, @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
      }


2)for phone no:
ex. 800-555-555

^[2-9]\d{2}-\d{3}-\d{4}$ 




3)Auto text




IN ASPX
  <head runat="server">
    <title></title>
  
    <script type = "text/javascript">
        var defaultText = "Enter your text here";
        function WaterMark(txt, evt) {
            if (txt.value.length == 0 && evt.type == "blur") {
                txt.style.color = "gray";
                txt.value = defaultText;
            }
            if (txt.value == defaultText && evt.type == "focus") {
                txt.style.color = "black";
                txt.value = "";
            }
        }
</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
  
<asp:TextBox ID="TextBox1" runat="server" Text = "Enter your text here"

    ForeColor = "Gray" onblur = "WaterMark(this, event);"

    onfocus = "WaterMark(this, event);">

</asp:TextBox>

    </div>
    </form>
</body>




IN C#
 protected void Page_Load(object sender, EventArgs e)
    {
        TextBox1.Attributes.Add("onblur", "WaterMark(this, event);");

        TextBox1.Attributes.Add("onfocus", "WaterMark(this, event);");
    }















Only INTEGER/./BACKSPACE Allowed



<script language="javascript" type="text/javascript" >
        function checkForInt(evt) {
            var charCode = (evt.which) ? evt.which : event.keyCode;
            return ((charCode ==08||charCode ==46 || charCode >= 48 && charCode <= 57));
        }
     
</script>







  <asp:TextBox ID="TextBoxMax" runat="server"
                        Font-Names="Tahoma" Font-Size="9pt" Width="150px"  onkeypress="return checkForInt(event)"></asp:TextBox>





charCode ==08 allow you to use backspace too.



Quick tip Jquery validation For ASP.net Controls

JQUERY VALIDATION FOR ASP.NET CONTROLS



Jquery Blank Field Validation

if(document.getElementById("<%=CompanyNameTextBox.ClientID %>").value=="")
    {
    alert("Please Enter Company Name");
    document.getElementById("<%=CompanyNameTextBox.ClientID %>").focus();
    return false;
    }




Jquery Contact No Validation



<asp:TextBox ID="ContactNoTextBox" runat="server" onkeypress="return chklen(this);"></asp:TextBox></td>
function chknum3()
{
if((event.keyCode >=48 )&&(event.keyCode<=57))
{
alert("Branch Name Should Be In Character..");
return false;
}
else
{

return true ;
}
}



Jquery Number Length Validation



function chklen(id)
{
if  (id.value.length <11)
{
return chknum();
}
else
{
alert("Mobile Number Length should not be greater than 11 Digits::::");
return false;
}
}





Jquery Email Validation
 if(document.getElementById("<%=EmailTextBox.ClientID%>").value=="")
     {
      alert("Please Enter EMail Id....")
      return false
     }
     else
      {
      var at="@"
      var dot="."
      var str=document.getElementById("<%=EmailTextBox.ClientID%>").value;
      var lstr=str.length;
      var lat=str.indexOf(at);
      var ldot=str.indexOf(dot);
      var pat=/^.+@.+\..{2,3}$/;
 
      if(str.indexOf(at)==-1 ||str.indexOf(at)==0 ||str.indexOf(at)==lstr)
      {
      alert("Invalid Email Id.. Please Try Again..")
      return false;
      }
      if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr )
      {
      alert("Invalid Email Id.. Please Try Again..")
      return false;
      }
     }






Jquery Delete/Confirmation:
  function del()
    {
    if(confirm("Are You Sure?")==true)
    {return true;
   
        }
        else
        {
        return false;
        }
    }


onclientclick="return del()";






Jquery ToolTip:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.qtip-1.0.0-rc3.min.js"></script> 
   
   
   
    <script type="text/javascript">
// Create the tooltips only on document load
$(document).ready(function()
{
   // Notice the use of the each() method to acquire access to each elements attributes
   $('.show-tooltip').each(function()
   {
      $(this).qtip({
         content: 'be a good one', // Use the tooltip attribute of the element for the content
         style: 'dark' // Give it a crea mstyle to make it stand out
      });
   });
});
</script>


<a href="http://google.com/" class="show-tooltip" ><asp:Button ID="Button1" runat="server" Text="Love" /></a>
    



Jquery Hide and Show via flipping:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip").click(function(){
    $(".panel").slideToggle("slow");
  });
});
</script>

<style type="text/css">
p.flip
{
margin:0px;
padding:5px;
text-align:center;

border:solid 1px #c3c3c3;
}
div.panel
{
            height:163px;
        width: 1268px;
       display:none;
 <%--optional to fill color--%>background-color:Lime;
       
}
</style>



<input id="Button1" type="button" value="button" class="flip" />
<div class="panel">Anything</div>





Jquery Hide and Show via flipping:

SHORT WINDOW OPEN CLOSE
 <script type="text/javascript">  
   function closepopup()
   {
     
        window.close();
    
   }</script> 
on cs.file................................................
 string scrname;
         scrname = @"<SCRIPT language='javascript'> closepopup();" + "</SCRIPT>";
            this.RegisterStartupScript("MyAlert", scrname);










Jquery open window pop up
<script type="text/javascript">
<!--
function popup(url)
{
 var width  = 500;
 var height = 270;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=no';
 params += ', scrollbars=no';
 params += ', status=no';
 params += ', toolbar=no';
 newwin=window.open(url,'windowname5', params);
 if (window.focus) {newwin.focus()}
 return false;
}
// -->
</script>
<a href="javascript: void(0)"
   onclick="popup('addexam1.aspx')">click here to view</a>




Print Only Grid View in ASP.net

ASP.net How to Print Only GridView < div id ="gridviewDiv" >   < asp:GridView ID ="gridViewToPri...