Archive for January, 2008

Validation problem in update panel

January 12, 2008

ASP.NET AJAX provides new APIs for registering script with the ScriptManager. Using these APIs allows controls to work well with partial rendering. Without them, controls placed inside an UpdatePanel won’t work as expected. In previous CTP releases of ASP.NET AJAX, we had a set of validator controls that derived from the v2.0 controls and used the new APIs. This made them work well with ASP.NET AJAX. WindowsUpdate will soon include a version of System.Web that can take advantage of the new APIs. So the new controls which would have been redundant have been removed. However, the update isn’t available yet and ASP.NET AJAX has been released. So, in the short-term, the source code for a set of custom validator controls that work with partial rendering is available here.

The .zip file includes a solution and .csproj file as well as the compiled DLL. Just put the DLL in the /bin directory of your application and include the following <tagMapping section in the pages section of the web.config.

Call javascript method on every server side call start and finish(Generic Progress Indicator)

January 11, 2008

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);function EndRequestHandler(sender, args){     var PopUp = $find(‘BGenericIndicatorPopUp’);     PopUp.hide();     document.getElementById(‘testdiv’).style.display = “none”

}

————-

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandler); function beginRequestHandler(sender, args){                        var StatusMessage = document.getElementById(‘<%=labelMessage.ClientID %>’);             document.getElementById(‘testdiv’).style.display = “”;                         var PopUp = $find(‘BGenericIndicatorPopUp’);            if(PopUp != null)                  {                          PopUp.show();                          StatusMessage.innerHTML =“Please wait…”;                  }              else                  {                      alert(‘Modal Pop Up not Found’);                  } 

}

   <ajaxToolkit:ModalPopupExtender ID=”GenericIndicatorPopUp” BehaviorID= “BGenericIndicatorPopUp”  runat=”server” TargetControlID=”HiddenButtonGenericIndicator”        PopupControlID=”panelGenericIndicator” Drag=”true”         X=”800″ Y=”90″ /> 

————————————

 <asp:Panel ID=”panelGenericIndicator” runat=”server” BackColor=”Transparent” Height=”135px” Width=”231px”>        <div id=”testdiv” style=”width: 156px; height: 70px”>                    <asp:Image ID=”imageProgress” runat=”server” Height=”21px” ImageUrl=”~/Lab/Lab_Images/ajax-loader.gif”                        Width=”148px” /><br />                    <div style=”padding-left: 50px; width: 136px; height: 19px”>                        <asp:Label ID=”labelMessage” runat=”server”></asp:Label></div>        </div>                </asp:Panel> ———————————-<div id=”DIV1″ style=”width: 576px; display: none; visibility: hidden;”>     <asp:Button ID=”HiddenButtonGenericIndicator” runat=”server” Text=”hiddenbuttonGenericPopUp” /></div>