Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
272 views
Hi,

I was hoping someone could help.  I have a radgrid that is populated by a list in code behind and have a checkbox in a Gridtemplate column. There is a button outside the grid that should collect all items that have checkbox checked and add results to a new db table.

This seem to work fine when grid is loaded and not filtered, however when the grid is filtered I get he following error:

Server Error in '/' Application.Collection was modified; enumeration operation may not execute.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

Source Error: 

Line 444: dbContext.SaveChanges();
Line 445:
Line 446: foreach (GridDataItem item in rgTracker.MasterTableView.Items)
Line 447: {
Line 448: CheckBox chkInvoiced = (CheckBox)item.FindControl("chkInvoiced");
Source File: e:\DropBox\Optimum Job tracker\Optimum\Pages\PensionLiteReport.aspx.cs    Line: 446 

Stack Trace: 

[InvalidOperationException: Collection was modified; enumeration operation may not execute.]
System.Collections.ArrayListEnumeratorSimple.MoveNext() +11165697
Optimum.Pages.PensionLiteReport.btnAddInvoice_Click(Object sender, EventArgs e) in e:\DropBox\Optimum Job tracker\Optimum\Pages\PensionLiteReport.aspx.cs:446
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +116
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +101
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9664630
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

Here is the button and radgrid:

<asp:LinkButton ID="btnAddInvoice" runat="server" CssClass="button small radius" Text="Add Checked to New Invoice" OnClick="btnAddInvoice_Click"></asp:LinkButton>
            <asp:Literal runat="server" ID="litAddInvoice"></asp:Literal>
            <div class="reset">
                 
                <telerik:RadGrid ID="rgTracker" runat="server"
                    AllowSorting="true" AllowPaging="true" PageSize="100" OnItemCreated="rgTracker_ItemCreated"
                    OnNeedDataSource="rgTracker_NeedDataSource"
                    AllowFilteringByColumn="True"
                    OnItemCommand="rgTracker_ItemCommand"
                    OnItemDataBound="rgTracker_ItemDataBound"
                    Skin="Windows7"
                     
                    OnPreRender="rgTracker_PreRender">
                    <ExportSettings HideStructureColumns="true">
                    </ExportSettings>
                    <GroupingSettings CaseSensitive="false" />
                    <MasterTableView AutoGenerateColumns="false" EnableHierarchyExpandAll="true" DataKeyNames="rdID, jobID" >
                         
                        <PagerStyle PageSizes="10,50,100,200,500" Mode="NextPrevAndNumeric" PageSizeLabelText="Show results: " Position="TopAndBottom" AlwaysVisible="true" />
                         
                        <Columns>
                            <telerik:GridBoundColumn DataField="rdID" Visible="false" ReadOnly="true" UniqueName="rdID" ForceExtractValue="Always" ConvertEmptyStringToNull="true"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="jobID" Visible="false" ReadOnly="true" UniqueName="jobID" ForceExtractValue="Always" ConvertEmptyStringToNull="true"></telerik:GridBoundColumn>
                            <telerik:GridHyperLinkColumn HeaderText="Customer Name" DataTextField="customerName" UniqueName="customerName" DataNavigateUrlFields="jobID" DataNavigateUrlFormatString="/pensionlitedetail/{0}" >
                                <HeaderStyle Width="150px" />
                            </telerik:GridHyperLinkColumn>
                            <telerik:GridBoundColumn HeaderText="Postcode" DataField="customerPostcode" UniqueName="customerPostcode" FilterControlWidth="30px" ReadOnly="true">
                                <HeaderStyle Width="50px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Phone" DataField="customerPhone" UniqueName="customerPhone" FilterControlWidth="70px" ReadOnly="true">
                                <HeaderStyle Width="90px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Pension Value" DataField="customerPensionValue" UniqueName="customerPensionValue" DataFormatString="{0:C}" FilterControlWidth="40px" ReadOnly="true">
                                <HeaderStyle Width="75px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridDateTimeColumn HeaderText="Sale Date" DataField="saleDate" UniqueName="saleDate" DataFormatString="{0:g}" PickerType="DatePicker" EnableRangeFiltering="true" FilterControlWidth="100px" EnableTimeIndependentFiltering="true" ReadOnly="true">
                                <HeaderStyle Width="120px" />
                            </telerik:GridDateTimeColumn>
                            <telerik:GridDateTimeColumn HeaderText="Appt Date" DataField="apptDate" UniqueName="apptDate" DataFormatString="{0:g}" PickerType="DatePicker" EnableRangeFiltering="true" FilterControlWidth="100px" EnableTimeIndependentFiltering="true" ReadOnly="true">
                                <HeaderStyle Width="120px" /></telerik:GridDateTimeColumn>
                            <telerik:GridDateTimeColumn HeaderText="Updated" DataField="updatedDate" UniqueName="updatedDate" DataFormatString="{0:g}" PickerType="DatePicker" EnableRangeFiltering="true" FilterControlWidth="100px" EnableTimeIndependentFiltering="true" ReadOnly="true">
                                <HeaderStyle Width="120px" /></telerik:GridDateTimeColumn>
                            <telerik:GridBoundColumn HeaderText="Current Status" DataField="currentStatus" UniqueName="currentStatus" ReadOnly="true">
                                <HeaderStyle Width="100px" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxStatus" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("currentStatus").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="StatusIndexChanged" Skin="Windows7" Width="200px">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                            <telerik:RadComboBoxItem Text="Lead Pending" Value="Lead Pending" />
                                            <telerik:RadComboBoxItem Text="Lead Accepted" Value="Lead Accepted" />
                                            <telerik:RadComboBoxItem Text="Lead Rejected" Value="Lead Rejected" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                        <script type="text/javascript">
                                            function StatusIndexChanged(sender, args) {
                                                var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                tableView.filter("currentStatus", args.get_item().get_value(), "EqualTo");
                                            }
                                         
                                        </script>
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Invoiced" DataField="invoiced" UniqueName="invoiced" Display="false" ForceExtractValue="Always" ReadOnly="true">
                                <HeaderStyle Width="50px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn UniqueName="InvoicedCheckboxColumn" AllowFiltering="false">
                                <HeaderStyle Width="20px" />
                                 
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkInvoiced" runat="server" />
                                </ItemTemplate>
                                <HeaderTemplate>
                                    Invoiced<br /><asp:CheckBox ID="chkInoicedHeader" runat="server" OnCheckedChanged="chkInoicedHeader_CheckedChanged" AutoPostBack="true" />
                                </HeaderTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn HeaderText="Credit" DataField="credited" UniqueName="credited" Display="false" ForceExtractValue="Always" ReadOnly="true">
                                <HeaderStyle Width="50px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn UniqueName="CreditedCheckboxColumn" AllowFiltering="false">
                                <HeaderStyle Width="20px" />
                                 
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkCredited" runat="server" />
                                </ItemTemplate>
                                <HeaderTemplate>
                                    Credited<br /><asp:CheckBox ID="chkCreditedHeader" runat="server" OnCheckedChanged="chkCreditedHeader_CheckedChanged" AutoPostBack="true" />
                                </HeaderTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                         
                    </MasterTableView>
                </telerik:RadGrid>
            </div>

and here is the related codebehind:

protected void rgTracker_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
             
 
            rgTracker.DataSource = GetData();
        }
 
        protected void rgTracker_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
 
        }
 
        protected void rgTracker_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                string cStatus = dataItem["currentStatus"].Text;
 
                if (cStatus == "Lead Rejected")
                {
                    dataItem.BackColor = Color.LightCoral;
                }
                if (cStatus == "Lead Accepted")
                {
                    dataItem.BackColor = Color.LightGreen;
                }
 
                CheckBox chkInvoiced = (CheckBox)e.Item.FindControl("chkInvoiced");
                string sInv = dataItem["invoiced"].Text;
                bool bInv = false;
                Boolean.TryParse(sInv, out bInv);
                if (bInv)
                {
                    chkInvoiced.Checked = true;
                    chkInvoiced.Enabled = false;
                }
 
                CheckBox chkCredited = (CheckBox)e.Item.FindControl("chkCredited");
                string sCred = dataItem["credited"].Text;
                bool bCred = false;
                Boolean.TryParse(sCred, out bCred);
                if (bCred)
                {
                    chkCredited.Checked = true;
                    chkCredited.Enabled = false;
                }
 
            }
        }
 
        protected void rgTracker_PreRender(object sender, EventArgs e)
        {
 
        }
 
        protected void rgTracker_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            GridFilteringItem filteringItem = e.Item as GridFilteringItem;
            if (filteringItem != null)
            {
                LiteralControl literalTo1 = filteringItem["saleDate"].Controls[3] as LiteralControl;
                literalTo1.Text = "<br />To:";
 
                LiteralControl literalTo2 = filteringItem["apptDate"].Controls[3] as LiteralControl;
                literalTo2.Text = "<br />To:";
 
                LiteralControl literalTo3 = filteringItem["updatedDate"].Controls[3] as LiteralControl;
                literalTo3.Text = "<br />To:";
            }
        }
 
        protected void chkInoicedHeader_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox headerCheckBox = (sender as CheckBox);
            foreach (GridDataItem dataItem in rgTracker.MasterTableView.Items)
            {
                if ((dataItem.FindControl("chkInvoiced") as CheckBox).Enabled)
                {
                    (dataItem.FindControl("chkInvoiced") as CheckBox).Checked = headerCheckBox.Checked;
                    dataItem.Selected = headerCheckBox.Checked;
                }
            }
        }
 
        protected void chkCreditedHeader_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox headerCheckBox = (sender as CheckBox);
            foreach (GridDataItem dataItem in rgTracker.MasterTableView.Items)
            {
                if ((dataItem.FindControl("chkCredited") as CheckBox).Enabled)
                {
                    (dataItem.FindControl("chkCredited") as CheckBox).Checked = headerCheckBox.Checked;
 
                    dataItem.Selected = headerCheckBox.Checked;
                }
            }
        }
 
        protected void btnAddInvoice_Click(object sender, EventArgs e)
        {
            //TODO: Wire in credits and check for duplicate sales
            Invoice inv = new Invoice();
 
            inv.ClientID = 11;
            inv.InvoiceDate = DateTime.Now;
 
            dbContext.Invoices.Add(inv);
            dbContext.SaveChanges();
             
            foreach (GridDataItem item in rgTracker.MasterTableView.Items)
            {
                CheckBox chkInvoiced = (CheckBox)item.FindControl("chkInvoiced");
                if (chkInvoiced.Checked && chkInvoiced.Enabled)
                {
                    //ReportDetails rd = (ReportDetails)item.DataItem;
 
                    //litAddInvoice.Text += string.Format("<div data-alert class='alert-box info radius'>{0} {1} - {2}</div>", rd.customerName, rd.customerPhone, rd.jobId);
 
                    string strJID = item.GetDataKeyValue("jobID").ToString();
                    litAddInvoice.Text += string.Format("<div data-alert class='alert-box info radius'>Job ID: {0}</div>", strJID);
 
                    int intJID = 0;
                    Int32.TryParse(strJID, out intJID);
 
                    Job j = new Job();
                    j = dbContext.Jobs.Where(x => x.ID == intJID).FirstOrDefault();
 
                    if (j.ID > 0)
                    {
                        InvoiceDetail id = new InvoiceDetail();
                        id.JobID = j.ID;
                        id.Credit = false;
                        id.JobSchemaID = j.JobSchemata.OrderByDescending(x => x.ID).Select(x => x.ID).FirstOrDefault();
                        id.StatusWhenInvoiced = j.JobSchemata.OrderByDescending(x => x.ID).Select(x => x.JobStage1.JobStage1).FirstOrDefault();
                        id.InvoiceID = inv.ID;
 
                        dbContext.InvoiceDetails.Add(id);
                        dbContext.SaveChanges();
                    }
                }
                CheckBox chkCredited = (CheckBox)item.FindControl("chkCredited");
                if (chkCredited.Checked && chkCredited.Enabled)
                {
                    //ReportDetails rd = (ReportDetails)item.DataItem;
 
                    //litAddInvoice.Text += string.Format("<div data-alert class='alert-box info radius'>{0} {1} - {2}</div>", rd.customerName, rd.customerPhone, rd.jobId);
 
                    string strJID = item.GetDataKeyValue("jobID").ToString();
                    litAddInvoice.Text += string.Format("<div data-alert class='alert-box warning radius'>Job ID: {0}</div>", strJID);
 
                    int intJID = 0;
                    Int32.TryParse(strJID, out intJID);
 
                    Job j = new Job();
                    j = dbContext.Jobs.Where(x => x.ID == intJID).FirstOrDefault();
 
                    if (j.ID > 0)
                    {
                        InvoiceDetail id = new InvoiceDetail();
                        id.JobID = j.ID;
                        id.Credit = true;
                        id.JobSchemaID = j.JobSchemata.OrderByDescending(x => x.ID).Select(x => x.ID).FirstOrDefault();
                        id.StatusWhenInvoiced = j.JobSchemata.OrderByDescending(x => x.ID).Select(x => x.JobStage1.JobStage1).FirstOrDefault();
                        id.InvoiceID = inv.ID;
 
                        dbContext.InvoiceDetails.Add(id);
                        dbContext.SaveChanges();
                    }
                }
 
                rgTracker.Rebind();
            }
 
            litAddInvoice.Text += "<div data-alert class='alert-box success radius'>Invoice Generated</div>";
        }

