Advertisements

Tuesday, December 31, 2013

// // Leave a Comment

Happy New Year 2014

Hi,

Wishing you and your family a very very happy and prosperous new year 2014.


Read More

Tuesday, December 24, 2013

// // Leave a Comment

Keyboard Shortcuts in Microsoft Excel 2003

Hi,

Lets have a look at some keyboard Shortcuts for Microsoft Excel.


Table of keyboard combinations
SN Key Action Alternate
1 Ctrl+A Select All
2 Ctrl+B Bold
3 Ctrl+C Copy
4 Ctrl+D Fill Down 
5 Ctrl+F Find
6 Ctrl+F Goto
7 Ctrl+H Replace
8 Ctrl+I Ralice
9 Ctrl+K Insert Hyper Link
10 Ctrl+N New Workbook
11 Ctrl+O Open
12 Ctrl+P Print
13 Ctrl+R Fill Right
14 Ctrl+S  Save
15 Ctrl+U Under Line
16 Ctrl+V Paste
17 Ctrl+W Close File,Clse
18 Ctrl+X Cut Edit,Cut
19 Ctrl+Y Repeat Edit,Repeat
20 Ctrl+Z Undo Edit,Undo
21 F1 Help Help,Contents and Index
22 F2 Edit None
23 F3 Paste Name Insert,Name,Past
24 F4 Repeat test action Edit,Repeat,Works while not in Edit mode
25 F4 White typing a formula, Switch between absotule/reletave rels None
26 F5 Goto Edit,Goto
27 F6 Next pane None
28 F7 Spell check Tools,Speling
29 F8 Extent mode None
30 F9 Recaicutate all work book Tools,Options,Calucation,Cale,Now
31 F10 Active Member N/A
32 F11 New chart Insert, Chart
33 F12 Save As File,Save As
34 Ctrl+ : Insert Cument Time None
35 Ctrl+ ; Insert Current Date None
36 Cttrl+ " Copy Value form Cell Above Edit,Pest Special,Value
37 Ctrl+ Copy Formula form Cell Above Edit,Copy
38 Shift Hold down sift for additinaol in Excel's me None
39 Shiftt+F1 What's This? Help,What's This?
40 Shift+F2 Edit Cell Comment  Insert, Edit,Comments
41 Shift+F3 Pest function Into formulas Insert, Function
42 Shift+F4 Find Next Edit,Next,Find Next
43 Shift+F5 Find Edit,Next,Find Next
44 Shift+F6 Previous pen None
45 Shift+F8 Add to selection None
46 Shift+F9 Calculete active worksheet Calc Sheet
47 Shift+F10 Display shortcut menu None
48 Shift+F11 New  worksheet Insert, Worksheet
49 Shift+F12 Save File,Save
50 Ctrl+F3 Define Name Insert Names Define
51 Ctrl+F4 Close File Close
52 Ctrl+F5 XL Restore window Size Restore
53 Ctrl+F6 Next workbook window  Window,….
54 Shift +Ctrl+F6 Previous workbook window Window,….
55 Ctrl+F7 Move window XL,Move
56 Ctrl+F8 Resize window XL,Size
57 Ctrl+F9 Minimize workbook XL,Minimize
58 ctrl+F10 Maximize or Restore window Xl,Maximize
59 Ctrl+F11 Insert 4.0 Micro Sheet None Excel 97
60 Ctrl+F12 File open File,Open
61 Alt+F1 Insert chart Insert, Chart….
62 Alt+F2 Save As File Save As
63 Alt+F4 Exit File,Exit
64 Alt+F8 Micro diloge box Tools,Micro,Microsins in year Excel 97 Tools,Macros - in earlier version
65 Alt+F11 Visual BasicEditor Tools,Micro,Bisual Basic Editor
66 Ctrl+Shift+F3 Creat name by presing names  of row and column tables Insert,Name,Create
67 Ctrl+Shift+F6 Previous window Window
68 Ctrl+Shift+F12 Print File,Print
69 Alt+Shift+F1 New worksheet Insert,Worksheet
70 Alt+Shift+F2 Save File,Save
71 Alt+= Auto sum No direct equivalent
72 Alt+ Toggle value/Formula display Tool,Options,View,Formulas
73 Ctrl+Shift+A Insert argument names Into formula No direct equivalent
74 Alt+Down arrow Display auto Complete list None
75 Alt+" Formula style dialog box Formet,Style
76 Ctrl+Shift+~ General formet  Format, Sells, Number, Category ,General
77 Ctrl+Shift+! Comma format Format, Sells, Number, Category,Number
78 Ctrl+Shift+@ Time Formet Format, Sells, Number, Category,Time
79 Ctrl+Shift+# Date formet Format, Sells, Number, Category,Date
80 Ctrl+Shift+$ Currency formet Format, Sells, Number, Category,Currency,
81 Ctrl+Shift+% Persent forment Format, Sells, Number, Category,Persentage
82 Ctrl+Shift+^ Exponential formet Format, Sells, Number, Category
83 Ctrl+Shift+& Place autline border around selected cell Formet,Cells,Border
84 Ctrl+Shift+_ Remove outlion border Formet,Cells,Border
85 Ctrl+Shift+ Select current region Edit,Goto,Special,Current Region
86 Ctrl++ Insert Insert,(Ros,columns,or Cells)Depends on selection
87 Ctrl+- Delete Delete,(Ros,columns,or Cells)Depends on selection
88 Ctrl+1 Formet cell dilog box Formet,Cells,Border
89 Ctrl+2 Bold Formet,Cells,Font,Font style,Bold
90 Ctrl+3 Italic Formet,Cells,Font,Font style,Italic
91 Ctrl+4 Under Line Formet,Cells,Font,Font style,Underlion
92 Ctrl+5 Strikethrow Formet,Cells,Font,Effects,Strikethrough
93 Ctrl+6 Show / Hide object Tool,Options,View Objects,Show All/Hide
94 Ctrl+7 Show / Hide Standerd toolbar View,Toolbar,Standard
95 Ctrl+8 Toggle outline symbols None
96 Ctrl+9 Hide row Formet,Row,Hide
97 Ctrl+0 Hide columns Formet,Columns,Hide
98 Ctrl+Shift+( Unhide row Formet,Row,Underlion
99 Ctrl+Shift+) Unhide columns Formet,Columns,Underline
100 Alt or F10 Activet the menu None
101 Ctrl+Tab In toolbar : Next toolbsr None
102 Shift+Ctrl+Tab In toolbar : Privous toolbar None
103 Ctrl+Tab In a workbook : Active next workbook None


