Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
89 views

Hi all,

 I'm trying to validate some fields in a FormTemplate inside of a RadGrid and everything is working fine except for one problem. Whenever the submit button is pressed, an async postback is triggered and after postback the validators are triggered. Functionality wise it works fine, the update/insert isn't persisted, but I don't understand why the post-back is occurring (and causing the ajax loading panel to trigger) instead of the validation occurring all on the client side. Is it possible to prevent the post-back? Form is below and the page is using RadAjaxManager for async. Thanks.

<EditFormSettings EditFormType="Template" CaptionFormatString="Create/Edit Broker" PopUpSettings-Modal="True">
    <FormTemplate>
        <div class="form-template">
            <table>
                <tr>
                    <td>Name</td>
                    <td>
                        <asp:TextBox ID="tbName" runat="server" Text='<%# Bind("NAME") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvName" runat="server" ControlToValidate="tbName" ValidationGroup="form" ErrorMessage="Required!" Display="Dynamic" CssClass="required" />
                    </td>
                </tr>
                <tr>
                    <td>Broker</td>
                    <td>
                        <icl:KeyNameDropDown runat="server" ID="ddlBroker" AppendDataBoundItems="True" />
                        <asp:RequiredFieldValidator ID="rfvBroker" runat="server" InitialValue="0" ControlToValidate="ddlBroker" ValidationGroup="form" ErrorMessage="Required!" Display="Dynamic" CssClass="required" />
                    </td>
                </tr>
                <tr>
                    <td>Is Active</td>
                    <td>
                        <asp:CheckBox ID="cbActive" runat="server" Checked='<%#  Eval("ISACTIVE").ToString().Equals("True") %>' />
                    </td>
                </tr>
            </table>
 
            <asp:LinkButton ID="btnUpdate" runat="server"
                Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' ValidationGroup="form" />
        </div>
    </FormTemplate>
</EditFormSettings>

Eyup
Telerik team
 answered on 09 Jun 2015
0 answers
177 views
Model:-
public class PurchaseOrder
{
 
public string PlanedDate { get; set; }
public DateTime? PlanedDateTime { get; set; }
public string PlanedDateString { get; set; }
 
public string CompletionDate { get; set; }
 
        [Display(Name = "Completion Date")]
        public DateTime? CompletionDateTime { get; set; }
        public string CompletionDateString { get; set; }
 
 
 
}
 
 
 