Any help would be greatly appreciated

Cheers

Dale
Kostadin
Telerik team
 answered on 11 Nov 2014
2 answers
417 views
Hi Team,

I am using the telerik dll version of 2014.2.724.45

I am facing one issue while editing the grid.

Let me explain the issue.

I have a grid with 5 columns in it and has some data populated. I am implementing batch editing(with batch editing type=cell) for this grid.

When I click on the add new record I am  inserting a new row, here I don't have any issue.
While updating the record I want to make one column non editable, other columns are editable.
How can I achieve this.Please see the aspx and .cs files below

ASPX FILE:

<telerik:RadGrid ID="DischargeRadGrid"   OnItemDataBound="DsichargeRadGridFormat_OnItemDataBound" runat="server" AutoGenerateColumns="false"
                            CssClass="TransferGridPanel" Height="370px" Width="500px" OnItemCommand="DischargeRadGrid_ItemCommand"
                            OnBatchEditCommand="DischargeRadGrid_BatchEditCommand">
                           <MasterTableView ShowHeadersWhenNoRecords="true" CommandItemDisplay="Top" EditMode="Batch" DataKeyNames="Discharge_ID">
                            <CommandItemSettings ShowRefreshButton="false" AddNewRecordText="Add NewDelivery" />
                               <BatchEditingSettings EditType="Cell" />
                                                                 <Columns>
                                    <telerik:GridBoundColumn  UniqueName="DeliveryNo" DataField="Discharge_ID">
                                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                            <RequiredFieldValidator ForeColor="Red" Text="*This field is required" Display="Dynamic">                               
                                            </RequiredFieldValidator>
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn  UniqueName="ShipTo"
                                        DataField="Site_ID">
                                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                            <RequiredFieldValidator ForeColor="Red" Text="*This field is required" Display="Dynamic">                               
                                            </RequiredFieldValidator>
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn  UniqueName="ShipToName"
                                        DataField="SiteAddress" ReadOnly="true">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn  UniqueName="DischargeStart"
                                        DataField="DischargeStartTime" ReadOnly="true">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn  UniqueName="DischargeEnd"
                                        DataField="DischargeEndTime">
                                    </telerik:GridBoundColumn>
                                   
                                </Columns>
                            </MasterTableView>
                            <ClientSettings>                           
                           
                            <Scrolling AllowScroll="true"/>
                               
                            </ClientSettings>
                        </telerik:RadGrid>