Thanks to +Suresh kumar Awasthi for this collection. If you enjoyed and find this helpful, share this article or leave a feedback.

+John Bhatt 
Read More

Friday, December 20, 2013

// // Leave a Comment

Printing Header Rows (titles) in all pages of Microsoft Excel

Hi,

Once again, continuing Microsoft Excel series, I am going to tell you one more useful trick if you are working in office and use Excel for your work.

Introduction

You need to print data that is feeded in  Excel several times, but when data is larger, more than a page at printout, you need to print headers in top of the page. Or you need to print Column fixed in your printout. Earlier we have learnt how to fix columns in excel sheet and rows in excel sheet in previous posts.
Take a look at screenshots below, While we are looking in Print Preview, first page is showing header information in top but while in next page, there is no information, It is hard to know which column is it,

Procedure

Lets move to process directly without loosing time. Look at file we are working with.

  1. Click on Page Layout tab.
  2. Click on Print Titles command.
  3. You will get Page Setup dialogue box open with Sheet tab.
     
  4. Now Enter the Row numbers followed by Dollar sign ($) in Rows to repeat at top box, you can select using link button in box.
  5. Click OK to apply settings.
Now look at the Print Preview once again.



Ok, its what you required.
Thanks for reading. If you find this post useful, do share and provide feedback.
+John Bhatt 
Read More

Monday, December 16, 2013

// // Leave a Comment

Conversion Tool for all Number System

Hi,

If you are student of computer science, you must have required this feature sometime. You have to study and make calculation on different number systems. Mostly on Binary, Octal or Hexadecimal and Decimal number system are most used in Computer programming language.
We have collected and uploaded a application to help you. This will calculate the number of your choice to another system and also describe how this happened and actual answers.

As you can see in above snapshot, we tried to convert Decimal Number 100 to Binary number system (that is Base: 2). Answer is 1100100 but we have "Explain Answer" button, which explained the each and every step.

Go to Number Conversion Tool.

All the Best.
+John Bhatt 
Read More
// // Leave a Comment

Fix Rows & Columns Simultaneously in Microsoft Excel

