Monday, 16 January 2012

Increase Image Size in onmouseover and onmouseout

Question:-How to Increase Image Size in onmouseover and onmouseout ?

Answer:-
<img id ="imageID" src ="http://www.dialurdoctor.com/images/DialURDoctor_logo.png" />

<script type ="text/javascript" >
   var image = document.getElementById('imageID'),
    imageWidth = image.width,
    imageHeight = image.height;
   image.onmouseover = function() {
            image.width = 2.0 * imageWidth;
            image.height = 2.0 * imageHeight;
        }
        image.onmouseout = function() {
            image.width = imageWidth;
            image.height = imageHeight;
        }
 </script>

How to retrive multiple Records with Store Procedure Using Asp.Net

Question:- How to Retrieve Multiple Records with Store Procedure using Asp.Net
Answer:-
       using System.Data.SqlClient;

      string conn = "U R Connection";
        SqlConnection con = new SqlConnection(conn);
        SqlCommand cmd = new SqlCommand("Sp_name",con);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = cmd;
         DataSet ds = new DataSet();
        da.Fill(ds);

Thursday, 12 January 2012

How to Change Database Password of Sql Server

Question:-How to Change Database Password of Sql Server


Answer:-
Query:- sp_password  'old_pwd','new_pwd','Loginname'

Tuesday, 10 January 2012

How to show values from 2 fields in a single Text in an asp.net GridView

Question:-How to show values form two fields in a single Text in an asp.net GridView


Answer:-
Text ='<%#String.Format ("{0}{1}",Eval("colname1"),Eval("colname2"))%>'

OutPut:- colname1colname2

Monday, 2 January 2012

Logout code in Asp.net using Session

Question:-How to Logout from page with Session


Answer:-
write following code in page load event 
Response.Cache.SetNoStore();

write following code in Under Logout Button
 
        Session.Abandon();
        System.Web.Security.FormsAuthentication.SignOut();
        Session.Contents.RemoveAll();

       Response.Redirect("login.aspx");

Sunday, 1 January 2012

DownLoad File in Asp.net

Question:-Download File From website in Asp.net

Answer:-

Using System.IO;

string FileName="example.jpg";

System.IO.FileInfo  fi=new FileInfo(Server.MapPath(ResolveUrl("~/path/")+FileName));
Response.Clear();
Response.AddHeader("Content-Disposition","attachment;filename= \""+fi+"\"");
Response.AddHeader("Content-Length",fi.Length.ToString());
Response.ContentType="application/octet-stream";
Response.WriteFile(fi.FullName);
Response.End();