Hi. I am trying to validate a MaskedTextBox in Asp.net using a RegularExpressionValidator control. The validation works on a normal textbox, but I can't get it to work on the MaskedTextBox. I'm getting the error message Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Here is my code:
<telerik:RadMaskedTextBox ID="txtFederalTaxID" runat="server" Mask="##-#######" CssClass="field" SelectionOnFocus="SelectAll"> </telerik:RadMaskedTextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator28" runat="server" ErrorMessage="*" ControlToValidate="txtFederalTaxID" InitialValue="" ValidationGroup="Terms"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txtFederalTaxID" runat="server" ValidationExpression="^(?!(\d)\1+$|(?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)|9(?=0)){5}\d$|(?:0(?=9)|1(?=0)|2(?=1)|3(?=2)|4(?=3)|5(?=4)|6(?=5)|7(?=6)|8(?=7)|9(?=8)){5}\d$)\d{9}$" ErrorMessage="Invalid!" Width="20px"></asp:RegularExpressionValidator>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using Telerik.Web.UI; using MachinaWeb.Services; using MachinaWeb.CommonClasses; public partial class Configuration_Companies : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { HiddenFieldIdCultura.Value = ((SessionInformation)Session["sessionData"]).IdCultura.ToString(); HiddenFieldIdAzienda.Value = ((SessionInformation)Session["sessionData"]).IdAzienda.ToString(); BO_Azienda bo_azienda = new BO_Azienda(((SessionInformation)Session["sessionData"]).IdAzienda); LabelNomeAzienda.Text = bo_azienda.NomeAzienda; LabelIntestazioneAzienda.Text = bo_azienda.Intestazione; } protected void Repeater1_PreRender(object sender, EventArgs e) { foreach (RepeaterItem item in Repeater1.Items) { //Dinamically generate DataSource and associate it to Repeater Item ObjectDataSource ods = new ObjectDataSource(); ods.TypeName = "MachinaWeb.Services.BO_ConfigurazioneProgramma_Parametro"; ods.SelectMethod = "getAll"; ods.UpdateMethod = "updateParametro"; ods.SelectParameters.Add("_idCultura", DbType.Int64, HiddenFieldIdCultura.Value); ods.SelectParameters.Add("_idAzienda", DbType.Int64, HiddenFieldIdAzienda.Value); ods.SelectParameters.Add("_idGruppoParametro", DbType.Int64, ((HiddenField)item.FindControl("HiddenFieldIdGruppo")).Value); RadGrid radGrid = (RadGrid)item.FindControl("RadGridParametriConfigurazione"); radGrid.DataSource = ods; radGrid.DataBind(); } } protected void RadGridParametriConfigurazione_UpdateCommand(object sender, GridCommandEventArgs e) { ObjectDataSourceForUpdate.SelectParameters["_idCultura"].DefaultValue = HiddenFieldIdCultura.Value; ObjectDataSourceForUpdate.SelectParameters["_idAzienda"].DefaultValue = HiddenFieldIdAzienda.Value; ObjectDataSourceForUpdate.SelectParameters["_idGruppoParametro"].DefaultValue = ((Label)e.Item.FindControl("LabelTipoParametro")).Text; ((RadGrid)sender).DataSource = ObjectDataSourceForUpdate; } protected void RadGridParametriConfigurazione_ItemDataBound(object source, GridItemEventArgs e) { if (!(e.Item is GridDataInsertItem) && e.Item.IsInEditMode) //item is about to be edit { long tipoParametro = long.Parse(((HiddenField)e.Item.FindControl("HiddenFieldTipoControllo")).Value); //HiddenFieldQuery.Value = ((HiddenField)e.Item.FindControl("HiddenFieldQueryRiga")).Value; try { switch (tipoParametro) { case 1: //CheckBox ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = false; ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = false; ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = true; break; case 2: //CheckBox-ComboBox ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = true; ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = false; ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = true; break; case 3: //TextBox ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = false; ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = true; ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = false; break; case 4: //ComboBox ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = true; ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = false; ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = false; break; case 5: //CheckBox-TextBox ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = false; ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = true; ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = true; break; } } catch (NullReferenceException) { } } } protected void HiddenFieldQueryRiga_ValueChanged(object sender, EventArgs e) { } } <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Aziende.aspx.cs" Inherits="Configuration_Companies" %> <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderBody" runat="Server"> <asp:Label ID="LabelIntestazione" runat="server" Text="LabelIntestazione" Font-Names="Arial" Font-Size="13px" Font-Bold="True"></asp:Label> <table style="font-family: Arial; font-size: 13px; margin-top: 10px;"> <tr> <td colspan="2"> <b> <asp:Label ID="LabelIntestazioniDatiAzienda" runat="server" Text="Label"></asp:Label> </b> </td> </tr> <tr> <td> <asp:Label ID="LabelNomeAziendaTxt" runat="server" Text="LabelNomeAzienda"></asp:Label> </td> <td> <asp:Label ID="LabelNomeAzienda" runat="server" Text="Label"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="LabelIntestazioneAziendaTxt" runat="server" Text="Label"></asp:Label> </td> <td> <asp:Label ID="LabelIntestazioneAzienda" runat="server" Text="Label"></asp:Label> </td> </tr> </table> <br /> <table width="100%;"> <tr> <td> <div style="width: 7cm;"> </div> </td> <td style="text-align: right;"> <asp:Label ID="LabelGruppo" runat="server" Text="Label" Font-Names="Arial" Font-Size="11pt"></asp:Label> <telerik:RadComboBox ID="RadComboBoxGruppo" runat="server" DataSourceID="ObjectDataSourceGruppiParametriComboBox" DataTextField="NomeGruppo" DataValueField="IdGruppo" AutoPostBack="True" AppendDataBoundItems="True" Width="300px"> <Items> <telerik:RadComboBoxItem runat="server" Text="---" Value="-1" /> </Items> </telerik:RadComboBox> <asp:ObjectDataSource ID="ObjectDataSourceGruppiParametriComboBox" runat="server" SelectMethod="getAll" TypeName="MachinaWeb.Services.BO_ConfigurazioneProgramma_GruppoParametri"> <SelectParameters> <asp:ControlParameter ControlID="HiddenFieldIdCultura" Name="_idCultura" PropertyName="Value" Type="Int64" /> </SelectParameters> </asp:ObjectDataSource> </td> </tr> </table> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="ObjectDataSourceGruppiParametri" OnPreRender="Repeater1_PreRender"> <HeaderTemplate> </HeaderTemplate> <FooterTemplate> </FooterTemplate> <ItemTemplate> <div id="IntestazioneGruppo" style="background-color: Orange; border: 1px solid black; text-align: center; margin-bottom: 11px;"> <%# Eval("NomeGruppo") %> </div> </b> <telerik:RadGrid ID="RadGridParametriConfigurazione" runat="server" EnableEmbeddedSkins="False" GridLines="None" Skin="MachinaWeb" AllowPaging="true" PageSize="15" AllowAutomaticUpdates="True" EnableAjaxSkinRendering="False" OnItemDataBound="RadGridParametriConfigurazione_ItemDataBound" OnUpdateCommand="RadGridParametriConfigurazione_UpdateCommand"> <MasterTableView AutoGenerateColumns="False" EditMode="InPlace" DataKeyNames="IdParametro"> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridTemplateColumn Visible="false"> <EditItemTemplate> <asp:Label ID="LabelTipoParametro" runat="server" Text='<%# Bind("IdTipoParametro") %>'></asp:Label> <%--Used only for update datasource--%> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" CancelImageUrl="~/Images/ImagesGrid/Cancel.gif" EditImageUrl="~/Images/ImagesGrid/Edit.gif" UpdateImageUrl="~/Images/ImagesGrid/Update.gif" InsertImageUrl="~/Images/ImagesGrid/Update.gif" UniqueName="EditCommandColumn" ItemStyle-Width="40px" /> <telerik:GridBoundColumn DataField="IdParametro" DataType="System.Int64" HeaderText="IdParametro" SortExpression="IdParametro" UniqueName="IdParametro" ReadOnly="true" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="IdCultura" DataType="System.Int64" HeaderText="IdCultura" SortExpression="IdCultura" UniqueName="IdCultura" ReadOnly="true" Visible="false"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn Resizable="false" ItemStyle-Width="270px"> <HeaderTemplate> <asp:Label ID="LabelDescrizioneParametro" runat="server" Text="Parametro"></asp:Label> </HeaderTemplate> <ItemTemplate> <asp:Label ID="LabelDescrizioneParametroI" runat="server" Text='<%# Bind("DescrizioneParametro") %>' Width="270px"></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:Label ID="LabelDescrizioneParametroE" runat="server" Text='<%# Bind("DescrizioneParametro") %>' Width="270px"></asp:Label> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn Resizable="false" ItemStyle-Width="270px"> <HeaderTemplate> <asp:Label ID="LabelUnificata" runat="server" Text="Valore"></asp:Label> </HeaderTemplate> <ItemTemplate> <asp:Label ID="LabelDescrizioneI" runat="server" Text='<%# Bind("ValoreTextBoxComboBox") %> ' Width="270px"></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="TextBoxDescrizione" runat="server" Text='<%# Bind("DescrizioneTextBox") %>' Width="270px"></asp:TextBox> <telerik:RadComboBox ID="RadComboBoxValore" runat="server" Width="270px" DataSourceID="ObjectDataSourceRadComboBoxValore" DataTextField="Descrizione" DataValueField="Valore" SelectedValue='<%# Bind("ValoreComboBox") %>'> </telerik:RadComboBox> <asp:HiddenField ID="HiddenFieldQueryRiga" runat="server" Value='<%# Bind("QueryComboBox") %>' /> <asp:Label ID="LabelHidden1" runat="server" Text='<%# Bind("QueryComboBox") %>' /> <asp:HiddenField ID="HiddenFieldTipoControllo" runat="server" Value='<%# Bind("IdTipoParametro") %>' /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn Resizable="false" ItemStyle-Width="30px"> <HeaderTemplate> <asp:Label ID="LabelAbilitato" runat="server" Text="Abilitato"></asp:Label> </HeaderTemplate> <ItemTemplate> <asp:CheckBox ID="CheckBoxAbilitatoI" runat="server" Checked='<%# Bind("Abilitato") %>' Enabled="false" Width="30px" /> </ItemTemplate> <EditItemTemplate> <asp:CheckBox ID="CheckBoxAbilitatoE" runat="server" Checked='<%# Bind("Abilitato") %>' Width="30px" /> </EditItemTemplate> </telerik:GridTemplateColumn> </Columns> <EditFormSettings> <EditColumn> </EditColumn> </EditFormSettings> </MasterTableView> </telerik:RadGrid> <asp:HiddenField ID="HiddenFieldIdGruppo" runat="server" Value='<%# DataBinder.Eval(Container.DataItem,"IdGruppo")%>' /> </ItemTemplate> <SeparatorTemplate> <div style="margin-bottom: 20px;"> </div> </SeparatorTemplate> </asp:Repeater> <asp:ObjectDataSource ID="ObjectDataSourceGruppiParametri" runat="server" SelectMethod="getAll" TypeName="MachinaWeb.Services.BO_ConfigurazioneProgramma_GruppoParametri"> <SelectParameters> <asp:ControlParameter ControlID="HiddenFieldIdCultura" Name="_idCultura" PropertyName="Value" Type="Int64" /> <asp:ControlParameter ControlID="RadComboBoxGruppo" Name="_idGruppoSelezionato" PropertyName="SelectedValue" Type="Int64" /> </SelectParameters> </asp:ObjectDataSource> <%--Prova combo dinamico in repeater--%> <asp:ObjectDataSource ID="ObjectDataSourceRadComboBoxValore" runat="server" SelectMethod="valoriComboBox" TypeName="MachinaWeb.Services.BO_Query"> <SelectParameters> <asp:ControlParameter ControlID="HiddenFieldQuery" Name="_query" DbType="String" PropertyName="Value" /> <asp:ControlParameter ControlID="HiddenFieldIdCultura" Name="_idCultura" Type="Int64" PropertyName="Value" /> </SelectParameters> </asp:ObjectDataSource> <asp:HiddenField ID="HiddenFieldQuery" runat="server" /> <%--Prova combo dinamico in repeater--%> <asp:ObjectDataSource ID="ObjectDataSourceForUpdate" runat="server" SelectMethod="getAll" TypeName="MachinaWeb.Services.BO_ConfigurazioneProgramma_Parametro" UpdateMethod="updateParametro"> <SelectParameters> <asp:Parameter Name="_idGruppoParametro" Type="Int64" DefaultValue="" /> <asp:ControlParameter ControlID="HiddenFieldIdAzienda" Name="_idAzienda" PropertyName="Value" Type="Int64" /> <asp:ControlParameter ControlID="HiddenFieldIdCultura" Name="_idCultura" PropertyName="Value" Type="Int64" /> </SelectParameters> <UpdateParameters> <asp:ControlParameter ControlID="HiddenFieldIdAzienda" Name="_idAzienda" PropertyName="Value" Type="Int64" /> <asp:ControlParameter ControlID="HiddenFieldIdCultura" Name="_idCultura" PropertyName="Value" Type="Int64" /> <asp:Parameter Name="Abilitato" Type="Boolean" /> <asp:Parameter Name="IdTipoParametro" Type="Int64" /> <asp:Parameter Name="DescrizioneParametro" Type="String" /> <asp:Parameter Name="DescrizioneTextBox" Type="String" /> <asp:Parameter Name="ValoreComboBox" Type="String" /> <asp:Parameter Name="IdParametro" Type="Int64" /> </UpdateParameters> </asp:ObjectDataSource> <asp:HiddenField ID="HiddenFieldIdCultura" runat="server" /> <asp:HiddenField ID="HiddenFieldIdAzienda" runat="server" /> </asp:Content> Hi,
I am using a 16x16 png on my top level menu, this looks very small but when I tried a larger 24x24 one then the menu behaved strangely when hovering (the menu height increased, hinting that the image is too large.) What is the recommended image size for a standard size menu?
Hi
I would to like the export the datasource of the HTMLChart to Excel (XLS) format.
Can you someone help me in exporting to Excel(.xls)?
Thanks in Advance
I finally figured it out it was radformdecorator causing this issue.
Adding ControlsToSkip="Scrollbars" now results in the pages I was having an issue with the browser scroll bars missing in chrome showing up.
If I were to "view page source" or "inspect element" the scroll bars would show up (without the fix above).
I don't have a lot of time to go figure out what CSS is causing this but for now the ControlsToSkip="Scrollbars" is a quick fix for anybody else with this issue.
I'm betting it's something in the rfdScrollBars css and/or a bug in chrome as this isn't a problem in IE or Firefox.
I have this issue on 3 different computers, all running the latest version of chrome 43.0.2357.81
If I figure out what's happening (even if it's a mistake on our end) I'll be sure post here again.
Hi Telerik Team,
When I place any of RadAjax controls on my page, I can control the path of the WebResource handler via the HttpHandlerUrl property of the StyleSheetManager. This is to avoid registration of the handler in the web.config.
However this setup breaks with all the Dilaogs used in RadEditor. They are all handled by the DialogHandler type which I can extend because it is public. However the StylesheetManager filed of this type is Private and I cannot instruct it to load the web resource from a given path - it always looks for the default path for WebResource handler.
How can I make the dialogs in RadEditor also respect the "global" for the StyleSheetManager's HttpHandlerUrl paroperty which I have across all my pages ?
