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:
Earlier today I was just playing around with SharePoint 2010 and thought I should do a simple task with SPGridView, that is to display the data and show an appropriate image in the “Status” column instead of the text. Hmm, sounds quite simple doesn’t it! But no, it turned into a misery. Well, when I started it was quite natural to use the OnRowDataBound event on that to capture the data and do some modifications with the controls (I was using TemplateFields in the SPGridView by the way), so I did that and I tried doing things like e.Row.FindControl(“xyz”), e.Row.Cells and using RowIndex property which was returning -1 where e refers to an object of GridViewRowEventArgs and there was nothing to get over there. It was nulls all around!
So here’s a sample of the code in the visual webpart that I was writing:-
Notice that I had been using the Bind function earlier but when I tried using it to send the value to StatusToImage function it did not work. Eval is the better option anyway in case you’re just interesting in displaying the data.
So what I did was that instead of using the event I just put the function call inside the ascx code so that whenever a row is created that function is called with the value of Status from the Data Source and with that value sent to a function, we can return back a string to give the path to the image file. The syntax however, is quite tricky and it took me a while to figure that out correctly but it worked in the end. Hope it will save you some time though!
Well, I started working with the SharePoint Learning Kit (SLK) 1.4 in MOSS 2007 and I was following the GettingStarted.pdf document that accompanies the package. So on Page 10 where you’re supposed to add the SLK Assignment List Web Part to a site, as I followed the instruction the site would not show anything, then I went back to the Site Actions –> Site Setting –> Web Parts and clicked on the AssignmentListWebPart.webpart. It showed the following message
“An error occurred. More information may be available in the server event log.”
Now it is important to note that the logs being referred to here are NOT the ones at C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\LOGS because these are the WSS logs.
The logs you need to see are the ones in the Administrative Tools –> Events Viewer. So when I checked that it said
SharePoint Learning Kit Error System.Data.SqlClient.SqlException: Cannot open database “SharePointLearningKit” requested by the login. The login failed.Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.
So now I knew that all I need to do is to grant access to the SharePointLearningKit database to the user NT AUTHORITY\NETWORK SERVICE and to do that just fire up SQL Server Management Studio, go to Security node –>Logins –> right click NT Authority\Network Service –> Properties –> User Mappings –> check the database SharePointLearningKit and simply check the db_owner role for it to give it maximum access for the time being –> Press the OK button and you should be able to see the Web Part now!
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.
So keep the feedback coming in, I’d be more than happy to hear from ya!
This post is particularly gonna be of use for my Muslim brothers and sisters. Ever since I came to Sweden, I was perplexed about how I can find the correct direction of Qibla without having any compass and with the date and time where the Sun comes right above Kaaba, many many days away. So I did some searching over the internet and I came to this very useful tool someone made to find the correct direction of Kaaba (Qibla) from anywhere in the world. It’s an application built using Google Maps and what it simply does is that it shows you the direction of Kaaba with it being the center point. I really appreciate this application since I had the exact kind of idea in my mind. Without any further delays, you should have a look at http://www.qiblalocator.com/
Every great movement has a philosopher and Iqbal was the philosopher of the National Renaissance of Muslim India. He in his works has left an exhaustive and most valuable legacy behind him and a message not only for the Musalmans but for all other nations of the world.
Iqbal was a poet who inspired Muslims with the spirit and determination to restore to Islam its former glory and although he is no more with us, his memory will grow younger and younger with the progress and development of Muslim India.
His works should therefore, be read and digested by every Musalman to create solidarity, and we should all try to organise the Muslims throughout India economically, educationally, socially and politically.