Hi,

Once again, moving ahead on Microsoft Excel series, We will learn another trick here. In previous posts, we have learnt how to fix one or more rows at same time and how to fix one or more columns at same time so that we can feel comfort with our data.
Now, it is time to fix row and columns simultaneously
Lets have a loot at the previous file we have created for demonstration. Vehicle Daily Status sheet.

We want here to fix the column A to E and rows 1,2 and 3. So that wherever we are on sheet, we know what field it is?
Lets move to process without loosing any time.

  1. Click the Intersection point (cell) of rows and column you want to fix. 
  2. Click on View Tab.
  3. Click on Freeze Panes.
  4. Click on Freeze Panes. 
You are done. Your output must be similar to this.
Have a look at Column Names and Row numbers I have highlighted in above snapshot.

If you have any questions or suggestions, drop a comment here. Do not forget to share if you found this helpful.
Read More
// // Leave a Comment

Fix one or more Column in Microsoft Excel

Hi,
We will continue Microsoft Excel tutorials series. In last post in this topic, I have discussed about Fixing Headers in Microsoft Excel. We have learn how to fix one or more rows at same position while scrolling all data values in worksheet. If you have missed that read that post first.

Today, We will learn to Fix one or more columns which might be headers. The requirement is much similar like the previous scene, so I don't write more intro and requirement here.
Lets see, what we got first.
In above sheet, this is a sample format for Vehicle Tracking System on daily basis. Fist five columns are SN, Vehicle Number, Body Type of Vehicle, Driver Name and his mobile number which are important and we want them to fix at their position. Then we created Daily Status fields with simple two columns, one is Status and another is Location for that day. We expect that user will feed once a day and proceed ahead. But, in case you have lots of vehicles, suppose 200 or more and you are tracking for the day 28 or 29, what will be the scene at that time.
Just as we did in previous post, we will fix these Column fixed values and hide remaining data as we scroll to next date.

Process

If you have to fix, only on Column, there is a simple option provided in Microsoft Excel. In the View tab, there is Freeze Panes command, once you click on this, you will get option to Freeze First Column. That will do the job.
But, if you have more than one column to Fix. Follow these steps.
  1. Click and select entire Column next to the Required Area. In above scene, I will select Column F.
  2. Click on View Tab.
  3. Click on Freeze Panes command.
  4. Click on Freeze Panes option.

You have done it. Lets see the output.

If you find these posts helpful or any mistakes, you can thank or notify. Just drop a comment or leave a mail.
Read More

Wednesday, December 4, 2013

// // 2 comments

GridView with Fixed Header & Scroll Bar

Hi,

In previous posts, I have completed two important topics of GridView.
  1. Paging in GridView
  2. Scroll Bars in GridView
Today, Lets learn another new and important trick with GridView, i.e. Fixed Headers. When we have to scroll through GridView, then there is must have feature that is Fixed Header. On recent post I have written about Fixed Headers in Excel, did you get chance to read them. We are doing exactly same task here. But here we do not have "Fix Pane" as in Excel anywhere. Lets do this with simple CSS and some enhance with code-behind.

Also, Today I am using Manual method of GridView creation, in previous demos and posts, I have used Drag & Dropped GridView control. Today here is manually coded GridView. 
Lets see code for ASPX page.
            <h2 align="center">GridView with Fixed Header</h2>
            <div style="height: 400px; overflow: auto" align="center">
                <asp:GridView ID="gvDistricts" runat="server" HeaderStyle-CssClass="FixedHeader" HeaderStyle-BackColor="YellowGreen" 
                    AutoGenerateColumns="false" AlternatingRowStyle-BackColor="WhiteSmoke" OnRowDataBound="gvDistricts_RowDataBound">
                    <Columns>
                        <asp:TemplateField HeaderText="District ID" HeaderStyle-Width="80px" ItemStyle-Width="80px">
                            <ItemTemplate>
                                <asp:Label ID="lblDistID" runat="server" Text='<%#Eval("DistID")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="District Name" HeaderStyle-Width="120px" ItemStyle-Width="120px">
                            <ItemTemplate>
                                <asp:Label ID="lblDistName" runat="server" Text='<%#Eval("DistName")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="Description" HeaderStyle-Width="200px" ItemStyle-Width="200px">
                            <ItemTemplate>
                                <asp:Label ID="lblDistDesc" runat="server" Text='<%#Eval("DistDesc")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>

