This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Friday, May 17, 2013

How to hid div while click the check box using jquery

Its very useful while click the checkbox the onclick funcation called jquery that hidden value used div will be open while checkbox checked. Uncheck the checkbox the div will be hid.
<input type="checkbox" id="ChangePassword" onclick = "DisplayChangePasswordField();"/>
<input type="hidden" id="hidChangePassword" name="hidChangePassword" value="0" />
<div id="divchangepassword">
you can hid this div while clicking the checkbox.
</div>
$(document).ready(function () {
$("#divchangepassword").hide();
});
function DisplayChangePasswordField() {
var hideValue = $("#hidChangePassword").val();
var newHideValue = 0;

if (hideValue == 0) {
newHideValue = 1;
}
else {
newHideValue = 0;
}
if (newHideValue == 0) {
$("#divchangepassword").hide();
}
else {
$("#divchangepassword").show();
}
$("#hidChangePassword").val(newHideValue);
return false;

}

How to handle 404 Server side error in .net

 

This server side error usually will be come, when we give the wrong URL. now how we can handle the in your .net application. That time we will show the custom error message. like this create one 404.aspx page in your own way to display that error message using HTML. Next this method is URLRewriter. we can get the error response then response is Empty you can redirect to 404.aspx page.
public void context_BeginRequest(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;

if (HttpContext.Current.Request.Url.ToString().Contains("Redirect.aspx"))
{
if (context.Request.QueryString["key"] != null)
{
string inputStr = context.Request.QueryString["key"].ToString();

if (inputStr != "none/")
{
if (inputStr.EndsWith("/"))
{
inputStr = inputStr.Substring(0, inputStr.Length - 1);
}

HttpContext.Current.RewritePath(Helper.GetRedirectPage(inputStr), false);
}
}
else
{
HttpContext.Current.RewritePath("~/Server_Error/404.aspx", false);
}
}
}
and another one way to handle this error message. simply we can wrote in your web.config file like this...
<customErrors mode="On">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="~/Server_Error/404.aspx"/>
</customErrors>

Check image height & width in pixel during uploading image using File Upload Control.

You can check the size, height and width of image and do some restriction during file upload. Include System.Drawing namespace for this.Here ImageUploader is the File Upload Control.

//********* Chcek Image Size ************
Bitmap img = new Bitmap(ImageUploader.PostedFile.InputStream, false);
int height = img.Height;
// get the height of image in pixel.
int width = img.Width;
// get the width of image in pixel.
int fileSize = (ImageUploader.PostedFile.ContentLength) / 1024;
//get the size of image file.
if (height >= 500 && width >= 500 && fileSize > 500)
{
lblErrorMessage.BackColor = Color.Red;
lblErrorMessage.ForeColor = Color.Black;
lblErrorMessage.Text = "File size not be exceed than 500 KB,500x500 px";
return;
}

//*************** End of Block *****************

GridView With Scrollbar in Asp.net

 
Gridview have not Scrollbar property so you have to use two things to achieve this

1 Div Tag

<div id="scrollP" style="overflow:scroll;height:100px;
width:200px;">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>

2 Panel control

<asp:Panel ID="Panel1" ScrollBars="Both" runat="server" Width="220px">
<asp:GridView ID="GridView1" runat="server"
</asp:GridView>
</asp:Panel>