Controller:-
private void ModifyFilters(IEnumerable<IFilterDescriptor> filters)
        {
            if (filters.Any())
            {
                foreach (var filter in filters)
                {
                    var descriptor = filter as FilterDescriptor;
 
                    if (descriptor != null && (descriptor.Member == "PlanedDateTime" || descriptor.Member == "ModifiedDateTime" || descriptor.Member == "CompletionDateTime" ||
                    descriptor.Member == "CharterDateTime" || descriptor.Member == "UpLiftDateTime" || descriptor.Member == "PurchaseOrderDateTime" || descriptor.Member == "InvoiceSubmittedDateTime"))
                    {
                         descriptor.Value = Convert.ToDateTime(descriptor.Value.ToString().Trim()).ToShortDateString();
                        //Not Equal Op  We send Only Date
                    }
  if (descriptor != null && descriptor.Member == "PlanedDateTime")
                    {
                        descriptor.Member = "PlanedDate";
                        
                    else if (filter is CompositeFilterDescriptor)
                    {
                        ModifyFilters(((CompositeFilterDescriptor)filter).FilterDescriptors);
                    }
                }
            }
        }

 

 

Controller:-
  public ActionResult PurchaseCellarOrder_Read([DataSourceRequest] DataSourceRequest request, FormCollection formcol)
        {
         XrmServiceContext xrm = new XrmServiceContext(CrmService.Service);
            var totalRecordCount = 0;
 
            Guid ParentCustomerId = xrm.ContactSet.SingleOrDefault(i => i.Id == new Guid(HttpContext.User.Identity.Name)).ParentCustomerId != null ? xrm.ContactSet.SingleOrDefault(i => i.Id == new Guid(HttpContext.User.Identity.Name)).ParentCustomerId.Id : Guid.Empty;
          List<PurchaseOrderModel> purchaseOrderList = new List<PurchaseOrderModel>();
            if (ParentCustomerId != Guid.Empty)
            {
                ModifyFilters(request.Filters);
                   po.PlanedDate = entity.Attributes.Contains("tcrmb_planneddate") ? (TimeZoneInfo.ConvertTimeFromUtc(Convert.ToDateTime(entity.Attributes["tcrmb_planneddate"].ToString()), timezone)).ToShortDateString().Trim() : "--";
                    po.PlanedDateTime = entity.Attributes.Contains("tcrmb_planneddate") ? (TimeZoneInfo.ConvertTimeFromUtc(Convert.ToDateTime(entity.Attributes["tcrmb_planneddate"].ToString()), timezone)).Date : (DateTime?)null;
                    po.PlanedDateString = entity.Attributes.Contains("tcrmb_planneddate") ? entity.FormattedValues["tcrmb_planneddate"] : "--";
   purchaseOrderList.Add(po);
             }
      var page = request.Page;
         
       request.Page = 1;
 
            var result = purchaseOrderList.ToDataSourceResult(request);
            if (totalRecordCount <= request.PageSize)
            {
                result.Total = purchaseOrderList.Count;
            }
            else
            {
                result.Total = totalRecordCount;
            }
 
            return Json(result);
}
View:-
 
 
@model SupplierPortal.Models.PurchaseOrderModel
@using Kendo.Mvc.UI
 
@(Html.Kendo().Grid<SupplierPortal.Models.PurchaseOrderModel>().Name("PurchaseCellarOrders")
                        .DataSource(ds => ds.Ajax()
                            .Read(r => r.Action("PurchaseCellarOrder_Read", "PurchaseOrder"))
                        .Model(m => m.Id(p => p.PurchaseOrderId))
                        .ServerOperation(true)
                         .Sort(sort => sort.Add(po=>po.ModifiedDateTime).Descending())        
                         .PageSize(50).Events(e => e.RequestEnd("requestEnd"))
                        )
                        .Columns(cols =>
                        {
                            cols.Bound(con => con.PurchaseOrderId).Title("<input type='checkbox' id='checkAll'/>").Filterable(false).Sortable(false)
                                .ClientTemplate("<input type='checkbox'  #=PurchaseOrderId ? checked='':'' # class='check-box' onchange='SetCheckBOX(this)'/>");
 
                            cols.Bound(con => con.PHCNumber).Title("PHC");
                            cols.Bound(con => con.PubName);
                            cols.Bound(con => con.PostCode);
                            cols.Bound(con => con.CaseNumber).Visible(false);
                            cols.Bound(con => con.PONumber).Title("Purchase Order Number");
                            cols.Bound(con => con.CharterDate).Format("{0:dd/MM/yyyy}").Visible(false);
                            cols.Bound(con => con.CharterDateTime).ClientTemplate("#=CharterDateString #");
                            cols.Bound(con => con.PlanedDate).Format("{0:dd/MM/yyyy}").Visible(false);
                            cols.Bound(con => con.PlanedDateTime).ClientTemplate("#=PlanedDateString #").Title("Planned Date");
                            cols.Bound(con => con.CompletionDate).Format("{0:dd/MM/yyyy}").Visible(false);
                            cols.Bound(con => con.CompletionDateTime).Title("Work Done Date").ClientTemplate("#=CompletionDateString #");
                            cols.Bound(con => con.Status).Filterable(false).Sortable(false).Visible(false);
                            cols.Bound(con => con.StatusReason).Sortable(false).Title("Status Reason");
                            cols.Bound(con => con.Classification).Width(120);
                            cols.Bound(con => con.ModifiedDate).Format("{0:dd/MM/yyyy}").Visible(false);
                            cols.Bound(con => con.ModifiedDateTime).ClientTemplate("#=ModifiedDateString #");
                            cols.Bound(con => con.InvoiceSubmittedDate).Format("{0:dd/MM/yyyy}").Visible(false);
                            cols.Bound(con => con.InvoiceSubmittedDateTime).Title("Invoice Submitted").ClientTemplate("#=InvoiceSubmittedDateString #");
                            cols.Bound(con => con.OnHold);
                            cols.Bound(con => con.OnHoldBool).Visible(false);
 
                            //cols.Bound(con => con.PONumber);
 
 
                        })
                                                 .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple).Type(GridSelectionType.Row))
        //.Events(events => events.DataBound("onDataBound"))
                                                 .Pageable()
                                                 .Sortable()
                                                 .Filterable()
 
    )

 

 here I got Filter Binding issues...when Give 28/05/2014 in Planned Date 28/05/2015  "On or Before"  in Controller Side I got Full record But it Excute  the Following line

 var result = purchaseOrderList.ToDataSourceResult(request); 

