Tuesday, October 12, 2010

asp.net

Learn Dash Ajax Dot Com

Confessions of a web developer

Fix for Infragistics Web Grid Row Multi-Select on a Mac

clock April 21, 2010 19:00 by author
Well a while ago I posted a thread on the Infragistics forums and didn't even get a peep from any Infragistics people. So I took it upon myself to fix the issue. I tracked down the suspect client-side code and modified it so that the Apple key could be used for multi-selecting rows in an UltraWebGrid.
I use jQuery's $(document).ready to apply the fix, but use your own favorite client-side framework to apply the fix. I didn't bother trying to recompile the Infragistics assemblies with the updated client-side embedded resource. This just seemed easier.
Here's the fix.
001window["igtbl_cellClickDown"] = function(evnt, gn)
002    {
003        var gs = igtbl_getGridById(gn);
004        if (!gs || gs.isDisabled())
005            return;
006        gs.event = evnt;
007        igtbl_lastActiveGrid = gn;
008        gs._mouseDown = 1;
009        gs.Element.setAttribute("mouseDown", "1");
010        var se = igtbl_srcElement(evnt);
011
012        if (!se || se.tagName == "IMG" && se.getAttribute("imgType") == "expand")
013            return;
014
015        if ('' + se.contentEditable == 'true')
016            return;
017
018        igtbl_filterMouseUpDocument();
019        if (!se || se == gs._editorCurrent) return;
020
021        if ((se.id == gn + "_vl") || (se.parentNode && se.parentNode.id == gn + "_vl")) { if (gs._focusElem) ig_cancelEvent(evnt); return; }
022        if (se.id == gn + "_tb" || se.id == gn + "_ta")
023            return;
024        var sel = igtbl_getElementById(gn + "_vl");
025        if (sel && sel.style.display == "" && sel.getAttribute("noOnBlur"))
026            return igtbl_cancelEvent(evnt);
027
028        var parentCell = igtbl_getParentCell(se);
029        if (!ig_csom.IsNetscape6 || !((se.tagName == "INPUT" && se.type == "text" || se.tagName == "TEXTAREA") && parentCell && (parentCell.Column.TemplatedColumn & 2)))
030            ig_cancelEvent(evnt);
031        var se = igtbl_dom.find.parentByTag(se, ["TD", "TH"]);
032        if (!se)
033            return;
034
035
036        var row;
037        var cell = igtbl_getCellByElement(se);
038        var id = gs._mouseID = se.id;
039        if (cell)
040        {
041            row = cell.Row;
042            id = cell.Element.id;
043        }
044        else row = igtbl_getRowById(id);
045        if (!row && !cell) return;
046        var fac = row.Band.firstActiveCell;
047        if (igtbl_fireEvent(gn, gs.Events.MouseDown, "(\"" + gn + "\",\"" + id + "\"," + igtbl_button(gn, evnt) + ")") == true)
048        {
049            igtbl_cancelEvent(evnt);
050            return true;
051        }
052        var band = row.Band;
053        var bandNo = band.Index;
054
055        if (igtbl_hideEdit(gn) && !((band.getSelectTypeCell() == 2 || band.getSelectTypeCell() == 3) && band.getCellClickAction() == 1 && cell && !cell.getSelected())) return;
056        if (igtbl_button(gn, evnt) == 0 && !cell && igtbl_getOffsetY(evnt, se) > igtbl_clientHeight(se) - 4 && igtbl_getRowSizing(gn, bandNo, row.Element) == 2 && !se.getAttribute("groupRow"))
057        {
058            gs.Element.setAttribute("elementMode", "resize");
059            gs.Element.setAttribute("resizeRow", row.Element.id);
060            row.Element.style.height = row.Element.offsetHeight;
061
062
063
064            ig_csom.addEventListener(document, "mousemove", igtbl_resizeRowMouseMove);
065            ig_csom.addEventListener(document, "mouseup", igtbl_resizeRowMouseUp);
066        }
067        else
068        {
069            var te = gs.Element;
070            var workTableId;
071            if (
072               (row.IsAddNewRow
073
074                || row.IsFilterRow
075                ) && row.Band.Index == 0)
076                workTableId = gs.Element.id;
077            else
078                if (se.getAttribute("groupRow"))
079                workTableId = se.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.id;
080            else
081                workTableId = row.Element.parentNode.parentNode.id;
082            if (igtbl_button(gn, evnt) != 0)
083                return;
084            if (workTableId == "")
085                return;
086
087            te.removeAttribute("lastSelectedCell");
088            var prevSelRow = gs.SelectedRows[igtbl_getWorkRow(row.Element, gn).id];
089            if (prevSelRow && igtbl_getLength(gs.SelectedRows) > 1)
090                prevSelRow = false;
091            var selPresent = (igtbl_getLength(gs.SelectedCells) > 0 ? 1 : 0) | (igtbl_getLength(gs.SelectedRows) > 0 ? 2 : 0) | (igtbl_getLength(gs.SelectedCols) > 0 ? 4 : 0);
092            if (se.getAttribute("groupRow") || !cell || igtbl_getCellClickAction(gn, bandNo) == 2)
093            {
094                if (!(igtbl_getSelectTypeRow(gn, bandNo) == 3 && (evnt.ctrlKey || evnt.metaKey)) && !(row.getSelected() && igtbl_getLength(gs.SelectedRows) == 1))
095                    igtbl_clearSelectionAll(gn);
096            }
097            else
098            {
099                if (!(igtbl_getSelectTypeCell(gn, bandNo) == 3 && (evnt.ctrlKey || evnt.metaKey)) && !(cell.getSelected() && igtbl_getLength(gs.SelectedCells) == 1))
100                    igtbl_clearSelectionAll(gn);
101            }
102            gs.Element.setAttribute("elementMode", "select");
103            if (se.getAttribute("groupRow"))
104            {
105                te.setAttribute("selectTable", se.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.id);
106                te.setAttribute("selectMethod", "row");
107            }
108            else
109            {
110                te.setAttribute("selectTable", workTableId);
111                if (!cell || igtbl_getCellClickAction(gn, bandNo) == 2)
112                    te.setAttribute("selectMethod", "row");
113                else
114                    te.setAttribute("selectMethod", "cell");
115            }
116            if (te.getAttribute("shiftSelect") && evnt.shiftKey)
117                igtbl_selectRegion(gn, se);
118            else
119            {
120                if (!cell || igtbl_getCellClickAction(gn, bandNo) == 2 || se.getAttribute("groupRow"))
121                {
122                    var seRow = igtbl_getRowById(row.Element.id);
123                    if (gs.SelectedRows[row.Element.id] && (evnt.ctrlKey || evnt.metaKey))
124                    {
125                        igtbl_selectRow(gn, seRow, false);
126                        gs.setActiveRow(seRow);
127                    }
128                    else
129                    {
130                        var showEdit = true;
131                        if (!gs._exitEditCancel)
132                        {
133                            if (gs.Activation.AllowActivation)
134                            {
135                                var ar = gs.oActiveRow;
136                                if (ar != seRow)
137                                {
138                                    gs.setActiveRow(seRow);
139                                    showEdit = false;
140                                }
141                                else
142                                    showEdit = true;
143                            }
144                            if (igtbl_getSelectTypeRow(gn, bandNo) > 1)
145                                igtbl_selectRow(gn, seRow, true, !prevSelRow);
146                            if (showEdit && !se.getAttribute("groupRow") && row)
147                                row.editRow();
148                        }
149                    }
150                }
151                else
152                {
153                    if (cell.getSelected() && (evnt.ctrlKey || evnt.metaKey))
154                    {
155                        cell.select(false);
156                        cell.activate();
157                    }
158                    else
159                    {
160                        if (band.getSelectTypeCell() > 1 && band.getCellClickAction() >= 1 && !gs._exitEditCancel)
161                            cell.select();
162                        else if (selPresent)
163                        {
164                            var gsNPB = gs.NeedPostBack;
165                            igtbl_fireEvent(gn, gs.Events.AfterSelectChange, "(\"" + gn + "\",\"" + id + "\");");
166                            if (!gsNPB && !(gs.Events.AfterSelectChange[1] & selPresent))
167                                gs.NeedPostBack = false;
168                        }
169                        cell.activate();
170                    }
171                }
172                if (se.getAttribute("groupRow"))
173                    te.setAttribute("startPointRow", se.parentNode.parentNode.parentNode.parentNode.parentNode.id);
174                else
175                    te.setAttribute("startPointRow", row.Element.id);
176                te.setAttribute("startPointCell", id);
177                te.removeAttribute("shiftSelect");
178                if ((!evnt.ctrlKey && !evnt.metaKey))
179                    te.setAttribute("shiftSelect", true);
180            }
181        }
182        if (typeof (igtbl_currentEditTempl) != "undefined" && igtbl_currentEditTempl != null)
183            igtbl_gRowEditMouseDown(evnt);
184        if (typeof (igcmbo_currentDropped) != "undefined" && igcmbo_currentDropped != null)
185            igcmbo_mouseDown(evnt);
186    }
187});
Be the first to rate this post
  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Awesome Video

