Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
3.7K+ views

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.

Princy
Top achievements
Rank 2
 answered on 26 Dec 2012
2 answers
49 views
Hello everyone,

This problem is killing me so I have to ask...

I have an external form that I am using pretty much just like the example shown here: Grid / Editing with External Form

Of course I have different fields. I have 3 dropdowns all of which have data items that are available/filtered by whats been selected in a previous control cascading.

So for example: Select DD1 -> DD2 fills -> Select DD2 -> DD3 fills.

Now if I am inserting something this works fine, but if I go straight to edit an item from the grid, then the values in the grid can't be found in the dropdowns. The dropdown controls can be found, but not the items as if they were not binding or firing the selectedValue_Changed event so that the list option values can get populated. However if I go to insert something first then try to edit anything it all works like it's supposed to.

I am using OpenAccessDataSource's for the dropdowns. they look something like this:

<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>


So on the grids side of things. When I do the DisplayEditForm(GridDataItem selectedItem).... which looks like so:

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;
}

if I haven't displayed the external form before using insert for instance, it fails at 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.
 
Now after displaying the form via insert... even if I cancel and don't do the insert... just displaying it, when I come back to update or edit anything in the grid it works beautifully.

Someone please help before I throw my desktop out the window.

Thanks! :D
Kostadin
Telerik team
 answered on 26 Dec 2012
1 answer
99 views
hi,
i've a index page with i open a radwindow. Into radwindow load another page that i use to see the messager box. Into this page there's a button that i use to load another web page out this radwindow. With IE 8 and IE 9 all function, with chrome nto function....I post my code.

Index page:
<script type="text/javascript">
// ritorna valore selezionato Anagrafica
function LoadProfilo(sender, eventArgs) {
var arg = eventArgs.get_argument();
if (arg == 1) {
window.location.href("profile.aspx");
}
}
</script>
<telerik:RadWindow ID="RadWindowProfileconfirm" runat="server"
ShowContentDuringLoad="false" Width="435px"
Height="166px" Title="Aggiornamento profilo" Behaviors="None"
MaxHeight="166" MaxWidth="435" Modal="True" Behavior="None"
Font-Names="Verdana" Font-Size="Small" IconUrl="/image/iconlogo.png"
ToolTip="Aggiornamento profilo" OnClientClose="LoadProfilo"
VisibleStatusbar="False" NavigateUrl="register_step2.aspx" Skin="Simple"
ReloadOnShow="True">
</telerik:RadWindow>

code be hinde i use to load this radwindow:

Dim script As String = "function f(){$find(""" + RadWindowProfileconfirm.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, True)


code radwindow to close the window:

<script type="text/javascript">
    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }
    function Close_and_Load() {
        var arg = new Object();
        arg = 1
        GetRadWindow().close(arg);
    }
</script>

Protected Sub ImgBtncontinua_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgBtncontinua.Click
    ScriptManager.RegisterStartupScript(Page, Me.GetType, "close", "Close_and_Load();", True)
End Sub

please help me




Marin Bratanov
Telerik team
 answered on 26 Dec 2012
36 answers
1.0K+ views
Currently it seems that the ASP.NET Validators only work in server mode when used in the RadAjaxManager, but they work in client and server mode when in an UpdatePanel.

We currently converting our from ASP.NET UpdatePanels and are wondering if we are missing something simple?  If not can we plan on client side validation in RadAjaxManager in the near future?

Thanks,
Chris
Pavlina
Telerik team
 answered on 26 Dec 2012
1 answer
74 views
I am having difficulties getting the links to show up on the scheduler(See attached file).  I tried putting a scheduler on a page, just loading a few "Appointments" of the Telerik type, then binding them to the RadScheduler.  They are kind of appearing on the correct date, but they are VERY skinny...Not sure what I am doing wrong...Below is the code I used to create the Appointments.

thanks

mark

 List<Appointment> appointments = new List<Appointment>();

            Appointment app1 = new Appointment();
            app1.Subject = "Appt1";
            app1.Description = "App Desc";
            app1.Start = new DateTime(2012, 12, 17);
            app1.End = new DateTime(2012, 12, 17);
            app1.ID = 1;

            appointments.Add(app1);

            Appointment app2 = new Appointment();
            app2.Subject = "Appt2";
            app2.Description = "App Desc";
            app2.Start = new DateTime(2012, 12, 20);
            app2.End = new DateTime(2012, 12, 20);
            app2.ID = 2;


            appointments.Add(app2);

            RadScheduler1.DataSource = appointments;
            RadScheduler1.DataStartField = "Start";
            RadScheduler1.DataEndField = "End";
            RadScheduler1.DataSubjectField = "Subject";
            RadScheduler1.DataKeyField = "ID";
            RadScheduler1.DataBind();