Some Of the Records are missing ....I unable to find where the ..issues 

I attach Following image First one is webportal one...in this we missing 2  records of planned date 08/05/2015 and 07/05/2015 but it exist in Controller At the time of binding...It Show in second image .....help me here ...where is the  issues.

 

 

Sairam
Top achievements
Rank 1
 asked on 09 Jun 2015
2 answers
1.7K+ views

Hi support Team,

 In Kendo ui Grid ...I am Apply the Composite Filter ...But Problem with The ...Here in Filter ....I have some  "True" or "False"  Column ......Instead of Showing The "True"  ...."Y" and "False" ...."N"...So  I am Apply Following Logic For that 

 C# Code When User Gives  "Y" or "N"....based on That  .....setting True or False.

   private static void addFilter(XElement newFilter, FilterDescriptor firstFilter, string crmAttributeName, GetCrmColumnName getColumnInfo)
     {
            if (firstFilter.Member == "OnHold")
         {
                if (firstFilter.Value.ToString().ToLower() == "y")
                {
                    firstFilter.Value = true;
                }
                else if (firstFilter.Value.ToString().ToLower() == "n")
                {
                    firstFilter.Value = false;
                }
            }
                newFilter.Add(new XElement("condition",
                    new XAttribute("attribute", crmAttributeName),
                    new XAttribute("operator", getOperator(firstFilter.Operator, crmAttributeName)),
                    new XAttribute("value", String.Format(getOperatorFormat(firstFilter.Operator), firstFilter.Value.ToString().Trim()))));           
        }

 After Result Came I Need To ..Assign Same "Y" or "N"

So I Write The Following code

    foreach (var n in request.Filters)
            {           
                    if (((FilterDescriptor)(n)).Member == "OnHold")
                    {
                        if (((FilterDescriptor)(n)).Value.ToString().ToLower() == "true")
                        {
                            ((FilterDescriptor)(n)).Value = "y";
                        }
                        else
                        {
                            ((FilterDescriptor)(n)).Value = "n";
                        }
                    
                }          
            }

 

It Work Fine ....For Normal Filter ...When ...I suppose ....Use CompositeFilter Then  I got Problem....If ...Work with Composite Filter ..I need Display ...Not Empty or an error...

 

 

  foreach (var n in request.Filters)
            {
                if (n is CompositeFilterDescriptor==true)
                {
                    if (((CompositeFilterDescriptor)(n)).FilterDescriptors.Count() >= 2)
                    {
                     
                    }
                }
                else
                {       
                    if (((FilterDescriptor)(n)).Member == "OnHold")
                    {
                        if (((FilterDescriptor)(n)).Value.ToString().ToLower() == "true")
                        {
                            ((FilterDescriptor)(n)).Value = "y";
                        }
                        else
                        {
                            ((FilterDescriptor)(n)).Value = "n";
                        }
                    }
                }          
            }

Currently.....It  Work For Composite Filter also..But when .....we Include Filter Of "Y" or "N".....I got ...Problem....When User Give even Though ..."Y" or "N"...Columns in the Composite Filter.....We need to Display....matched Columns.....

 

 

Sairam
Top achievements
Rank 1
 answered on 09 Jun 2015
7 answers
238 views

Hi Team,