ASPX.CS FILE


 protected void DischargeRadGrid_BatchEditCommand(object source, GridBatchEditingEventArgs e)
    {
        foreach (GridBatchEditingCommand command in e.Commands)
        {
           
            Hashtable newValues = command.NewValues;
            Hashtable oldValues = command.OldValues;
            string newDischargeId = newValues["Discharge_ID"].ToString();
           
            string newShipTo = newValues["Site_ID"].ToString();
           
            DateTime? dischargeStartTime = DateTime.Now;
            DateTime? dischargeEndTime = DateTime.Now;
            Int32 dropindex;
            Int64 shipmentID = Convert.ToInt64(ShiftTreeView.SelectedNode.Value);
            dropindex = dischargeManager.GetDropIndexCountByDishargeId(shipmentID);
            List<DischargeEntity> dischargeDetails = new List<DischargeEntity>();
            dischargeDetails = dischargeManager.GetDischargeByShipmentId(shipmentID);
            if (command.Type == GridBatchEditingCommandType.Update)
            {
              
                RadWindowManager1.RadConfirm(HTMLEncoder.Encode(MyGlobal.SDP_ALERT_WHILE_UPDATE_LOAD), "confirmCallBackFn", 400, 100, null, null);
              
                var DischargeDal = new DischargeDal();               
                var discharge = new DischargeEntity
                {
                    Discharge_ID = Convert.ToInt64(newDischargeId),
                    Site_ID = Convert.ToInt64(newShipTo),
                    Job_ID = new Guid(),
                    Shipment_ID = shipmentID,
                    Planned = false,                   
                    DropIndex = dropindex,
                    Urgency = dischargeDetails[0].Urgency,
                    DischargeStartTime = dischargeStartTime,
                    DischargeEndTime = dischargeEndTime,                };
                discharge.Discharge_ID = DischargeDal.UpdateDischargeByDischargeId(discharge).Discharge_ID;
                dischargeDetailWsList = new List<DischargeDetailExtraEntity>();
                dischargeDetailWsList = dischargeDetailManager.GetDischargesByShipmentId(Convert.ToInt64(ShiftTreeView.SelectedNode.Value));
                DischargeRadGrid.DataSource = dischargeDetailWsList;
                DischargeRadGrid.DataBind();
            }
            if (command.Type == GridBatchEditingCommandType.Insert)
            {
               
               RadWindowManager1.RadConfirm(HTMLEncoder.Encode(MyGlobal.SDP_ALERT_WHILE_ADD_NEW_LOAD), "confirmCallBackFn", 400, 100, null, null);
               List<DischargeEntity> currentList = (List<DischargeEntity>)Session[_sesDischargeList];              
               DischargeEntity de = currentList[0];
                var DischargeDal = new DischargeDal();              
                if(!(Boolean)de.Planned)
                {
                   
                }
                var discharge = new DischargeEntity
                {
                    Job_ID = new Guid(),
                    Discharge_ID = Convert.ToInt64(newDischargeId),
                    Shipment_ID = shipmentID,
                    DropIndex = dropindex,
                    Site_ID = Convert.ToInt64(newShipTo),
                    Planned = false,
                    PONumber = dischargeDetails[0].PONumber,
                    Urgency = dischargeDetails[0].Urgency,
                    DischargeStartTime = dischargeStartTime,
                    DischargeEndTime=dischargeEndTime,
                };
                discharge.Discharge_ID = DischargeDal.CreateDischarge(discharge).Discharge_ID;
                dischargeDetailWsList = new List<DischargeDetailExtraEntity>();
                dischargeDetailWsList = dischargeDetailManager.GetDischargesByShipmentId(Convert.ToInt64(ShiftTreeView.SelectedNode.Value));
                DischargeRadGrid.DataSource = dischargeDetailWsList;
                DischargeRadGrid.DataBind();            
            }
            if (command.Type == GridBatchEditingCommandType.Delete)
            {
                //perform delete
            }
        }
    }


