Saturday, September 19, 2009

ASP.NET AJAX

  1. Create a ScriptManager and UpdatePanel. An UpdatePanel can be inside an UpdatePanel
  2. I've 2 independent UpdatePanel in a page. 1 UpdatePanel has a Label and Button other has a Button
  3. Let the 2 button's event update the Label.
  4. What should I do to make sure that the second Update Panel's button click to not to update the Label and what should I do to make sure that the second Update Panel's button click to update the Label

Don't get confused by how the debug behaves, even if the event is hit, it doesn't mean the value will get updated. The Ajax behavior is not very well integrated in the IDE.

Let the page mentioned above consumes a user control. Drag a ScriptManager into the UserControl. Now run the application and see what happens.

The Ajax Control Toolkit has a lot of extender controls. Extender means it extends or works with the traditional ASP.NET Controls

UserControl

  1. Create a user control which has a Label and Textbox
  2. Consume that UserControl in a page
  3. Try to set the Label and TextBox values by using UserControl.Controls approach
  4. How easy it will be if we can expose setting and getting of the controls inside UserControl through property?

UserControl does not have some events which a Page have. Do you know what events are not supported in UserControl?

3-Tier

  1. Create a simple web-site and use SQL DataSource directly in the aspx page, create a GridView and populate some data
  2. Now remove the SQL Datasource and create a class call it DAL which does the SQL calling and get the DataSet. Sonsume that class's method in aspx to do DataBind
  3. Now try to create a Business Entity and hydrate the Business Entity in the DAL and pass it to the aspx using a dummy Business Layer Class

Kudos you've created a 3-Tier Application

Event Delegate

I've been into training freshers in my account for the past 1 year. The best way to learn programming is to do some stuffs or see how an experienced professional is doing it. I just hate ppts, most ppl will be sleeping.

Here I'm presenting some case studies which can be used to understand both OOPs and .NET Concepts.

Create a Console application which has a class, which has a method that accepts 2 integers and outputs the sum, the class also has a property which computes the cumulative sum, i.e, if you first call sum(1,3) and then call sum(5,6), the cumulative sum is 15. The class should raise an event when the cumulative sum is > 20 (and then reset the cumulative sum to zero). Consume this class and register a delegate and show a console.write whenever the event gets fired

Using Word for Blogging

Just came to know that we can use MS Word for blogging.
I'm trying this for my other blog and I like this idea. The Blogger UI for creating and editing is still very rudimentary and polishing the blog using MS Word and then publishing it right from Word is cool.
Its been around for many many years but I knew it only this week.

Friday, July 31, 2009

Ambiguity in Javascript Date comparison

The Javascript Date.UTC function helps so convert a date to millisecond.

We use it in our application to do date comparison in relationship review

Syntax :

Date.UTC(yr, mnth, date)

We’d an issue in our application a particular date comparison was not going correctly

The Javascript says 01/31/2010 is greater than 02/02/2010!!

I searched the internet for a solution but in vain later I stumbled upon the fact that for Javascript the month starts with 0, i.e, Jan - 0, Feb – 1 etc

So in our code we said Date.UTC(2010, 01, 31) and it would’ve thought Feb 31st which was not possible. But it gave some millisecond result which became wrong.

I later changed the code accordingly and it works fine!

Saturday, July 11, 2009

SQL to create timeout

"Declare @updateCnt int

set @updateCnt = 0

While(@updateCnt <> 99900000)

begin

set @updateCnt = @updateCnt + 1

end"

IIS crash how to analyze

http://blogs.msdn.com/david.wang/archive/2005/08/29/HOWTO_Understand_and_Diagnose_an_AppPool_Crash.aspx


On Export & Import to SQL Server

I had this situation where I’ve to migrate data in a couple of tables into another database. Both are SQL Server 2005 and I cannot do it now, b’coz the other is production and the operation should happen over a release.

So ideally I’ve to write an insert script but it’s a lil more data (a couple hundreds) which will be very painful to manually write.

I tried to explore the Export and Import option and When I 1st tried export it gave me some product list not supported. Then I installed SP2 which solved the issue.

Then I tried import and it was throwing some validation exception. I tried using Flat file but in vain.

Later I once again tried export with excel this time Edited mapping and I converted the Long text to varchar but note that the varchar has just 255 as a limit in excel. Its ok for me since I dint have long data.

Now I imported and it worked fine but here again I faced a lil issue The Datetime in the excel dint have the precision to milliseconds but its kind of ok b’coz I don’t need that precision for my data.

I later heard that the TFS DataBase edition has a Database compare but it wil work only if the table has a primary key.

Thursday, April 2, 2009

AJAX Control ToolKit ClientSide function

Declare BehaviorID in the AJAXControlToolKit. This BehaviorID will be used to call the client side functions for that tool kit. In other words treat this BehaviorID as ht ClientID.

Regular Expressions

Use this site for getting regular expressions for common scenarios
http://regexlib.com

Wednesday, February 4, 2009

SSIS the new connection manager could not be created

I faced an issue with SSIS connection manager not getting created. First I opened an existing SSIS project and it dint open in design view. It was giving me
The connection type "FILE" specified for connection manager is not recognized as a valid connection manager type. This error is returned when an attempt is made to create a connection manager for an unknown connection type. Check the spelling in the connection type name.

Then I tried creating a new SSIS package and right clicked to add a new connection manager and I got the error
The new connection manager could not be created

I tried installing SQL Server 2005 SP2 and it solved the issue

Wednesday, January 21, 2009

Hover issue in Disabled Image Button

The issue is in any html page if you’ve an Input Type = “Image” (basically an image button) and you disable it and hover the mouse over the button and it still shows hand icon. So the button is disabled but the user gets a feeling that he can click the button.

I initially tried to solve this issue using css but in vain. Later I read in a forum that for some html items stylesheet hover doesn’t work in IE and Input Type = “Image” is one of them L

So I next tried to solve it using Javascript and my initial solution looked like this:


input type = "Image" src = "info.gif" onclick = "alert('hi');" disabled=”disabled” onmouseover="setMouseHover(this);"

Js function

function setMouseHover (element)
{
element.disabled = 'disabled';
}


The above solution dint work b’coz the event onmouseover doesn’t fire when the Input Type is disabled.

So my final solution looked like this



input type = "Image" src = "info.gif" onclick = "alert('hi');" onmouseover="setmousehoverdisable (this);"

Js function

function setmousehoverdisable (element)
{
element.style.cursor='default';
element.disabled = 'disabled';
}




So what happens is initially the image button is enabled and then the style is set through javascript and then the image button is disabled using javascript. This solves the problem but I just want to know if there is any other elegant way of doing this.