Archive for the ‘General’ Category

Redirect page with out flickering in donnet

October 29, 2009
Redirecting from one page to another will get postback flicker. If use the following code it will not get flicker.
 
 
<script type=”text/javascript”>
function DoAsyncRequest(){

ajaxObj.Open(

var ajaxObj = new ActiveXObject(“Microsoft.XMLHTTP”); “POST”, “http://localhost:5924/Charts/default.aspx”, false); //ajaxObj.Open(“POST”, “http://www.microsoft.com”, false);
 
 

ajaxObj.SetRequestHeader(
ajaxObj.Send();
{
document.write(ajaxObj.responseText);
}

}

“Content-Type”, “application/x-www-form-urlencoded”); if (ajaxObj.status == 200)

 

</
script>
// Code behind

 

Button2.OnClientClick =
“javascript:DoAsyncRequest();return false;”;

 

 

Assign a value to a textbox which is in password mode

August 20, 2008

Assign a value to a textbox which is in password mode
[ Assign password value to a text box]
 txtPassword.Attributes.Add(“value”, password);

Avoid duplicate insertion while page refresh

August 18, 2008

 

 Whenever you insert one record and after that if u click on refresh, again the same record insert once again. To avoid that we can use the following code in page load. And whereever u want simply u can use
if (!isrefresh){ }

 

 

 

 

if (Session["postid"] != null && ViewState["postid"] != null)

{

if (ViewState["postid"].ToString() != Session["postid"

].ToString()) 
 

 

 

IsPageRefresh =
 

 

true;
}
Session["postid"] = System.Guid.NewGuid().ToString();
ViewState["postid"] = Session["postid"];