Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
331 views

Hi,
I am using RegularExpressionValidator for validating email id for a particular company. ValidationExpression=\\w+([-+.']\\w+)*@ABCCompany.com working for only first email id, i need to validate more than one email. I found in online ValidationExpression="((\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*([;])*)*", its working fine but i have to validate for ABCCompany.com. I tried also CustomValidator server side validation, its working code wise but its not showing error message.
Can you please anybody solve my problem.


My HTML Code:
-------------
<

telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" CellPadding="0"  CellSpacing="0" GridLines="None" HorizontalAlign="Left" ShowFooter="true" AllowPaging="true"  PageSize="10" AllowMultiRowSelection="true" OnItemCommand="RadGrid1_OnItemCommand" OnNeedDataSource="RadGrid1_OnNeedDataSource" OnInsertCommand="RadGrid1_OnInsertCommand" OnUpdateCommand="RadGrid1_OnUpdateCommand" OnDeleteCommand="RadGrid1_OnDeleteCommand"  AllowSorting="true">

 <PagerStyle Position="Bottom" AlwaysVisible="true" />

 <ValidationSettings EnableValidation="true" ValidationGroup="products" />

<MasterTableView CommandItemDisplay="Top" HorizontalAlign="NotSet" AutoGenerateColumns="False" DataKeyNames="id">

 <Columns>
<telerik:GridTemplateColumn DataField="Product_ID" FilterControlAltText="Filter Product_ID column" HeaderText="Product_ID" UniqueName="Product_ID" SortExpression="Product_ID">

<HeaderStyle HorizontalAlign="Center" />

<ItemStyle HorizontalAlign="Center" />

<ItemTemplate>

<asp:Label ID="lblProduct_ID" runat="server" Text='<%# Bind("Product_ID") %>'></asp:Label>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn DataField="Product_Email" FilterControlAltText="Filter Product_Email column"

HeaderText="Product Email" UniqueName="Product_Email" SortExpression="Product_Email">

<HeaderStyle HorizontalAlign="Left" />

<ItemStyle HorizontalAlign="Left" />

<ItemTemplate>

<asp:Label ID="lblProduct_Email" runat="server" Text='<%# Bind("Product_Email") %>'></asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:TextBox ID="tbProduct_Email" runat="server" Text='<%# Bind("Product_Email") %>'

Width="500px"></asp:TextBox>&nbsp;(Note: Enter multiple emails with ; separator)

<asp:RequiredFieldValidator ID="rfvtbProduct_Email" runat="server" ControlToValidate="tbProduct_Email"

ErrorMessage="Please enter Product Email" ForeColor="Red" ValidationGroup="products"></asp:RequiredFieldValidator>

<%

--<asp:RegularExpressionValidator ID="revtbProduct_Email" runat="server" ControlToValidate="tbProduct_Email"

 ErrorMessage="Enter only valid ABCCompany Emails" ForeColor="Red" ValidationExpression="\\w+([-+.']\\w+)*@ABCCompany.com"

ValidationGroup="products"></asp:RegularExpressionValidator>--%>

<asp:CustomValidator ID="cvtbProduct_Email" runat="server" ControlToValidate="tbProduct_Email"

ForeColor="Red" ErrorMessage="Enter only valid ABCCompany Emails" OnServerValidate="cvtbProduct_Email_OnServerValidate"

ValidationGroup="products" EnableClientScript="false" Display="None"></asp:CustomValidator>

</EditItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Delete"

UniqueName="DeleteColumn">

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</telerik:GridButtonColumn>

</Columns>

<EditFormSettings ColumnNumber="1" CaptionDataField="Product_id" CaptionFormatString="Edit properties of Product ID: {0}"  InsertCaption="Product ID:">

</EditFormSettings>

</MasterTableView>

<ClientSettings EnableRowHoverStyle="true">

</ClientSettings>

</telerik:RadGrid>


Severside validation Code:
--------------------------

protected
void cvtbProduct_Email_OnServerValidate(object sender, ServerValidateEventArgs args)

 {

 

  bool valid;

 string[] email = new string[100];

TextBox EmailList = (TextBox)RadGrid1.MasterTableView.GetInsertItem().FindControl("Product_Email");

if (EmailList.Text != "")

{

if (EmailList.Text.Contains(";"))

 email = EmailList.Text.Split(';');

else

email[0] = EmailList.Text;

for (int i = 0; i < email.Length; i++)

{

if (email[i] != null)

{

valid = Regex.IsMatch(email[i], "\\w+([-+.']\\w+)*@ABCCompany.com");

if (!valid)

{

args.IsValid = false;

 }

else

args.IsValid = true;

 

}

}

}

}

 

 Thanks,
Swetha.

Angel Petrov
Telerik team
 answered on 04 Dec 2012
1 answer
99 views
Hi there...

I am working on a rad grid that is having three links in it -->
1.) default Edit link
2.) Default Insert link
3.) a rad button created in Item Template

