Archive for category Web Development
In DynaTree sometimes you may want the nodes to not expand when yo click on them - usually it expands it whether you click on the arrow at the corner or anywhere on the entire node text – so if you don’t want that behavior you need to initialize the tree with clickFolderMode: 1 and that’s it!
For details of how to initialize the DynaTree, check out the sample code in section 4.1 in DynaTree Documentation
This one is especially useful for the new bie because when you start with building webparts for SharePoint 2010, you often come to a point where you wanna add a URL somewhere, lets say programatically or in the CSS or may be in the ASCX code and you wonder, hey wait a minute where are the images for SharePoint placed anyway? How do I refer to them? So here’s your answer.
What you do is that you Right Click the Web parts project > Add > SharePoint “Images” Mapped Folder option. Doing that will give you an images folder inside your project directory and you can refer to that like this:
Ever tried testing your application on Internet Explorer in a Windows Server environment and noticed that you just can’t browse like you do normally. In short, its “a pain in the ass”! (pardon my French) because IE just keeps buging you at every single URL that you enter – and not just once… but 3-4 times for a single website. And in order to see the looks of that website, you have to keep adding in the “trusted zone” in the dialog box that appears all the time! But anyway, enough of this whining now, lets get down to some business.
Well, today I was really determined to stop all those nonsensical security alerts so first I went to where common sense leads you to – Yeah you’re right, I went to the Internet Options –> Security Tab –> Internet Zone to turn down the security level. But when you go there, it appears disabled (grayed-out), so obviously you can’t change that like the way you’d usually expect! (Wonder why Microsoft did it that way?!?! But anyway…)
So going to the good ol’ Google for help and reading a document on Microsoft, I cam to know that all you need to do, is to fire up Server Manager (usually it sits in the Quick Launch bar but you can also go to Control Panel –> hit Classic view –> Programs and Features –> Turn Windows features on or off). Once you’re there, you’d see the screen similar to Figure 1 above. In that just hit the link Configure IE ESC. Next up, you’d see the screen in figure 2 on the right. Just turn the IE Enhanced Security Configuration (IE ESC) off for the administrators. It is recommended however, that you do turn it back on when you put the server into production. After you’re done with that you can go back to Internet Explorer –> Internet Options –> Security tab –>Internet zone and bring it down to medium-low. Now you can browse as usual.
I hope you find this post useful although it seems like a very trivial issue yet its quite annoying when you’re in a hurry or something.
Yesterday I was working on a project which had the AJAX Extensions in use. It’s primarily a .NET 2.0 application and I had .NET Framework 3.5 SP 1 installed on my system. It was working normally and all of a sudden I got this error that: Unknown server tag ‘asp:ScriptManager’
It was strange because every thing was working and I had the reference to the AjaxControlToolkit.dll.
I found out that by adding the section below to the <system.web> node in the web.config solves the problem:-
<add tagPrefix=”asp” namespace=”System.Web.UI” assembly=”System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
Allows only Alphanumeric characters with a period(.), Underscore(_) and a Hyphen (-). No spaces or other characters allowed.
I’ve found this tool called The Regulator, for validating and testing the regular expressions very useful. I think some of you might find it fairly useful as well. The interface is pretty neat, very simple to use. In case you find it a bit confusing, press F1 to checkout the basics. It’s pretty much straight forward.
I’ve been having this issue with mobile development for quite sometime that I couldn’t get the mobile browser accurately by just using the Request.Browser.isMobileDevice property and I’ve found this piece of code here
Looks pretty useful.
//FIRST TRY BUILT IN ASP.NT CHECK
//THEN TRY CHECKING FOR THE HTTP_X_WAP_PROFILE HEADER
if (context.Request.ServerVariables["HTTP_X_WAP_PROFILE"] != null)
//THEN TRY CHECKING THAT HTTP_ACCEPT EXISTS AND CONTAINS WAP
if (context.Request.ServerVariables["HTTP_ACCEPT"] != null &&
//AND FINALLY CHECK THE HTTP_USER_AGENT
//HEADER VARIABLE FOR ANY ONE OF THE FOLLOWING
if (context.Request.ServerVariables["HTTP_USER_AGENT"] != null)
//Create a list of all mobile types
string mobiles =
“midp”, “j2me”, “avant”, “docomo”,
“novarra”, “palmos”, “palmsource”,
“240×320″, “opwv”, “chtml”,
“pda”, “windows ce”, “mmp/”,
“blackberry”, “mib/”, “symbian”,
“wireless”, “nokia”, “hand”, “mobi”,
“phone”, “cdm”, “up.b”, “audio”,
“SIE-”, “SEC-”, “samsung”, “HTC”,
“mot-”, “mitsu”, “sagem”, “sony”
, “alcatel”, “lg”, “eric”, “vx”,
“NEC”, “philips”, “mmm”, “xx”,
“panasonic”, “sharp”, “wap”, “sch”,
“rover”, “pocket”, “benq”, “java”,
“pt”, “pg”, “vox”, “amoi”,
“bird”, “compal”, “kg”, “voda”,
“sany”, “kdd”, “dbt”, “sendo”,
“sgh”, “gradi”, “jb”, “dddi”,
//Loop through each item in the list created above
//and check if the header contains that text
foreach (string s in mobiles)
It’s simple, yet not very obvious. All you have to do is to change the normal behavior of the commas you use in the Where function to act as an OR. You’d do it like this:-
ObjES.Query.es.DefaultConjunction = esConjunction.Or;
ObjES.Query.Where(<<Go ahead with using the commas that usually defaults to an AND conjunction>>);
oh and I almost forgot to mention my colleague Bilal mentioned this to me. So special thanks to him as well.