In above design, Notable code is style for DIV which will make this GridView scrollable if its height exceeds than 400px. Another notable code is HeaderStyle-CssClass="FixedHeader". This line of code will apply a custom CSS Class named FixedHeader which we will create in while to do the task required. Before doing this lets bind this GridView with Data. Lets move to Back-end.
I am using data from a SQL table, which simply contains, DistrictID, DistName, DistDesc as its field and approx 25 records filled.

We have nothing to do more here. So simply write the databind code inside Page_Load Event.

protected void Page_Load(object sender, EventArgs e)
    {
        string ConStr = "Data Source=.\\sqldb;Initial Catalog=ShikshaNet;Integrated Security=True";
        if (!IsPostBack)
        {
            string Query = "SELECT * FROM Districts";
            SqlConnection con = new SqlConnection(ConStr);
            SqlDataAdapter adp = new SqlDataAdapter(Query, con);
            DataTable dt = new DataTable();
            adp.Fill(dt);
            gvDistricts.DataSource = dt.DefaultView;
            gvDistricts.DataBind();
        }
    }
Now lets loot at browser to know how it looked.
 Perfect as designed. Lets scroll it and look for headers.

Oh! no, Headers are not visible. Lets start what we left at beginning. Add some style to GridView. Just navigate inside Head section of HTML and then add below code. This is stylesheet, you can customize as your requirement, but remember to change your Class name in GridView also if you are changing class name here.
<style type="text/css">
        .FixedHeader {
            position: absolute;
            font-weight: bold;
        }      
    </style>

OK, Lets refresh browser to see the changes.
 On scrolling,
Perfect, Headers are on top. But there is some problem. If you noticed, First record of GridView is not visible. It has dis-appeared. To make that record visible. Lets use a trick. Write some code in RowDataBound Event of GridView.

   protected void gvDistricts_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.RowIndex == 0)
                e.Row.Style.Add("height", "50px");
        }
    }
We just told Server to add some space if the RowIndex is 0 means first row of GridView should have atleast double space so that the value can be visible.
Lets see the output.

Bingo! You have created a perfect and complete GridView with Fixed Headers. You can use this code and it works fine even used with Paging across multiple browsers.

Thanks to +Amit Jain for the Top row fix which he has posted in his blog at Scrollable GridView With Fixed Headers Asp.Net.
If you found this post useful or helpful, or you have some suggestions to make, please post as comment or send me message on Google+ also.
+John Bhatt 


Tags: Gridview, ASP.NET, Tutorials by John Bhatt, P.Yar.B Complex, Fixed, Freeze, Headers, CSS, C-Sharp, Scrollbar, Tricks
Read More

Sunday, December 1, 2013

// // Leave a Comment

Fix one or more Rows (Header) in Microsoft Excel

Hi,

Lets work with excel some more. After long back, I am going to continue my Excel series. Today we will learn about a very useful feature of Microsoft Excel.

Suppose we have headers in top row or 2nd or third row and lots of data. Suppose a thousand records or more. This generally happens at offices, schools and various workstations. We need to scroll down the page to view records but while it is large, we get confused with data, It is confusing that what is field header (i.e. What is data).

Lets be clear with below small example.

If above excel sheet. I have maintained ledger balance of Drivers of my company. This file has 2855 Rows (your file might have more or less).

While I have to view other records, I have to scroll the page. This will look like this snapshot.

What data is in column F, or G or H. If I do not remember, we have to scroll back and view headers and then come back to last position. To overcome this problem, Microsoft Excel has built-in feature called Freeze Rows or Panes. In this post, we will learn how to fix a Top row or more rows at same time.
If you are using Excel 2007, 2010 and 2013 the method is similar.

Lets go to process.

  1. If Top row of your sheet is header, you need not to do anything, But if you have headers in second or third row, Select entire row below from header row by clicking in Row name..
  2. Click on View Tab on Office Ribbon.
  3. Click on Freeze Top Row if header in First row or Freeze Panes if header in second or third row. 


Now look at this. How it looked after scrolling down.

One thing most important about this feature. Your settings are saved within file. Means if you share file with other via email or other sharing tools, your settings remains same even if Microsoft Office version changes or system varies.

All the Best. If you found if helpful, do not forget to post a thank or +1 on Google.
+John Bhatt 
Read More