clock March 3, 2010 15:06 by author
Check out this awesome video from OK Go. Thanks to the CodeProject newsletter for sending this out in their newsletter this morning.

Be the first to rate this post
  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Welcome to BlogEngine.NET 1.6.0

clock January 24, 2010 09:00 by author Admin
If you see this post it means that BlogEngine.NET 1.6.0 is running and the hard part of creating your own blog is done. There is only a few things left to do.

Write Permissions

To be able to log in to the blog and writing posts, you need to enable write permissions on the App_Data folder. If you’re blog is hosted at a hosting provider, you can either log into your account’s admin page or call the support. You need write permissions on the App_Data folder because all posts, comments, and blog attachments are saved as XML files and placed in the App_Data folder.
If you wish to use a database to to store your blog data, we still encourage you to enable this write access for an images you may wish to store for your blog posts.  If you are interested in using Microsoft SQL Server, MySQL, VistaDB, or other databases, please see the BlogEngine wiki to get started.

Security

When you've got write permissions to the App_Data folder, you need to change the username and password. Find the sign-in link located either at the bottom or top of the page depending on your current theme and click it. Now enter "admin" in both the username and password fields and click the button. You will now see an admin menu appear. It has a link to the "Users" admin page. From there you can change the username and password.  Passwords are hashed by default so if you lose your password, please see the BlogEngine wiki for information on recovery.

