Posts

Solution for HTTP Error 500.19 - Internal Server Error

Error Message: HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. Detailed Error Information Module IIS Web Core Notification BeginRequest Handler Not yet determined Error Code 0x80070021 Config Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false". Config File \\?\C:\inetpub\wwwroot\web.config Requested URL http://localhost:8081/ Physical Path C:\inetpub\wwwroot\ Logon Method Not yet determined Logon User Not yet determined Config Source 144: </modules> 145: <handlers> 146: <remove name="WebServiceHandlerFactory-Integrated"/> Reason: ERROR CODE: 0x80070021 is ERROR_LOCK_VIOLATI

Enable disable all buttons of html form using Jquery

To enable disable all the buttons of html form needs to write lots of code in JavaScript. In JavaScript first we need to find all input elements which having input type submit and store it in array. After storing elements in array needs to loop that array and disable or enable element one by one. Instead of writing lots of code we can use JQuery one line code as follows $('input[type=submit']).attr('disabled',true); The above JQuery code will disable all input elements which having type submit. Happy coding...............

Get value of dropdownlist or html select using Jquery

In Jquery, you need to write one line code to get value of dropdownlist. You can use following code to get value of selected option Var selectvalue=$('#urid').val(); You can use following code to get text of selected option Var selecttext=$('#urid').text(); you are done......   Happy coding...........

Insert Update & Delete using Linq to sql classes

I have learnt last week Linq to sql and i amazed by its features.I would like to share my knowledge with you.To insert,update and delete you need to write lesser amount of code hence it saves development time. Following is the step you need to follow in order to insert,update and delete data of database using Linq to sql in Asp.Net. Open Visual Studio 2008, Click File >Website and choose ASP.Net Website. Choose the language of your choice and name your website according to your need. In solution explorer, right the project and select “Add New Item”. Select “LINQ to SQL classes” as shown in below figure. I have named it as DataClasses1. This will add an EmployeeInfo.dbml file inside “App_Code” folder.    In Visual Studio,   DataClasses1.dbml will have 2 panes. The left pane is for deigning the data objects and the right pane can be used for creating methods that operates on the data objects.The Visual Studio toolbar will contain a new toolbar for designing LINQ to SQL obje

Get LINQ to SQL results into a DataTable in asp.net

Linq to sql is a microsofts powerful tool to develop critical application faster.In Linq to sql the query result is in Generic list of generic  ienumerable type.  If you want result set in DataTable you need to convert this generic list result into datatable. To convert LINQ to SQL results into a DataTable use following Code DataClassesDataContext dc=new DataClassesDataContext(); var results = dc.products.ToList(); DataTable dt = new DataTable(); List<product> lst = results; PropertyInfo[] props= typeof(product).GetProperties(); foreach (var prop in props) { dt.Columns.Add(prop.Name); } foreach (var item in lst) { var rowa = new object[props.Length]; for (int i = 0; i < props.Length; i++) { rowa[i] = props[i].GetValue(item, null); } dt.Rows.Add(rowa); } Gr

Add Comma automatically while entering amounts in textbox using Javascript

Use following JavaScript function to add comma in numeric input in textbox function Comma(Num) { Num += ''; Num = Num.replace(/,/g, ''); x = Num.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d)((\d)(\d{2}?)+)$/; while (rgx.test(x1)) x1 = x1.replace(rgx, '$1' + ',' + '$2'); return x1 + x2; } Use following event of input textbox to call above function onkeyup = "javascript:this.value=Comma(this.value);"

Restore the lost focus of Auto post back controls in asp.net update Panel control

Problem: We put  autopostback controls like textbox, DropDownList controls inside in update panel to reducing the flickering of the Page.but when user uses tab for entering the details  the focus of the control losts. Web site users who prefer to use keyboard need to use mouse to activate appropriate input box or press TAB multiple times. Solution: Step 1: Save following in js file give any name to it (like MyUpdatePanelFocus.js ) var lastFocusedControlId = ""; function focusHandler(e) { document.activeElement = e.originalTarget; } function appInit() { if (typeof (window.addEventListener) !== "undefined") { window.addEventListener("focus", focusHandler, true); } Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler); Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoadedHandler); } function pageLoadingHandler(sender, args) { lastFocusedControlId = typeof (document.acti

Prompt user before navigate away from current page where user typed some text using javascript

In your application suppose user putting the data, then user accidently click the outside link or clode button of browser. In this situation user may loose his entered data. To avoid this we can propmt user about his unsaved data by using symple javascript code. This code will prompt the user about unsaved data in current page. following is the javascript code snippet  <html> <head> <title>window.onbeforeunload example</title> <script type="text/javascript"> var unsaved = false; window.onbeforeunload = function() { if (unsaved) { return "You have unsaved data. Are you sure you wish to leave this page."; } }; </script> </head> <body> <input type="text" id="input1" onkeydown="unsaved = true;"/> <input type="submit" id="input1" onclick="unsaved = true;"/> </body> </html> Try your self and let me know your c

Send bulk Email in asp.net using excel file

When you want to send the mail to multiple person email id and your data exists in the excel file like email address and his name. you can accomplish this task using asp.net and c#. In C# under System.Net.Mail and System.Net  namespace you can use classes which can help us to send mail effortlessly. I am giving some sample code to understand the concept Following is aspx design Page Sample < %@ Page Language =" C# " AutoEventWireup =" true " CodeFile =" LogDatails.aspx.cs " Inherits =" LogDatails " % > < !DOCTYPE html PUBLIC " -//W3C//DTD XHTML 1.0 Transitional//EN " " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " > < html xmlns =" http://www.w3.org/1999/xhtml " > < head runat =" server " > < title > Untitled Page < / title > < / head > < body > < form id =" form1 " runat =" server " >

404 error on report viewer contorol in asp .net while hosting on IIS 7 issue solved

If you are facing the problem rendering report viewer elements while loading the report viewer on browser  Why it happens? The answer is IIS7 Handler Mappings does not contain Reserved.ReportViewerWebControl.axd httpHandler, and therefore unable to render the ReportViewer elements needed by the JavaSript.  What is the Solution? Open  Internet Information Services (IIS) Manager  and select your Web application. Under  IIS  area, double-click on  Handler Mappings  icon. At the  Action  pane on your right, click on  Add Managed Handler . At the  Add Managed Handler  dialog, enter the following: Request path:  Reserved.ReportViewerWebControl.axd Type:  Microsoft.Reporting.WebForms.HttpHandler Name:  Reserved-ReportViewerWebControl-axd Click  OK . What happens to your web application after you do above setting in IIS ? Reserved-ReportViewerWebControl-axd handler is now added to your Handler Mappings list. Notice that the following line has also been added to your