We are using Telerik Rad editor in our SharePoint 2013 environment and activated "Use RadEditor to edit HTML fields" feature to replace the default Rich Html editor with Rad Editor. When we edit a page and make any changes in Rad editor content and check in the page, sometimes Rad editor looses its content and blank page gets checked in.

Kindly suggest how can we resolve this issue.

Thanks & Regards,

Brijesh Patil

Ianko
Telerik team
 answered on 09 Jun 2015
1 answer
64 views

Hi There,

When looking for your client side documentation for RadComboBox today I notice that much of the API I am used to is not present. eg. set_text() and other accessors.

It appears there is only trackChanges and commitChanges listed as methods on the RadComboBox.

See http://docs.telerik.com/devtools/aspnet-ajax/controls/combobox/client-side-programming/objects/radcombobox-object

 

Just wondering where I can get access to this documentation online now.

 

Regards,

Daniel

Ivan Danchev
Telerik team
 answered on 09 Jun 2015
4 answers
819 views

Hi,

I am just wondering if there is full working example of a RadGrid with file download functionality anywhere?

My requirements are pretty simple - 

1. One of the grid columns will contain the actual name of the file (including extension) which I want to present as a clickable link (using asp:LinkButton maybe?).

2. Once the link is clicked the actual path to the physical file will have to be assembled in the code behind (don't want to expose file system details to the client apart from the file name).

3. The browser will allow the user to download the file in the normal way.

That's it. Just wondering if there is a good working example of this anywhere? Please let me know if any clarification is required. 

Thanks :)

Eyup
Telerik team
 answered on 09 Jun 2015
8 answers
1.4K+ views
Hello,

I'm having some trouble with getting the header column of the datagrid I'm exporting to excell to display what I want.  I have the grid display the header the way I want but when I export the grid the excel spread sheet has the header as the column names in my database table.  Can I change that so the spreadsheet headers say what I want?

Thanks,
Kirk
Eyup
Telerik team
 answered on 09 Jun 2015
2 answers
90 views

Hi,

I have developed an application with Telerik 2013 Q1. components. Previously the application was in .Net 3.5 . Now i have upgraded our application to .Net framework 4.0 and hosted our application in Win Server 2012 . The problem we are facing is, All the controls are working fine locally but after hosting. There is an issue with RadCombo. It is not rendering perfectly. or it became read only. we have dynamically populated the Radcombo.

RadCombo is not opening now.

Please help me, as we need this asap..

 

Thanks

Neel

Indranil
Top achievements
Rank 1
 answered on 09 Jun 2015
7 answers
173 views

I am using a radgrid to display data. I want to place a banner on the pdf file that gets downloaded.

this is my code:

<PageHeader>
<MiddleCell Text="<img src='Images/CME-Transcript-HeaderLong.jpg' />" TextAlign="Center" />

<RightCell TextAlign="Center" />
</PageHeader>

 

this inserts a small image in the center but I need it to be displayed as the same length as my radgrid on the pdf. How do I change the size of this image to make it a banner size?

 

Also, I am displaying some data generated dynamically in the middle of the header. I need to move it below the header but before the radgrid on the pdf. I need to display it in a horizontal line above the grid. How do I go about changing the position of data?

 

headerText += "<br /><span style='font-size:8px;font-family:Segoe UI;'>Report Date: " + DateTime.Now.Date.ToShortDateString() + "</span>" ;
headerText += "<br /><span style='font-size:8px; font-family:Segoe UI;'>" + lblParticipantName.Text + "</span>";
headerText += "<br /><span style='font-size:8px; font-family:Segoe UI;'>SDMS Member #: " + lblNo.Text + "</span>";

RadGrid1.ExportSettings.Pdf.PageHeader.RightCell.Text = headerText;

Thanks,

Kostadin
Telerik team
 answered on 09 Jun 2015
5 answers
274 views
i have use RadAutoCompleteBox control in asp.net. and  everything working fine but i have one problem.

when i type in autocomplete text both then its show me result in
dropdown and when i click out side of that dropdown (without select any
item from result) then first item automatically selected :(.

i don't need auto selection until i hit enter or click on item.

How can i do it?

Thanks,
Hiren Suthar
Plamen
Telerik team
 answered on 09 Jun 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?