<telerik:GridTemplateColumn HeaderText="Status" SortExpression="MarketingStatusTypeName" DataField="MarketingStatusTypeName" UniqueName="MarketingStatusTypeName" Groupable="False" Reorderable="False"> <ItemTemplate> <telerik:RadComboBox ID="GridStatusDropDown" runat="server" DataTextField="MarketingStatusTypeName" AutoPostBack="true" DataValueField="MarketingStatusTypeID" OnSelectedIndexChanged="GridStatusDropDown_SelectedIndexChanged" /> </ItemTemplate> <ItemStyle VerticalAlign="Middle" /></telerik:GridTemplateColumn>The RadTextbox accept only numbers and decimail. How to use this validation expression for only accept 2 digits after decimal point. Example: 12.12, 123.23, 1234.12, 12345.67 like this.
I tried 2 ways.
1. ^((?:[1-9]\d*)|(?:(?=[\d.]+)(?:[1-9]\d*|0).\d+))$ --> This expression working fine but i need to accept only two digits after the decimal point.
public void Textbox1_OnTextChanged(object sender, EventArgs e)
{
if (Regex.IsMatch(Textbox1.Text, @"^((?:[1-9]\d*)|(?:(?=[\d.]+)(?:[1-9]\d*|0).\d+))$ "))
{
CalculationSummary();
}
else
{
RadAjaxManager1.Alert("Please enter only numerics.");
}
}
****or****
^(\d+)?+([\.]{1})?+([\d]{1,2})?$ --> This expression working good. It accepts only two digits after the decimal point. but i got error below condition.
public void Textbox1_OnTextChanged(object sender, EventArgs e)
{
if (Regex.IsMatch(Textbox1.Text, @"^(\d+)?+([\.]{1})?+([\d]{1,2})?$"))
{
CalculationSummary();
}
else
{
RadAjaxManager1.Alert("Please enter only numerics.");
}
}
Can anybody please let me know the possible solution. Thanke in advance.
<telerik:OpenAccessLinqDataSource ID="oaldsMap" Runat="server" ContextTypeName="HRSystemModel.HRContext" EntityTypeName="" ResourceSetName="EMaps" Select="new (EMapName, ECaption)" Where="EProcedureName == @EProcedureName"> <WhereParameters> <asp:ControlParameter ControlID="rtbProcedure" Name="EProcedureName" PropertyName="Text" Type="String" /> </WhereParameters> </telerik:OpenAccessLinqDataSource> <telerik:OpenAccessLinqDataSource ID="oaldsStage" Runat="server" ContextTypeName="HRSystemModel.HRContext" EntityTypeName="" OrderBy="ECaption" ResourceSetName="EStages" Select="new (EStageName,ECaption)" Where="EMapName == @EMapName"> <WhereParameters> <asp:ControlParameter ControlID="cmbMapNames" DefaultValue="" Name="EMapName" PropertyName="SelectedValue" Type="String" /> </WhereParameters> </telerik:OpenAccessLinqDataSource> <telerik:OpenAccessLinqDataSource ID="oaldsAction" Runat="server" ContextTypeName="HRSystemModel.HRContext" EntityTypeName="" ResourceSetName="EActions" Select="new (EActionName, ECaption)" Where="EStageName == @EStageName && EMapName == @EMapName"> <WhereParameters> <asp:ControlParameter ControlID="cmbStageName" DefaultValue="" Name="EStageName" PropertyName="SelectedValue" Type="String" /> <asp:ControlParameter ControlID="cmbMapNames" DefaultValue="" Name="EMapName" PropertyName="SelectedValue" Type="String" /> </WhereParameters> </telerik:OpenAccessLinqDataSource>protected void DisplayEditForm(GridDataItem selectedItem){ PlaceHolder.FindControl("pnlExternalForm").Visible = true; (PlaceHolder.FindControl("btnSaveChanges") as Button).Text = "Update"; (PlaceHolder.FindControl("cmbMapNames") as RadComboBox).FindItemByText(selectedItem["MMap"].Text).Selected = true; (PlaceHolder.FindControl("cmbStageName") as RadComboBox).FindItemByText(selectedItem["MStage"].Text).Selected = true; (PlaceHolder.FindControl("cmbAction") as RadComboBox).FindItemByText(selectedItem["MAction"].Text).Selected = true;}PlaceHolder.FindControl("cmbMapNames"). Always.
It throws a need to create new object error... and I have checked to confirm that it's not the dropdown but the list item that it can't find.