Posts

How to add items list in dropdown list using jquery - Cascading drop down

If you want to create 2 dropdown lists in which the second dropdown value will depend on the selected value from the first dropdown, you need to Implement JSON + Webservice+ JQuery. In my solution, I will use Jquery Ajax to request data from web service and add value to the second dropdown. Scenario Let say the first dropdown will list all Country, and the second dropdown will list all state from the selected country. Solution Create JSON Webservice, you can refer to this link Create custom JQuery function to handle onChange event on dropdown list country. Use return value from web services to the second dropdown items list. Full Code Example Note: The web service will use from the post here <!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>     <title></title>     <script type="text/javascript&quo

How to create JSON webservice in ASP.NET

This example will show how to create Webservice using asp.net and the result will return in format JSON ( JavaScript Object Notation ). Below is the step by step to create webservice: Open Visual studio. Create New Project Add New File in the solution and choose Web Service file( .asmx) Copy paste code below to create your own JSON webservice The Web Service Code /// <summary>     /// Summary description for KenticoJSONTest     /// </summary>     [WebService(Namespace = "http://tempuri.org/")]     [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]     [System.ComponentModel.ToolboxItem(false)]     // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.     [System.Web.Script.Services.ScriptService]     public class AjaxWebService : System.Web.Services.WebService     {         [WebMethod]         public string HelloWorld()         {             return "Hello World";         }         [WebMethod]

JQuery Height not correct

JQuery have method to get the window height : - $(window).height()  , and document height : - $(document).height() ; Problem window height and document height give the same result which is wrong. If you resize the browser , the window height  should give smaller or bigger than document height. The Full HTML Code <html> <head>   <script type='text/javascript' src='http://code.jquery.com/jquery-1.10.1.js'></script> <script type='text/javascript'>$(document).ready(function(){     $('#windowheight').text($(window).height());     $('#documentheight').text($(document).height()); }); </script> </head> <body>   <div id="result">     $(window).height() = <span id="windowheight"></span> <br/>     $(document).height() = <span id="documentheight"></span> </div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.  Sed vulpu

Print GridView Header On Each Page While On Printing : ASP.NET

Image
This example will show how you can include Table header on each page when you print the html document. You need to have the css, and javascript to do this objective. Let see the full example. The ASPX Page <!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></title>     <style type="text/css" media="print">         .hideOnPrint         {             display: none;         }     </style>     <style type="text/css">         @media print         {             th             {                 color: black;                 background-color: white;             }             THEAD             {                 display: table-header-group;                 border: solid 2px black;             }         }     </style>     <sty

Multiple select button in one gridview

Image
GridView Multiple Select Buttons this is the keyword when i used to searching in Mr. Google and end up with several link to solve this problem. This was my solution to have a multiple select button in one GridView Controller The ASPX Page   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical" Font-Names="Arial" Font-Size="12px" OnRowCommand="ActionCommand"> <Columns> <asp:BoundField DataField="ID" HeaderText="NO." /> <asp:BoundField DataField="CustomerName" HeaderText="Customer Name" /> <asp:ButtonField CommandName="showName" Text="Show Name" /> <

C#: Check if an application is already running

This is the snippet code to check if application running or not in C# using System.Diagnostics; bool IsApplicationAlreadyRunning(string processName) { Process[] processes = Process.GetProcessesByName(processName); if (processes.Length >= 1) return true; else return false; } By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

RegisterForEventValidation can only be called during Render()[SOLVED]

Today i do my routine by developing / testing / and debuggig and found error on my web page : RegisterForEventValidation can only be called during Render(); The code actually for get html code from server side inside panel ...  var sb = new StringBuilder();  Panel1.RenderControl(new HtmlTextWriter(new StringWriter(sb)));  string htmlToConvert = sb.ToString(); So i do some googling and found the causes of this error occur.. The Causes occurs when you try to render a control to Response. Generally some people got this when I exported GridView to Excel, Word, PDF or CSV formats. The ASP.Net compiler issues the above Exception since it feels the Event is invalid. Solution The solution is quite simple you need to notify ASP.Net that not to validate the event by setting the EnableEventValidation flag to FALSE You can set it in the Web.Config in the following way <pages enableEventValidation="false"></pages> This will apply to all the pages in your website. Else yo