Posts

Showing posts from September, 2013

Java Script not working with UpdatPanel

Sample : on some database condition div has to be disable and enable To Disable Dim strScript As String strScript = "$('#divVI').attr('disabled', 'disabled');" ScriptManager.RegisterStartupScript( UpdatePanel8 , UpdatePanel8 .GetType(), Guid.NewGuid().ToString(), "<script type='text/javascript'>" & strScript & " </script>", False) Note : This code is placed in page load. This will disable the div To Enable ScriptManager.RegisterStartupScript( UpdatePanel8, UpdatePanel8.GetType() , Guid.NewGuid().ToString(), " <script type='text/javascript'> $('#divVI').removeAttr('disabled');</script>", False) Note :- Instead of page for UIControl {i.e Page Control} use Updatepanel 

Ajax Combobox and UpdatePanel issue

Recently i was working on one of my project found funny thing happening with AJAX Combobox and updatepanel. Combobox had Autopostback set to True and On selecetedIndexChanged event on combobox it was to fetch some information from backend and show it on Label control on page. Label control was placed under updatepanel. and Async Trigger control was Combobox. While testing i found SelectedIndexChanged event was triggering only for the first time. Than after nothing was happening. This was happening due Combobox was not placed inside Updatepanel. that means both control has to be placed inside updatepanel Current Sample Ajax Combobox SelectedindexChanged event fires only once. when updatepanel is used.I had situtaion where i had to disable Control on change of combobox value.Source control and Destination Control both has to be placed under update panel. HTML  <asp:UpdatePanel ID="UpdatePanel2" runat="server" updatemode="conditional">      ...

Two level Menu with CSS And UL

Image
Two level menu with CSS and UL CSS .menu > li                      /*Main Header */ {      float: left;               /* To Make all Li Align Horizontally*/      margin-left:15px;          /*Have Padding between two Menu*/      list-style: none;     } .menu ul                        /* First Level */ {     display:none;               /*Hide the First level Menu */     position: absolute;         /*Relative Positioning for first level menu so that it appear in same line of header*/       list-style-type:none;       /*Remove bullets for list*/     list-style: none;           /*Remove bullets for list*/ ...

MultiLine TextBox MaxLength Problem in asp.net

If Textbox style is set to multiline, Control will not validate for maxlength value set in property. Multiple code has to be placed to handle this problem. 1.Use JavaScript to validate on each keystroke add this to HTML tag of textbox onKeyPress="return ValidateMultiLineTextboxMaxLength(this,250);"  JS for above Call function ValidateMultiLineTextboxMaxLength(txtbox,MaxLen)  {     if (txtbox.value.length >= (MaxLen-1))      {         return false;     }     return true; } 2. This Can happen in case when Text is pasted directly into textbox. as there won't be any keystroke. So validator has to be placed

How to use Javascript alert inside AJAX UpdatePanel

Java Script to show Messagebox from Codebehind, This code will not work when same is used with Updatepanel postback. Page. ClientScript.RegisterStartupScript(this.GetType(), "winPop", "alert('Update is successful') So in order to add javascript in update panel you need to register you client script to your script manager as shown below: ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Update is successful.');",True)

AJAX Masked Edit Extender Problem

Ajax Date Control using Masked Edit Extender  while Navigating from Date Control without entering date if you move out of control.  Control will validate for input date,This happen because for _ to enter the value in control. Solution :-  using jquery remove the _ is nothing is entered in control  $(document).ready(function () {             $("#<%= txtExpDate.ClientID %>").focusout(function () {                 if ($("#<%= txtExpDate.ClientID %>").val() == "__/__/__")                  {                     $("#<%= txtExpDate.ClientID %>").val("") ;                 }             });         });