Saturday 12 April 2014

SharePoint number column should accept only numbers

Solution:

<script type="text/javascript">
        $(document).ready(function () {
            $('input[Title="ColumnName"]').keydown(function (e) {
                var keyCode = e.which; // Capture the event
                //190 is the key code of decimal if you dont want decimals remove this condition keyCode != 190
                if (keyCode != 8 && keyCode != 9 && keyCode != 13 && keyCode != 37 && keyCode != 38 && keyCode != 39 && keyCode != 40 && keyCode != 46 && keyCode != 110 && keyCode != 190) {
                    if (keyCode < 48) {
                        e.preventDefault();
                    }
                    else if (keyCode > 57 && keyCode < 96) {
                        e.preventDefault();
                    }
                    else if (keyCode > 105) {
                        e.preventDefault();
                    }
                }
            });
        });
       
</script>


How to set subsite page as main site home page

In SharePoint it’s easy to set main site homepage from main site itself.
But today I want to set my main site homepage using my sub-site webpage.

Solution:

    1) After little bit googling I am getting one of the way, we need to change the web.config file of SharePoint.
    2) To open web.config go to C:\Inetpub\wwwroot\port_number.
   3) Open web.config file and add following lines of code under system.web tag.

<urlMappings enabled="true">

<add url="~/" mappedUrl="/subsite/SitePages/Page.aspx"/>

</urlMappings>


Feel free to revert in-case of any query...


Product Applies To:

·         SharePoint Server 2010

·         SharePoint Foundation 2010

How to add checkbox for every item in Data Form Webpart

How to add checkbox for every item in Data Form Web Part

In my one of view I want to use Data Form Web Part as well as I want to know every item’s ID value. In SharePoint XSLT view checkbox against every item is by default available but in DFWP is not readily available.


After little bit googling i am getting following step to check box column in DFWP
1.       In web part page add your DFWP.
2.       Add or remove your columns as per requirement.
3.       Click on design tag from ribbon, add one more column to your view.
4.       Select your newly added column, click on insert tab from ribbon add checkbox control from HTML toolbox.
5.       Set the “value” property of checkbox to use ID column’s value.



Feel free to revert in-case of any query...


Product Applies To:

·         SharePoint Server 2010

·         SharePoint Foundation 2010