Tuesday, March 25, 2008

IE caches IFrame pages. Page load does not fire in IFrame page.

I had this issue on a project that I was working on. I created an IFrame to load a page in a modal window. On the close of the modal window I will close the frame, and then when the user clicks on a button to open the window I will recreate the frame with the same url to load the page. This worked fine with FireFox. On every load of the modal window I the Page_Load event will fire, however, with IE this was not the case. I solve the problem by creating a unique request every time setting a parameter with a random number in the source of the IFrame.


Iframe.src="MyPage.aspx?unique="+ Math.random();

Thursday, March 20, 2008

Aivea eShop Shopping Cart is NOT Enterprise Ready (Review)

After looking for e-commerce solution for my store shopping cart I made the decision to go with Aivea eShop product. Their website ‘professional’ looking was what convinced me to buy it. However, when I downloaded the product with the source code I was shock. I have work in “Enterprise wide” applications and the eShop source code is not enterprise ready as they claim in their website.

These are my disappointment factors:

  • Source code uses Hungarian notation.

  • In store front website source code they persists almost every value in the session in the session.

  • They don’t use strong typed entities. I only noticed 3 or 4 object to used to get data

  • Heavy used of data sets instead of objects

  • Not a flexible architecture. Business rules and data access is all in the App_Code folder. If you have more than one interface that needs to access the shopping cart to process order or retrieve order orders you can’t accomplish it without serious re-factoring and extracting the source code to reusable components.


I am sure I can find other reasons but I will stop here. This was the reason I decided not to use it in my application. Towards the end of the project I was so happy that I did not use this out of the shelf solution that encouraged me to write this article.



I am not writing this post to drive off their business, but to express my believe and make them be aware of what a user is thinking about their product. By the way the version that I used was 2.5+.



You can find more reviews here at
http://www.411asp.net/func/review?id=6449910&rid=&proc=anony

Tuesday, March 18, 2008

DetailsView Edit Mode never changes after Update command. DetailsView Edit button requires to clicks to change to edit mode.

I was stocked for sometime using the asp.net 2.0 DetailsView control to Edit/Update data. I wanted to do my custom implementation for the Update command instead of using the DataBinding Object sources but I found my self in trouble with several road blocks.

Problem 1:
When clicking on the Edit button the DetailsView will not change the mode until the second click. The edit button required two clicks to change the mode to Edit instead of ReadOnly.
I solved this problem by changing the mode in the ModeChanging event handler and then rebinding the DetailsView control.


ModeChanging Event Handler:

protected void dvOrder_ModeChanging(object sender, DetailsViewModeEventArgs e)
{
dvOrders.ChangeMode(e.NewMode);

if (e.NewMode != DetailsViewMode.Insert)
{
RefreshOrderDetails();
}
}




Problem 2:
When clicking the update button I handle the updating of the order in the ItemUpdating event but the ItemUpdated never fires and the DetailsView never change the mode to ReadOnly after the data was updated. DetailsView control always stayed on the Edit Mode.


I solve this problem by canceling the ItemUpdating event, changing the mode, and rebinding the details view data source.


ItemUpdating Event Handler:

protected void dvOrder_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
{

UpdateOrder();

e.Cancel = true;

dvOrders.ChangeMode(DetailsViewMode.ReadOnly);

RefreshOrderDetails();
}



This was the only way I got things to worked for me. The ItemUpdated event never fired but I got the DetailsView to works how I wanted. I wish there was an easier way to do this or at least more documentation on Microsoft’s website.

Tuesday, March 11, 2008

IE Autocomplete Dropdown wrong location in Modal/Dialog window ASP.NET 2.0

I recently discover that if the AutoCompleteType attribute is not specify explicitly in the input control IE will display the autocomplete options dropdown in offset location in modal/dialog windows.

This is not the case if you are using Yahoo's tool bar or Google's auto fill feature in its tool bar, but IE is more stupid.

I fixed this issue my explicitly settings the AutoCompleteType attribute in the Textbox control.

Example textbox for first name field.


<asp:TextBox ID="txtFirstName" CssClass="input" runat="server" AutoCompleteType="firstname"></asp:TextBox>




By setting the AutoCompleteType attribute the problem was corrected.