In both the Insert and edit link (i.e. #2) a user control get opened, which is having the upload control in it , in a window of edit form.
And on click on link created via Item Template(i.e. #3) a rad window opens.which loads a aspx page in it.
As the rad window requires Rad Ajax manager to get it opened so On the grid page rad ajax manager is added.But that is causing the File upload control in user control to not to work. So I am not able to upload the file while Insert and edit of the details...

I have tried with the solutions provided on http://www.telerik.com/help/aspnet-ajax/upload-uploading-ajax.html
but did not succeed , probably due to wrong approach.
 can anyone suggest me the proper implementation as per the above requirements.

Any Suggestions would be appreciated ..




Plamen
Telerik team
 answered on 04 Dec 2012
1 answer
66 views
I am using the RadSchedulerRecurrenceEditor standalone and the end by date calendar does not display when selecting the date.  Any help to get the calendar to display would be appreciated.

 
i am using version 2012.2.607.35

Plamen
Telerik team
 answered on 04 Dec 2012
1 answer
118 views
Hi,
i've two question to ask:

1) Into radlistview loading the record with layout templates is possible insert the button with i can to enter into the personal page to the selection record?

2) Is possible loadind the record with layout templates with a datasource that come a stored procedure sql?

Bye
Andrey
Telerik team
 answered on 04 Dec 2012
1 answer
163 views
Hi All,

I have radchart with multiple series and one series is adopt with bar chart and second series is adopt with line chart. line chart series coming from second Y-Axis. My need is from this line chart should not be display behind bar chart.

I need to display line chart above bar chart. But in default barchart overrides line chart.

How to solve this?

Thanks in Advance..
Maria Ilieva
Telerik team
 answered on 04 Dec 2012
1 answer
174 views
Hi Telerik team

I have a RadGrid with the a GridButtonColumn like below

<telerik:GridButtonColumn UniqueName="DeliveryNote" CommandName="DeliveryNote"
    ImageUrl="~/Content/Images/16/notes.png" ButtonType="ImageButton" Text="<%$ Resources:Resource, GridItemEditDeliveryNoteToolTip %>">
</telerik:GridButtonColumn>

CodeBehind:
protected void RadGridDeliveryNotesOnItemCommand(object sender, GridCommandEventArgs e)
{
    var gridDataItem = e.Item as GridDataItem;
    if (!ReferenceEquals(gridDataItem, null))
    {
        var idDeliveryNote = Convert.ToInt32(gridDataItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"]);
        if (e.CommandName == RadGrid.DeleteCommandName)
        {
             BL.Domain.DeliveryNote.Instance.DeleteById(idDeliveryNote);
        }
 
        if (e.CommandName == "DeliveryNote")
        {
            Response.Redirect(string.Format("Processor.ashx?idDeliveryNote={0}", idDeliveryNote), true);
        }
    }
}


.ashx

public class Processor : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        var idDeliveryNote = context.Request.ProcessQueryString("idDeliveryNote");
 
        var report = new Reports.DeliveryNote();
        report.ReportParameters["IdDeliveryNote"].Value = idDeliveryNote;
 
        context.Response.Clear();
        context.Response.Buffer = true;
        context.Response.ClearHeaders();
        context.Response.ClearContent();
 
        var reportProcessor = new ReportProcessor();
 
        var pdfResult = reportProcessor.RenderReport("PDF", report, null);
        var file = pdfResult.DocumentBytes;
 
        context.Response.ContentType = "application/pdf";
 
        context.Response.Charset = string.Empty;
        context.Response.AddHeader("Content-Length", file.Length.ToString(CultureInfo.CurrentCulture));
        var attachment = string.Format("attachment; filename={0}.{1}", "file-name", "pdf");
        context.Response.AddHeader("content-disposition", attachment);
 
        var bytes = file;
        context.Response.BinaryWrite(bytes);
        context.Response.End();
    }
}


