Thursday, October 23, 2008

EnableSortingAndPagingCallback Issue With LinqDataSource

Today, I found an issue with EnableSortingAndPagingCallback and LinqDataSource

I enable the EnableSortingAndPagingCallback on my GridView and using LinqDataSource.
Somehow after I tested, I always get error on deleting the row after move to the next page.

====
The solutions which work well is Use Update panel instead of EnableSortingAndPagingCallback.

I think it's better to use Update Panel rather then enableSortingAndPagingCallback, it some reason, it's faster and also include editing and deleting as well.

Monday, October 13, 2008

SWF Library to convert image

I just find library to convert SWF to image. it's called SWFToImage.dll from bytescout.
but it is activeX. which we don't want to use.

and I find others called swfdotnet-1.0 but unfortunately, it only support swf version 7.

Any other library for this ?

Thanks.

LINQ will arround the DateTime.MaxValue

Today, I just fixed the bugs which is interesting.

if we use linq to filter data with this DateTime.MaxValue.TimeOfDay.ToString();-
which will be appear show the time 23:59:59.9999999

Linq will add up to the next day.

so the solution never use the MaxValue.TimeOfDay.. just use simple string 23:59:59 and it's enough.

(o,o)

Thursday, August 14, 2008

Firefox 3 - Caching ISSUE

in Firefox 3 there is a weird bug which it somehow cache the page for no reason.
It just does not request to the server anymore... -(only if you update your updatepanel.


I have try many thing to avoid this.
1. Put meta tag which FF3 will ignore this -(
meta equiv="expires" content="Mon, 01 Jan 1990 00:00:00 GMT"
meta equiv="Cache-control" content="no-cache"
meta equiv="Cache-control" content="no-store"
meta equiv="Cache-control" content="must-revalidate"
meta equiv="pragma" content="no-cache"

2.Add Response Header - FF3 read this and by using Firebug, I notice that this info has been added to header
but it only worked in the first time, but after a while, it starts caching again.


Response.Cache.SetAllowResponseInBrowserHistory(false);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches) ;
Response.Expires = 0;

=======
Desperately I find doggy solution to handle this.
1. I notice that if the query string is change, FF3 will not cache. so it still go back to the server.
just add ur querystring with DateTime.Now.TimeSpan.Tick at the back, and FF3 will not cache anymore.

2. go to about:config and disable browser.cache.disk.enable and browser.cache.memory.enable. But this is very doggy solution, you can't force all of user to disable there settings which is not default from FF3. - (So just ignore this solution)

======
More reference about this bug.
https://bugzilla.mozilla.org/show_bug.cgi?id=441751

https://bugzilla.mozilla.org/show_bug.cgi?id=327790#c8

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.dotnet.framework.aspnet.caching&tid=6d5121f2-d78c-4e26-9d58-bbce507842b6&cat=en_US_f2b00e34-9211-4139-87be-4b28e2f0ef79&lang=en&cr=US&sloc=&p=1

http://www.alittlemadness.com/2008/07/30/ajax-vs-caching-vs-firefox-3/

http://www.killersites.com/mvnforum/mvnforum/viewthread?thread=11626

=====
Any other suggestion are welcome.

Tuesday, July 29, 2008

Force Page Client Validation First....

Today, I need to force check if the Page is valid in the client to perform another javascript function called.

Luckily, If you use Script Manager, WebResources.axd has been provided a function.

This function called Page_ClientValidate which will return the boolean result which indicate if the page client is valid / not. This function also will so the error message from page client validator and summary validator.

validationResult = Page_ClientValidate("groupName");

However if you use validation which is happen on the server, you still to mark your button CausesValidation="true" (Default) and code behind to check if Page is valid.

Here is example server validator using Custom validator

<asp:CustomValidator ID="custVal" runat="server" Display="dynamic" OnServerValidate="custVal_ServerValidate">
*
</asp:CustomValidator>
//code behind validation
protected void sitevalName_ServerValidate(object source, ServerValidateEventArgs args)
{
if (not valid)
args.IsValid = false;
}
//and don't forget in your button click code behind
//you need to check if page is valid,
//otherwise it will keep going.
if (!Page.IsValid) Return;

Friday, July 25, 2008

SWF with inside Modal Popup

I just solve a problem with SWF inside Modal Popup.

The weird thing happen between SWF and Ajax. It sometimes work and not work.

To make show swf in IE , I need to use SWF Object to render.
var fo = new SWFObject('temp.swf', 'viewer', '100%', '100%', '7', '#ffffff');

but there is still problem in Firefox which sometimes load up sometimes not.

Finally I need to put it on other IFrame instead of div.

<iframe style="border:none; width: 100%; height: 100%;" src="/temp.aspx?ID=<%= Content.ID%>" >
</iframe>


however It still cause a problem because I put the SWF Register Object using RegisterClient On backend... which Firefox does not accepted but IE accepted.

so Finally I need to put SWF object in front of Client aspx.




Friday, July 18, 2008

FingerMote

Just find how your finger can do in WiiMote.
http://www.cs.cmu.edu/~johnny/projects/wii/