Wednesday, September 25, 2013

This page allows a limit of 200 controls, and that limit has been exceeded in SharePoint

I was working on custom New form which I had created in Visual Studio 2012 as aspx page and attched it to the list.
I had large number of controls in the page and found this error when i tried to browse it through browser.

The solution for this error was to change a setting in web.config.

Here I am working on SharePoint 2013

So I went to

C:\inetpub\wwwroot\wss\VirtualDirectories\

Now open webapplication Eg:80 where your site is hosted

open web.config

Find the tag below in the web.config

 <SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="250" AllowPageLevelTrace="false">  


by default  MaxControls="200" is set to 200.So you get the exception.

You can change this according to your requirement.

This is resolve the issue.

Friday, September 20, 2013

Visual Webpart on Text Box Change event Append the Text box data with Check Box list and Drop down Selected Value

Below is the code in which on you type in something on text box and on tab event(On change) event of text box the slected values from Check Box list and drop down is appended with text and displayed in Multiline text box control


In your ascx page use below code


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>


<script type=text/javascript>
    function AutoFill() {
       
        var chkSelectedLang = new Array();
        var i = 0;
        $('#<%=chkList.ClientID %> input[type=checkbox]:checked').map(function () {
         
            chkSelectedLang[i] = this.value;
            i = i + 1;

        });
       
        //var string1 = "";
        //for (var i = 0; i < myLanguage.length; i++) {

        //    string1 += myLanguage[i] + ";";
        //}       
        //alert(string1);       
        //alert(drop);
        var publicationNo = "";
        var materialNo = $("#txtMaterialNo").val();
        var ddlSelectedLang = $("#ddlLang").val();
        publicationNo = materialNo + ddlSelectedLang + ',' + '\n';
        for (var i = 0; i < chkSelectedLang.length; i++) {
            publicationNo += materialNo + chkSelectedLang[i] + ',' + '\n';
        }
        $("#txtMultiLine").val(publicationNo);
    }
</script>




<div style="border:1px solid black">
    <asp:CheckBoxList ID="chkList" runat="server">
        <asp:ListItem Value="I">India</asp:ListItem>
        <asp:ListItem Value="U">USA</asp:ListItem>
        <asp:ListItem Value="E">England</asp:ListItem>
    </asp:CheckBoxList>

</div>

<div style="border:1px solid green">
    <asp:DropDownList ID="ddlLang" ClientIDMode="Static" runat="server">
        <asp:ListItem Value="I">India</asp:ListItem>
        <asp:ListItem Value="U">USA</asp:ListItem>
        <asp:ListItem Value="E">England</asp:ListItem>
    </asp:DropDownList>
</div>

<div style="border:1px solid red">
<span>Material No</span><asp:TextBox ID="txtMaterialNo" ClientIDMode="Static" runat="server" onChange="AutoFill()" ></asp:TextBox>
<asp:TextBox ID="txtMultiLine" ReadOnly="true" ClientIDMode="Static" runat="server" TextMode="MultiLine"></asp:TextBox>   
</div>


Also Find the demo at the below link
Thilosh-Fiddle