by Ali Raza Zaidi on August 9, 2008
Use following code in you page. At Calling Statement send reference of page “this”. It Clears all text boxes and set all checkboxes on page to false
private void ClearControls(Control parent)
{
foreach (Control _ChildControl in parent.Controls)
{
if ((_ChildControl.Controls.Count > 0))
{
ClearControls(_ChildControl);
}
else
{
if (_ChildControl is TextBox)
{
((TextBox)_ChildControl).Text = string.Empty;
}
else
if (_ChildControl is CheckBox)
{
((CheckBox)_ChildControl).Checked = false;
}
}
}
}
by Ali Raza Zaidi on February 9, 2008
Hi all you can add meta tags like that in page
HtmlMeta _MyName = new HtmlMeta();
_MyName.Name =” Ali Raza”;
_MyName.Content =” just in and test “;
Page.Header.Controls.Add(_MyName);
by Ali Raza Zaidi on February 5, 2008
I used following code to get uploaded image dimensions .
Where flLogoUplaoded is name of asp .net file uploaded control at my application
string UploadedImageType = flLogoUpload.PostedFile.ContentType.ToString().ToLower();
string UploadedImageFileName = flLogoUpload.PostedFile.FileName;
//Create an image object from the uploaded file
System.Drawing.Image UploadedImage = System.Drawing.Image.FromStream(flLogoUpload.PostedFile.InputStream);
//Determine width and height of uploaded image
float UploadedImageWidth = UploadedImage.PhysicalDimension.Width;
float UploadedImageHeight = UploadedImage.PhysicalDimension.Height;
Response.Write( UploadedImageWidth + “<br />”);
Response.Write(UploadedImageHeight + “<br />”);
by Ali Raza Zaidi on December 27, 2007
One of way while transferring data from one page to other page is Querystring. But one problem is with Querystring is that many characters are not allowed in url. So we must have to send querystings while take limits in mind because alphanumeric and special characters including $-_.+!*’(),) are allowed. Usually browser does not tolerate special characters in Url, so much data is lost . In asp.net we can use the feature urlEncoding. With Url encoding special characters are replaced by escaped characters sequences starting with the percent sign (%) ,followed by a two-digit hexadecimal .The only exception is space character where character sequence %20 or + sign is used. For this purpose asp.net provide us HttpServerUtility class to encode data.
For example
String CustomerName = “Ali Raza”;
Response.Redirect(“Blogpage.aspx?authorName=” + Server.UrlEncode(CustomerName));
Same time we can Querystring s initial values from Server.UrlDecode() method.