Configuration and Profile

Now that you have your blog secured, take a look through the settings and give your new blog a title.  BlogEngine.NET 1.4 is set up to take full advantage of of many semantic formats and technologies such as FOAF, SIOC and APML. It means that the content stored in your BlogEngine.NET installation will be fully portable and auto-discoverable.  Be sure to fill in your author profile to take better advantage of this.

Themes and Widgets

One last thing to consider is customizing the look of your blog.  We have a few themes available right out of the box including two fully setup to use our new widget framework.  The widget framework allows drop and drag placement on your side bar as well as editing and configuration right in the widget while you are logged in.  Be sure to check out our home page for more theme choices and downloadable widgets to add to your blog.

On the web

You can find BlogEngine.NET on the official website. Here you'll find tutorials, documentation, tips and tricks and much more. The ongoing development of BlogEngine.NET can be followed at CodePlex where the daily builds will be published for anyone to download.
Good luck and happy writing.
The BlogEngine.NET team
Currently rated 4.2 by 5 people
  • Currently 4.2/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Internet Explorer's Infamous Operation Aborted Error

clock January 18, 2010 16:07 by author
This has been written about a lot, but people seem to still post questions about it, so I thought I'd add my little experience about it as well in the hope that people find the answer to this issue quicker when Googling.

The infamous Operation Aborted error is Internet Explorer's (and only Internet Explorer) way of dying very ungracefully when loading a web page. Googling it will result in all kinds of solutions, but the plain and simple facts are this. This error only occurs if you try to manipulate a DOM element via JavaScript before the element you are trying to manipulate is loaded. Below are two sample HTML examples illustrating this point. Open each of these files in Internet Explorer (IE) 6 or 7 to see the differences.


This is no longer an issue in IE8... well it's still an issue, but a little quieter about it and it actually renders pages now instaed of showing you the page for a split second than giving you the error (IE7 and <). See this article, What Happened to Operation Aborted?, http://blogs.msdn.com/ie/archive/2008/04/23/what-happened-to-operation-aborted.aspx).

This issue can also occur because of a race condition that occurs due to an Internet Explorer/ASP.Net AJAX bug. The probability of encountering this issue increases when the application has a significant number of ASP.Net AJAX enabled server controls on the web page. The issue is explained here, http://seejoelprogram.wordpress.com/2008/10/03/fixing-sysapplicationinitialize-again . I added this fix to my project and all is good now. This fix from what I can tell is still required if using ASP.NET 3.5 SP1. If you're interested, I raised the question about the AJAX issue here on Stack Overflow, http://stackoverflow.com/questions/757758/internet-explorers-operation-aborted-and-latency-issue .

Enjoy.
Be the first to rate this post
  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5