private void MyFunction()
{
string strFilePath = "http://localhost/images/myimage.jpg";
Uri filePath = new Uri(strFilePath );
if()
{
// File Exists..
}
else
{
// File Does not Exists..
}
}
bool remoteFileExists(string addressOfFile)
{
try
{
HttpWebRequest request = WebRequest.Create(addressOfFile) as HttpWebRequest;
request.Method = "HEAD";
request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
return (response.StatusCode == HttpStatusCode.OK);
}
catch(WebException wex)
{
return false;
}
}
Friday, September 24, 2010
Thursday, September 23, 2010
Lightbox won't work after updatepanel reloads
If you control is in an UpdatePanel you need to reinitialize lightbox after your asyncpostback.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//Normal page load logic here..
}
else
{
//Reinitialize lightbox on postback.
ScriptManager.RegisterStartupScript(Page, typeof(Page), "init", "initLightbox();", true);
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//Normal page load logic here..
}
else
{
//Reinitialize lightbox on postback.
ScriptManager.RegisterStartupScript(Page, typeof(Page), "init", "initLightbox();", true);
}
}
Subscribe to:
Posts (Atom)