Imran Akram's blog

Let's talk about life, technicalities, career opportunities, current affairs and a lot more!

How to access all files in a directory programmatically?

This is a way for you to access all files in a directory using the FileInfo and DirectoryInfo classes. string path = @”c:\mydirectory”; DirectoryInfo myfolder = new DirectoryInfo(path); FileInfo[] strFiles = myfolder.GetFiles(); foreach (FileInfo myItem in strFiles) { myItem.Delete(); // or do whatever you wanna do! }

  • Share/Bookmark

How to change the mouse pointer to a hand with CSS

hello there, there are some scenarios where u want to change the mouse pointer to the one that looks like a hand, you know like the one u get when you hover over a link. Sometimes its pretty useful when you’re thinking about making a popup window that would come up when you click on [...]

  • Share/Bookmark

How to go back to the previous page using Javascript

well, this is how you can go back to the previous page through Javascript. javascript:history.go(-1);

  • Share/Bookmark

Measuring Distances between element in Adobe Photoshop

Normal view Today I learned something new in Adobe Photoshop, and that is to measure the exact distance between two objects in a given design. This is very useful for us Web Developers. Distance Information All you need to do is to select the area between the two objects. and then click the ‘Info’ tab [...]

  • Share/Bookmark

Generating an XML Schema of SQL Server 2005 Database

I was told to generate an XML Schema of an SQL Server 2005 Database. And naturally I started googling it out so I found this at a blog given by the URL at the bottom. Thumbs up to ya my friend! create table Person ( Age int not NULL check( Age > 0) , Height [...]

  • Share/Bookmark

Programmatically selecting multiple items in a ListBox Control

I’m working on a project in which there was an IndexOutOfBound exception coming. We needed to have multiple items selected in the ListBox. It had a table, TemplateMTemplateAttribute , in which there were multiple entries of the template attributes selected. It was actually the TemplateAttributeId that was to be matched with those in the ‘Value’ [...]

  • Share/Bookmark

How to Left, Right, Center Align With CSS

http://www.communitymx.com/content/article.cfm?cid=529B0 http://www.ehow.com/how_2284643_left-right-center-align-css.html body { width: 80%; margin-right: auto; margin-left: auto; border: 1px solid black; } .container { position: relative; height: 50px; } .left-element { position: absolute; left: 0; width: 50%; } .right-element { position: absolute; right: 0; width: 50%; text-align: right; /* depends on element width */ } Download Samples

  • Share/Bookmark

How to get the connection string from web.config?

Truly this is as easy as pie in web.config file add a node like this in the <appsettings> node <add key=”dbConnection” value=” Server=YOUR_SERVER_NAME;User ID=USER_NAME_DB;Password=YOUR_PASSWORD;Initial Catalog=DBNAME;”/> Now in the code file add the following line whereever u want to get the connection String string conStr = ConfigurationManager.AppSettings["dbConnection"]; and then do whatever you wanna do with that!

  • Share/Bookmark

how to redirect the page when Session Expires?

I read this on http://forums.asp.net/t/1137344.aspx when I was modifying a Global.asax file that had Response.Redirect written in its Session_End Event. I guess the programmer aimed to redirect the application to the error page like this but the fact is that u dont have the Response Object in this particular event, the reason being that it’s [...]

  • Share/Bookmark

Custom Paging in ASP .NET using SQL Server 2005

Download the code Hello everyone, Here I’m going to explain how I managed to implement Custom Paging in my project. It involved an extensive amount of data that was used for searching and I definitely needed a better option than the default paging. In a nutshell, Default paging gets the complete set of records although [...]

  • Share/Bookmark
keep looking »