Thursday, November 14, 2013

// // Leave a Comment

Custom WordPress Admin Style

Hello,

If you are a blogger, you must be using WordPress. WordPress is a blogging platform which is widely used a CMS and most used CMS by worlds developers which is downloaded by uncountable times. Latest version of WordPress is 3.7 which is release on Oct 24 2013. As on 28 Oct 11.50 PM IST, it has been downloaded 1.6 Million times.

Definitely, I am not here to define or describe WordPress. We all have used WordPress and its Admin Interface also. Which allows us to change Themes for WordPress created website and many such functionality. But we are going to change Administration Theme without any Theme. We will use a simple Plugin created by the creator of WordPress Matt Mullenberg.

By default It has Admin Theme like below snapshot.

Now search for a plugin in WordPress plugin directory named MP6. For your convenience link for MP6 plugin is http://wordpress.org/plugins/mp6/.
Download and Install MP6 in your wordpress installation. How above page looked after installing MP6 is below.
 Admin Dashboard
Add  New Post 
I just found it very nice and wanted to share with you. I am not affiliated with WordPress in anyway commercially. However I use it and love its feature as Blog engine.

You can add me on +John Bhatt and follow our page at P.Yar.B Complex at Google+

Tags: WordPress, personalize, admin, configuration, plugin, admin-theme 
Read More

Wednesday, November 13, 2013

// // Leave a Comment

Pagination in GridView

Hi,
Simply we will learn here how to Apply Pagination in ASP.NET GridView Control.
Directly to Code:
In ASPX page, enable paging in GridView.

<asp:GridView ID="gvAllPOD" runat="server" AutoGenerateColumns="false" 
AlternatingRowStyle-BackColor="LightSeaGreen" HeaderStyle-Font-Bold="true" 
AllowPaging="true" PageSize="20" onpageindexchanging="gvAllPOD_PageIndexChanging">

In Above Code, we Automatically Generated Columns from DataSource Then AllowPaging = True, so that GridView Data can be Paged, Also We defined PageSize that what amount of Records whould display in Page.
To Apply Pagination, RIght Click in GridView and Choose Properties > Events. Choose PageIndexChanged event and Place Following code in ASPX.CS Page.
protected void gvAllPOD_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvAllPOD.PageIndex = e.NewPageIndex;
        BindGVAllPOD();
    }

Now Check on your Page. What is Happening on Clicking Page Number. You can comment if some queries on above code.
John Bhatt
Glad to Know, Free to Share

Tags: Pagination, Paging, GridView, ASP.NET, Disply data in Page, Tutorial bt John Bhatt
Read More

Thursday, October 31, 2013

// // Leave a Comment

Got Google+ Custom URL

Hi,

Today morning, I was checking my mailbox. There was a mail in Junk Folder which is from Google+ Team.

I checked the sender of mail and it was really from Google+ team. Then what, I moved mail to Inbox and clicked the Get URL button. The mail preview is attached.

Now my profile is at https://plus.google.com/+JohnBhatt


Thank you very much to Google Plus Custom URL team for such a wonderful Diwali Gift. 

By the way, you can also apply for Custom URL for your Google+ profile and if passed, may get one.

Keep visiting, You can write your Feedback to me or drop a comment here. 



Read More

Monday, October 28, 2013

// // Leave a Comment

Change Login Screen Background in Windows 7

Hi,

Most of you are working with your computer and must have Windows 7 as main operating system. Windows 7 is the most stable and complete Operating system from Microsoft after Windows XP. There are many themes and background images available for Windows 7 in Microsoft personalization page.

As you have seen many Users using Windows 8 and their custom Lock Screen backgrounds. Means when they start windows they have a nice and custom background to Windows Login screen. However, Login Screen is same for all but the Background Image can be changed as per users choice.

But we have Windows 7 and I think this to do with Windows 7 also. In this post, we are going to change the background image of Login Screen of Windows 7 from default to any of your desired one. You can simply edit the same wallpaper and write some text there.

Lets start. Here we have two methods to do. One is simple and done with graphical method. Less chances of Damage to your OS. I will discuss the Manual method to change the Registry in another post sometime later.

Be-ware, you are doing this entirely on your own risk. In case anything wrong value changed or in case of misshapen, you will face entire loss and there will not be any fault of mine. I am providing tested and checked procedure and codes with screenshots.

