hi, in my application i trying to implement the cache (ouput) but it is not working fine, that is it is every time getting from cache only this is my code.
<%@ OutputCache VaryByParam ="none" Location="Client" Duration="10" %>.
Code:
protected void btn_Click(object sender, EventArgs e)
{
DataView dtv;
dtv = (DataView)Cache["mycache"];
if(dtv ==null )
{
string sqry="select * from scrap";
da=new SqlDataAdapter (sqry,con);
ds=new DataSet();
da.Fill (ds);
dtv=new DataView (ds.Tables[0]);
Cache["mycache"]=dtv ;
Response.Write ("<script> alert ('from code')</script>");
}
else
{
Response.Write ("<script> alert ('from cache')</script>");
}
grd1 .DataSource =dtv;
grd1 .DataBind();