Friday, June 29, 2007

Simple ASP.NET Page Lifecycle

Here are the methods the runtime will look for when AutoEventWireup is true.

Page_PreInit
Page_Init
Page_InitComplete
Page_PreLoad
Page_Load
Page_LoadComplete
Page_DataBind
Page_SaveStateComplete
Page_PreRender
Page_PreRenderComplete
Page_Unload
Page_Error
Page_AbortTransaction
Page_CommitTransaction

Thursday, June 21, 2007

PageMethods + Static Methods in AJAX

Javascript can call code behind code, but the code behind method should be a static method and decorated with [WebMethod]

so After you call this webmethod, how do we refresh the page.. (sometimes you need to refresh the page to display the latest values after deleting a record from a grid).

Here are the steps;

1. Write javascript return method in OnClientClick of button
2. Call PageMethods.MethodName
3. Write return true in OnComplete method, this will call OnClick method of button
4. Write refresh, grid rebind methods in the server OnClick Method. This will post back and get the latest record to grid.

Wednesday, June 13, 2007

To Show Modal Popup in the page load

ModalPopupExtender.Show() in the Page_Load()

and to stop this behaviour on every page postback

1. Place it in IsPostBack==false condition
2. Place this in the updatePanel.


Grouping of rows in GridView

http://blogs.msdn.com/mattdotson/articles/541795.aspx

works well for asp:BoundField

Error : Client found response content type of 'text/html', but expected 'text/xml'

This error is from the proxy of web services

Checked the output of webservices, it returned normal text message instead of xml file. Actually it was returning "The requested security package does not exist "

All the application in the App pool returned this error,

Resolution: Had to do IISReset :-(

GridView : Fixed Headers

http://www.dotnetbips.com/articles/displayarticledetails.aspx?articleid=532

style.FixedCell
{
position: relative;
top: 0px;
}

Will work well if you dont have any divs on the header.

Error: An extender can't be in a different UpdatePanel than the control it extends

Resolution: Place the related panels and extenders together in the same place. I was placing all my extenders at the bottom of the page. Then later on, when the page evolves, I have put number of updatepanels for partial page update and modal popups. Then I have changed my behavior of placing panels and modal popups together in one place. It works and clean html code.!!

Tuesday, June 12, 2007

To Close Calendar in AJAXToolkit:CalendarExtender click

http://forums.asp.net/t/1067091.aspx?PageIndex=2

Step1: Write this in Master Page

function hideCalendar(oCalendar)
{
oCalendar.hide();
oCalendar.get_element().blur();
}

Step2: Include OnClientDateSelectionChanged="hideCalendar" in CalendarExtender AJAX

Monday, June 11, 2007

Microsoft new technologies

http://www.microsoft.com/surface
Cool future organizer / computer??

http://www.microsoft.com/silverlight/default01.aspx
Alternate to Flash

Visual Studio Orcas with System.Linq - Future development and data E/R modelling framework

Creating border around the browser window

http://www.boutell.com/newfaq/creating/windowborder.html

Tuesday, June 05, 2007

DataTable already belongs to another DataSet

DataTable dtProto = new DataTable("DtProto");
dtProto = ds.Tables[0].Copy();
dtProto.TableName="DtProto";

dsMain.Tables.Add(dtProto);