Please send me the answer asap.it is very urgent.
Thanks in advance.
Pavlina
Telerik team
 answered on 11 Nov 2014
1 answer
99 views
Scenario

I am creating a user control that contains a RadGrid. The user control will have properties that specify the order of the columns in the RadGrid. I plan on using code similar to the snippet taken from http://www.telerik.com/help/aspnet-ajax/grid-reordering-columns.html

GridColumnCollection cols = grid.MasterTableView.Columns;
GridColumn c = cols.FindByUniqueName(columnName);
if (c != null){
    int start = c.OrderIndex;
    for (int i= start; i < cols.Count; i++) 
    {
        c = cols[i];
        if (i < cols.Count - 1)  
            c.OrderIndex = i+1;
        else    
            c.OrderIndex = start; 
    }
}

Question
1. At what point in the pages life cycle should the code be executed? (i.e. page_load, page_init etc)
2. If I do not want to execute the code based on the page lifecycle, are there event(s) based on the RadGrid's life cycle that can be used to execute the code? (i.e. RadGrid1_Init, RadGrid1_Load, RadGrid1_PreRender, RadGrid1_ColumnCreated etc)
3. Any gotcha's I should be aware about?
Kostadin
Telerik team
 answered on 11 Nov 2014
0 answers
78 views
hi all,