The problem is, The loading pannel over RadGrid, still running after the file exported.
Can you help me with this issue.

Thanks
Giuliano


Maria Ilieva
Telerik team
 answered on 04 Dec 2012
1 answer
169 views
Hi,

I am getting an object reference error for the below mentioned highlighted line of code

radFilter.RootGroup.Expressions.Clear();
radFilter.LoadSettings(Session["state"].ToString());
radFilter.RecreateControl();

On debugging i found out that neither the radFilter is null and nor the value of Session["state"] is null. Still i get the object reference error, this happens only in certain scenarios which we are unable to understand. Since both the objects are not null i am assuming that when the control tries to implement load settings for radfilter, the LoadSettings method throws up an error.

Kindly let me know if there is a workaround for such an issue

Thanks and Regards,
Abhijit Narvekar
Antonio Stoilkov
Telerik team
 answered on 04 Dec 2012
1 answer
428 views
HI,
I have the rad grid column for which i want to set the U.S currency format. How to achieve this?
<telerik:GridTemplateColumn DataField="UnitPrice" HeaderText="Unit Price" UniqueName="UnitPrice" Visible="true">
                            <InsertItemTemplate>
                                 <telerik:RadTextBox ID="RadtxtUnitPrice" runat="server" Text='<%# Bind("UnitPrice") %>' >
                                </telerik:RadTextBox>
                            </InsertItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadTextBox ID="RadtxtUnitPrice" runat="server" Text='<%# Eval("UnitPrice") %>' >
                                </telerik:RadTextBox>
                            </EditItemTemplate>
                             <ItemTemplate >
                            <telerik:RadTextBox ID="RadtxtUnitPrice" ReadOnly="true" runat="server" Text='<%# Eval("UnitPrice") %>' />
                            </ItemTemplate>  
                        </telerik:GridTemplateColumn>
Jayesh Goyani
Top achievements
Rank 2
 answered on 04 Dec 2012
1 answer
99 views
Hi,

Has anyone tried to implement radprogressarea on radasyncupload as a TOOLTIP? so when files are being uploaded, I want to mouse over it and get additional details as to estimated time of completion, rate of upload etc.

Can someone point me in the right direction as to how to get started or provide an example? I think this will be a cool thing to have inbuilt by Telerik as well.
Princy
Top achievements
Rank 2
 answered on 04 Dec 2012
1 answer
86 views
Hi,
i've into web page a radupload...now in my vb code:

Protected Sub Imgbtnesci_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles Imgbtnesci.Click
    Me.ClientScript.RegisterStartupScript(Me.GetType, "", "Close_and_load();", True)
End Sub
 
Protected Sub CustomValidator1_ServerValidate(source As Object, e As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
    e.IsValid = (RadUpload1.InvalidFiles.Count = 0)
End Sub
 
Protected _image As String
Private Sub Imgbtnupload_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles Imgbtnupload.Click
    If RadUpload1.UploadedFiles.Count > 0 Then
        _image = "/public/image_profile/" & RadUpload1.UploadedFiles.Item(0).FileName
        Label2.Text = "/public/image_profile/" & RadUpload1.UploadedFiles.Item(0).FileName
    Else
        Label2.Visible = True
    End If
End Sub
 
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() {
       GetRadWindow().close();
}

when i click on button imgbtnesci, the upload is also, however you need to start only if I click on the button Imgbtnload...
how do it?

Bye
Plamen
Telerik team
 answered on 04 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?