Here is my markup for the RadScheduler...
<telerik:RadScheduler ID="RadScheduler1" runat="server" AppointmentStyleMode="Default" Height="600" SelectedView="MonthView" ItemType="Telerik.Web.UI.Appointment"></telerik:RadScheduler>

My controls are from Q1 of THIS year...License ran out so I can't upgrade...ugh...

HELP???

thanks
Bozhidar
Telerik team
 answered on 26 Dec 2012
10 answers
396 views
Hello,
I have a template column in grid and RadAsyncUpload control created in template's InstantiateIn method. I assign image file extensions to AllowedfileExtensions property.
_uploadControl = new RadAsyncUpload()                                     
   {                                           ID = Item.user_name + "_upload",
                                               TemporaryFolder = HostingEnvironment.MapPath(Static.Config.Paths.UploadsFolder),                                                AllowedFileExtensions = _allowedExtensions,
                                              TemporaryFileExpiration = new TimeSpan(0, 0, 30, 0)
        }

That's what I do next:
1. Click "Select" button.
2. When open file dialog opens, there's no file mask on it.
3. I select any file and upload it.

4. Click "Remove" link
5. Open file dialog again and see the file mask is set correctly.
What should I do to fix that?

Peter Filipov
Telerik team
 answered on 26 Dec 2012
1 answer
50 views
Changing forecolor doesnt seem to work in AppointmentDataBound...
The backColor changes just fine..
The ForeColor stays black..

e.Appointment.BackColor = Color.Blue;
e.Appointment.ForeColor = Color.White;


Bozhidar
Telerik team
 answered on 26 Dec 2012
3 answers
294 views
There are, say 2 items in a combobox. How do I set first item (visible for the user with icon and text) and prohibit selecting another item? So combobox should not expand and be "Read-only".
Shinu
Top achievements
Rank 2
 answered on 26 Dec 2012
4 answers
106 views
Hi Guys!

I'm beginner in .NET development. But I've learned how to save time with this technology. I'm very impressed with the power of Telerik too.
Well, here is my trouble for now:

I've a grid that show many columns. I need show all the content columns without wrap lines with horizontal scrool activated, like this.
But when I'll configure a grouped column, the horizontal scrool bar disappears and the column content are cropped, like can see here.

Here the grouping code:
         
<GroupByExpressions>
  <telerik:GridGroupByExpression>
    <SelectFields>
      <telerik:GridGroupByField FieldAlias="Evento" FieldName="Evento" FormatString="{0:D}" HeaderValueSeparator=": ">
        </
telerik:GridGroupByField>
    </SelectFields>
     <GroupByFields>
      <telerik:GridGroupByField FieldName="EVENTO" SortOrder="Ascending"></telerik:GridGroupByField>
     </GroupByFields>
   </telerik:GridGroupByExpression>
</GroupByExpressions>


Can anybody help me?

Andre.
Shinu
Top achievements
Rank 2
 answered on 26 Dec 2012
2 answers
58 views
Hi,

I am trying to add checkboxcolumn to support selection of rows in the RadGrid Control

I have tried both client and server side approaches but have issues with both the approaches. I have ran throught the samples provided
 the server side approach seems to work fine.

My Requirement is to be able to  capture the selected rows on the server side apart from selecting and deselecting the rows
on the grid. let me know the suggested apprach.

I have tried the Server side approach but the Toggle events are getting fired in wrong order.
For example if I select the Checkbox in the HeaderRow the ToggleSelectedState gets fired on first check but on unchecking the
same CheckBox ToggleRowSelection gets fired henceforth whihc is not what the expected behaviour should be. Please see attached file for the radgrid aspx code.

<
telerik:GridTemplateColumn UniqueName
="CheckBoxTemplateColumn">
<HeaderTemplate
>
<asp:CheckBox ID="headerChkbox" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" runat="server"></asp:CheckBox
>
</HeaderTemplate
>
<ItemTemplate
>
<asp:CheckBox ID="CheckBox1" OnCheckedChanged="ToggleRowSelection" AutoPostBack="True"

runat
="server">


If I had to use the Client side approach how will I be able to capture the selected rows on the server side. If you can provide us some sample as attahced project It would be of great help!

<telerik:GridClientSelectColumn UniqueName="grdClinetSelectCol"></telerik:GridClientSelectColumn>

</asp:CheckBox>
</ItemTemplate>
</telerik:GridTemplateColumn>

Thanks
Kumar

Shinu
Top achievements
Rank 2
 answered on 26 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?