as per title, how to make this possible?

var newDataSource=new kendo.data.DataSource({
                    transport : {
                      read : {
                        url : context+"/master/common/listLocationByCountry/"+data.country.id+"?marketDifferentialId="+data.id+"&locationId="+data.location.id
                      }
                    }
              });
              newDataSource.read();
              var locationName = data.location.name;
              var locationValue=data.location.id;
              var locationDropDown = $("#locationId").data("kendoDropDownList");         
              locationDropDown.setOptions({ dataTextField: "name", dataValueField: "id" });
              locationDropDown.setDataSource(newDataSource);
              $("#locationId").val(locationValue).data("kendoDropDownList").text(locationName);


the problem is the dropdown is still access url from old datasource to pupolate.

thanks
Erik
Top achievements
Rank 1
 asked on 11 Nov 2014
1 answer
79 views
I got that error when I am building a menu based on a sqlDataSource with the following SelectCommand:
SelectCommand="SELECT '1' AS id, null as pid, 'A&SI' AS text, '' as url
UNION ALL
SELECT '2', null, 'P&P',''
UNION ALL
SELECT '3', null, 'T&E',''
UNION ALL
SELECT '4', null, 'FTR',''
">

However, it works if I add two union statements like below to the end:
SelectCommand="SELECT '1' AS id, null as pid, 'A&SI' AS text, '' as url
UNION ALL
SELECT '2', null, 'P&P',''
UNION ALL
SELECT '3', null, 'T&E',''
UNION ALL
SELECT '4', null, 'FTR',''
UNION ALL
SELECT '7', null, '',''
UNION ALL
SELECT '8', '7', '',''
">

