Thursday, 8 May 2014

Ajax Control Toolkit : Popup Extender in Update Panel

I was working with Ajax Control toolkit controls. Came across a bug which was "Popup not closing after data loads.". Looked into the details of the bug found out particularity of scenario. The popup was shown using Popup Extender of Ajax control toolkit, Popup is inside the Update Panel.
On button click (which is in Popup) partial page load is happening. Once getting data from server, popup was supposed to get close, But was not behaving in expected manner.
I digged a little bit here and there to fond out that after ajax call Modal popup is not calling the hide method.
So we have to call the hide method on Modal Popup Extender.

I tried calling hide() method directly in script block but it was returning "null". The reason being i was trying to find the component before component initalization. So for calling hide method after component initialization i had to call it in Sys.Application.add_load.
 <act:ModalPopupExtender ID="mpe" runat="server" TargetControlID="LinkButton1" PopupControlID="Test" BehaviorID="mpeBehavior"

<script type="text/javascript">

    Sys.Application.add_load(function () {

Thursday, 30 January 2014

Generating change scripts in SQL Server

I have seen many times that developers do modification in database using VisualDesigner and struggle later on with providing scripts to other people (in case of local server). Modifying the Table structure and similar things are tasks that should be taken seriously and it might be hard to write the code remembering all the DDL statements. Specially when we have such a nice Designer provided by Microsoft who wants to get dirty by writing the code.

How to Generate Change Script:
In SSMS(Sql Server Management Studio) goto Tools -> Options.

In popup that got opened goto Designers -> Auto Generate Change Scripts.

Select the checkbox against it and you have sucessfully configured your sql server to generate the change script automatically.

NOTE: Sql Server will not generate any change script for Drop Table. ;-)