Here is your normal Lock Screen (Login Screen in windows 7).

Download this Registry File: Custom background in Windows 7

Now extract the Zip file and open Registry file. You will see the screen like below.


Click Yes on User Account Control prompt. Next prompt will be like this.


Click Yes. This will modify value of a key in Registry of your Windows. You will see confirmation like below screen.


Now we can start working on our task. Lets get back to Windows Explorer and navigate to this address.


  • %windir%\system32\oobe
  • Create a New folder and rename to info.
  • Open info (newly created folder), Create a New Folder and rename to backgrounds.
  • Now paste/move your favourite image to newly created folder backgrounds.
  • Rename the wallpaper file to backgroundDefault.jpg.
Folder structure and names as same in above or in Screenshot.


Remember, Background image must be in JPEG format. Other formats will not work. 
Now have a look at your newly changed Background of Login Screen.

Lock your screen or Reboot your computer to see the changes. You might not see the background if you have single user account in Operating system without password and fast hardware resources. Press Windows+L key to go to Lock screen and see the changes. Below is mine.

Enjoy. 

Don't forget to subscribe to our posts and write comments. Bitter, funny or sweet, we will love them all.
+John Bhatt 
Read More
// // Leave a Comment

GridView with Scrollbars

Hi,

Today I am here to share something to you. This is simpler as never but I bet, you are searching for this since long.

If you have developed any web application using ASP.NET, you must have used GridView, if you are beginner and learning ASP.NET, this will tell you how to make GridView scrollable. As we know, we can Paginate data in GridView, but putting a Scrollbar is really confusing as it is not in default properties of GridView control.

Lets design a web form and insert a GridView. I am using no designs and just a form and dragged and auto formatted GridView control in this tutorial.

Lets see the code for this web form.
 <div align="center">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="DistID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Height="240px" Width="667px">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="DistID" HeaderText="DistID" InsertVisible="False" ReadOnly="True" SortExpression="DistID" />
                <asp:BoundField DataField="StateID" HeaderText="StateID" SortExpression="StateID" />
                <asp:BoundField DataField="DistName" HeaderText="DistName" SortExpression="DistName" />
                <asp:BoundField DataField="DistDesc" HeaderText="DistDesc" SortExpression="DistDesc" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>" SelectCommand="SELECT * FROM [Districts]"></asp:SqlDataSource>
    </div>

I have bind data from one of my projects, this is schema of Address and table is District List. Lets run the Web form, our output is:

This is how it will list record and entire page will have GridView data. To fix this, I have added just a style tag to Div and some code inside that tag. Below is code.
..style="height:400px; overflow:auto"..
//You can change overflow:auto to overflow:scroll but that will show both Scrollbar and always. Above will show Vertical Scrollbar only when the Height of GridView exceeds than assigned height.

After adding above code, I refreshed the browser, Now this is the new and required layout of GridView.

You can download the source code from JohnBhatt.com for free.
Enjoy. Till then subscribe our feeds and get updated. You can also drop a comment below to suggest us improving. 
Read More

Sunday, September 29, 2013

// // Leave a Comment

Redirect User to same Location on Different Domain

Hi,

Recently, I have changed my Blog address. Due to this, I have to face a lot of Traffic Loss.

My situation was, I have a Blogger blog and a domain. A lot of Links have been shared and If I change the Blog address and create a Permanent Redirect by changing DNS, but existing Bookmarks and Shared Links will not load properly. So, I kept the Existing Domain running and created a New Blog. Exported Template and Blog, Uploaded both to New Domain and just keep both domain running up. Now I have to redirect all visitors to Previous Domain to New Domain.


Here I came with a solution.

I have created a Simple JavaScript function.

<script>
    function redirect()
    {
    //You change your Domain name just in place of "http://www.pyarb.com".
    
  window.location = "http://www.pyarb.com/" + window.location.pathname;
    }
</script>

Description:

1. windows.location - This will set the Location of Window (i.e. Address of Browser.)
2. "http://www.pyarb.com" - This is your New Domain. Where you have kept all File structure same. Means Links are same for All files except Domain Name.
3. windows.location.pathname - This will get the Path of Window Location (i.e. Address of Browser except Domain Name.)

Then Executed this function on PageLoad event.

......
.......
</head>
<body onload="redirect();">
.........
.........

That's It. Your location remains same.

Enjoy,
+John Bhatt 
Read More