The selectcommand eventually will be replaced by a stored procedure and I do not want to fix the problem by manipulating the procedure using dirty tricks like this.

Any ideas? Thanks!!
Boyan Dimitrov
Telerik team
 answered on 10 Nov 2014
10 answers
194 views
Hi

I'm facing a problem with radgrid while using frozen column.

Frozen column works fine when used with horizontal scroll bar, but when i traverse the grid using Tab button (through keyboard) the frozen column doesn't works also the scroll bar position remains fixed.

Any help in this regard would be highly appreciated.

Thanks
Gaurav

Pavlina
Telerik team
 answered on 10 Nov 2014
1 answer
173 views
Windows 7 pro x64
VS2008 web page
Telerik UI for ASP.NET AJAX Q2 2014 - Bin35


In this simple page, there is a context menu with 3 items
the third item uses a content template.
Right click over the text to show the context menu.
The third item does not show up in the browser but is rendered along with an empty iframe. why?

my goal is to put some text and a textbox (html element) where the text would normally be in a radMenuItem.
something like
<content Template>part number contains: <input type="textbox" /></contentTemplate>
so that the user can right-click and click in the textbox and type something in. (I can catch the ENTER keystroke and do the post back)

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test_rad_context_menu.aspx.vb" Inherits="test_austin_test_rad_context_menu" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
   <telerik:RadScriptManager runat="server" />
   
   <div id="content">
right click over me. There should be 3 items.<br />
right click over me. There should be 3 items.<br />
right click over me. There should be 3 items.<br />
right click over me. There should be 3 items.<br />
right click over me. There should be 3 items.<br />
   </div>

    <telerik:RadContextMenu runat="server" ID="ctxTest">
<ExpandAnimation Type="None" />
<CollapseAnimation Type="None" />
<Items>

<telerik:RadMenuItem Value="1" Text="item 1 of 3" />
<telerik:RadMenuItem Value="2" Text="item 2 of 3" />

