Category ASP.NET

Operation is not valid due to the current state of the object.

Whenever a post back is done, this error occurs when form fields are very large in numbers. The stack trace is: at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) at System.Web.HttpRequest.FillInFormCollection() By default, the maximum value of MaxHttpCollection is 1000. To solve this error, increase MaxHttpCollection value. Try adding the following setting in your web.config‘s <appsettings> […]

ASP.NET Tips

—————————————————– CustomValidator —————————————————– The ValidateEmptyText property, new in ASP.NET 2.0, fixes an issue with CustomValidator.  In ASP.NET 1.0 custom validation would not fire if ValidationText was empty. You can set this property to true to cause custom validation to occur for empty input values. ex: <asp:TextBox ID=”txtno” runat=”server”></asp:TextBox> <asp:CustomValidator ID=”CV1″ ValidateEmptyText=”true” ValidationGroup=”reg” runat=”server” ClientValidationFunction=”ValidateNo” ControlToValidate=”txtno” […]

Assigning Attributes to child controls of a CheckBoxList

  Step 1:   Create a class library project   Step 2:   using System;   using System.Collections.Generic; using System.Text; using System.Globalization; using System.Web.UI; using System.Web.UI.WebControls;     namespace CheckBoxListExCtrl {  public class CheckBoxListExCtrl :CheckBoxList, IRepeatInfoUser {   void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)  {      writer.WriteBeginTag(“input”);      writer.WriteAttribute(“type”, “checkbox”);      writer.WriteAttribute(“name”, […]

CustomValidator in asp.net 2.0

The ValidateEmptyText property, new in ASP.NET 2.0, fixes an issue with CustomValidator. In ASP.NET 1.0 custom validation would not fire if ValidationText was empty. You can set this property to true to cause custom validation to occur for empty input values. ex: <asp:TextBox ID=”txtno” runat=”server”></asp:TextBox> <asp:CustomValidator ID=”CV1″ ValidateEmptyText=”true” ValidationGroup=”reg” runat=”server” ClientValidationFunction=”ValidateNo” ControlToValidate=”txtno” ErrorMessage=”*”></asp:CustomValidator> <script type=”text/javascript”> […]

Required field Validation on dropdown Selected index changed

——————————————————– If a field Validation needed then write——–ValidatorEnable(document.getElementById("reqDefaultDisplay"),true);else write——-ValidatorEnable(document.getElementById("reqDefaultDisplay"),false); 

Custom Vaidation for UserName

1.Java script:<script type="text/javascript">       function ClientValidate(source, arguments)       {          var userName = eval(‘window.document.form1.txtUserName.value’);    if(userName.length<5||userName.length>10)    {      arguments.IsValid = false;    }          else          {            arguments.IsValid = true;          }       }     </script> 2.ASPx:<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox> <asp:CustomValidator id="CustomValidator1" runat="server"ControlToValidate="txtUserName"ClientValidationFunction="ClientValidate"Display="Static"Font-Names="verdana" Font-Size="10pt">Length of UserName must be in 5-10.</asp:CustomValidator> <asp:Button ID="Button2" runat="server" Text="Submit" /> 

IN Page popup Links

Like baloon http://www.codeproject.com/jscript/jsballoon.asp Like Rectangle http://www.bosrup.com/web/overlib/