<telerik:RadMenuItem Value="3">
<ContentTemplate>item 3 of 3</ContentTemplate>
</telerik:RadMenuItem>

</Items>
<Targets>
<telerik:ContextMenuElementTarget ElementID="content" />
</Targets>
</telerik:RadContextMenu>
    </form>
</body>
</html>








Boyan Dimitrov
Telerik team
 answered on 10 Nov 2014
3 answers
109 views
Hello,

I am using the control to replace a old control we made ourself and that have the same behaviour as this DropDownTree. I have suscceeded yto d pretty much everything I wanted. There is only one thing I want to do, I want all the node to collapse when the filter is empty.
I have tried several solutions, my closest one is this one, but is not working proprely. Sometimes it works, sometimes it does not :

I have attached to the DropDownTree OnClientLoad client side event this function :

function loadTreeView(sender, args) {
var dropdowntree1 = $find("<%=ddtList.ClientID%>");
var tree = dropdowntree1.get_embeddedTree();
$(".rddtFilterInput").keyup(function () {
if ($(".rddtFilterInput").val() == '')
treeCollapseAllNodes(tree);
}
 
I've tryed that too : $(".rddtFilterInput").on('input',function () {...}); But no success either...

I can see that it collapse the nodes but right after they are expanding again. 
I also tried to cancel the OnClientNodeExpanding event when the filter is empty but no success here either...

Do you have any solutions that realize what i'm trying to do ?

Thanks
Boyan Dimitrov
Telerik team
 answered on 10 Nov 2014
2 answers
102 views
I have an issue when trying to set up grouping in the code behind (vb.net) in that the data does not appear. 
If I set up the grouping on the aspx page the records show up.  
I have tried adding the datasource and databind before and after this code but I never get any records to appear.
I want to be able to dynamically turn certain grouping on or off depending on the user selection.
Can you tell me why the records are not showing up when I use the code behind page to create the grouping?   

        RadGrid1.MasterTableView.GroupByExpressions.Clear()
        Dim ShowFacilities As CheckBox = ctlOptions.FindControl("cbShowFacilities")
        If ShowFacilities.Checked Then
            Dim ge1 As New Telerik.Web.UI.GridGroupByExpression
            Dim gf1 As New Telerik.Web.UI.GridGroupByField
            gf1.FieldName = "Facility"
            gf1.HeaderValueSeparator = String.Empty
            gf1.HeaderText = "Facility - "
            ge1.SelectFields.Add(gf1)
            RadGrid1.MasterTableView.GroupByExpressions.Add(ge1)

            Dim ge2 As New Telerik.Web.UI.GridGroupByExpression
            Dim gf2 As New Telerik.Web.UI.GridGroupByField
            gf2.FieldName = "Name"
            gf2.HeaderValueSeparator = String.Empty
            gf2.HeaderText = "&nbsp;"
            ge2.SelectFields.Add(gf2)
            RadGrid1.MasterTableView.GroupByExpressions.Add(ge2)

        Else
            Dim ge2 As New Telerik.Web.UI.GridGroupByExpression
            Dim gf2 As New Telerik.Web.UI.GridGroupByField
            gf2.FieldName = "Name"
            gf2.HeaderValueSeparator = String.Empty
            gf2.HeaderText = "&nbsp;"
            ge2.SelectFields.Add(gf2)
            RadGrid1.MasterTableView.GroupByExpressions.Add(ge2)

        End If

RadGrid1.DataSource = MyDataSource
RadGrid1.DataBind

Patrick
Top achievements
Rank 1
 answered on 10 Nov 2014
5 answers
263 views
Hi all
I'm using radgrid in my website.
Im loading radgrid for radpanelbar in foue radpanel items which means one radgrid for one tab.
I'm refreshing the this page for every 15 secs ,every time on refresh.
So when I see the memoryusage of IE in taskmanager its keep on increasing for every 15 or 13 secs like that.
But I'm not loading any extra data on refresh.
Pls help me in this since this is considered as critical from my client.
and I have same issue in two pages.
Help me asap pls.
Pavlina
Telerik team
 answered on 10 Nov 2014
Narrow your results
Selected tags
Tags
+124 more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?