Telerik Forums
UI for ASP.NET AJAX Forum
17 answers
545 views
Hi there,

I have been searching all over the forum, however, couldn't find out the solution to fix my similar case as follow:

Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The 'body' start tag on line 674 position 6 does not match the end tag of 'td'. Line 689, position 39.
at line:
</td><td style="white-space:nowrap;">

I will paste my code below:

ASPX:
001.<div id="print_area">
002.                    <asp:ImageButton ID="DownloadCSV" ImageUrl="images/file-extension-csv-icon.png"
003.                        OnClick="DownloadCSV_Click" runat="server" CssClass="ImageButtons" />
004.                    <asp:ImageButton ID="DownloadPDF" runat="server" OnClick="DownloadPDF_Click" ImageUrl="images/file-extension-pdf-icon.png"
005.                        CssClass="pdfButton"></asp:ImageButton>
006.                    <br />
007.                    <telerik:RadGrid AutoGenerateColumns="False" ID="RadGrid1" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" runat="server" OnItemCommand="RadGrid1_ItemCommand" OnItemCreated="RadGrid1_ItemCreated" EnableLinqExpressions="true" HtmlEncode="true" OnPdfExporting="RadGrid1_PdfExporting"
008.                        ShowGroupPanel="True" CellSpacing="-1" GridLines="Both" Skin="Office2010Silver" Width="100%">
009.                        <PagerStyle Mode="NextPrevAndNumeric" />
010.                        <GroupingSettings CaseSensitive="false" />
011.                        <ClientSettings AllowKeyboardNavigation="true">
012.                        </ClientSettings>
013.                        <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
014.                            <Pdf PageHeight="210mm" PageWidth="297mm" DefaultFontFamily="Arial Unicode MS" PageTopMargin="45mm"
015.                                BorderStyle="Medium" BorderColor="#666666" PaperSize="A4">
016.                            </Pdf>
017.                        </ExportSettings>
018.                        <MasterTableView Width="100%" DataKeyNames="JobID" HierarchyLoadMode="ServerOnDemand">
019.                            <Columns>
020.                                <telerik:GridMaskedColumn DataField="JobID" HeaderText="JobID#"
021.                                    FilterControlWidth="50px" AutoPostBackOnFilter="false" CurrentFilterFunction="EqualTo"
022.                                    FilterDelay="2000" ShowFilterIcon="false" Mask="#####">
023.                                    <ColumnValidationSettings>
024.                                        <ModelErrorMessage Text=""></ModelErrorMessage>
025.                                    </ColumnValidationSettings>
026.                                </telerik:GridMaskedColumn>
027.                                <telerik:GridBoundColumn HeaderText="Customer Ref No" DataField="JobCustomerRefNo" UniqueName="JobCustomerRefNo"
028.                                    SortExpression="JobCustomerRefNo" HeaderStyle-Width="180px" FilterControlAltText="Filter JobCustomerRefNo column">
029.                                    <ColumnValidationSettings>
030.                                        <ModelErrorMessage Text=""></ModelErrorMessage>
031.                                    </ColumnValidationSettings>
032. 
033.                                </telerik:GridBoundColumn>
034.                                <telerik:GridBoundColumn DataField="JobTitle" FilterControlAltText="Filter JobTitle column" HeaderText="Job Title" SortExpression="JobTitle" UniqueName="JobTitle">
035.                                    <ColumnValidationSettings>
036.                                        <ModelErrorMessage Text="" />
037.                                    </ColumnValidationSettings>
038.                                </telerik:GridBoundColumn>
039.                                <telerik:GridDateTimeColumn DataField="JobBookedDate" PickerType="DatePicker" EnableTimeIndependentFiltering="true"
040.                                    DataFormatString="{0:dd/MM/yyyy HH:mm }" DataType="System.DateTime" FilterControlAltText="Filter JobBookedDate column" HeaderText="Job Booked Date" SortExpression="JobBookedDate" UniqueName="JobBookedDate">
041.                                    <ColumnValidationSettings>
042.                                        <ModelErrorMessage Text="" />
043.                                    </ColumnValidationSettings>
044.                                </telerik:GridDateTimeColumn>
045.                                <telerik:GridBoundColumn DataField="JobAddress1" FilterControlAltText="Filter JobAddress1 column" HeaderText="Address" SortExpression="JobAddress1" UniqueName="JobAddress1">
046.                                    <ColumnValidationSettings>
047.                                        <ModelErrorMessage Text="" />
048.                                    </ColumnValidationSettings>
049.                                </telerik:GridBoundColumn>
050.                                <telerik:GridBoundColumn DataField="JobSuburb" FilterControlAltText="Filter JobSuburb column" HeaderText="Suburb" SortExpression="JobSuburb" UniqueName="JobSuburb">
051.                                    <ColumnValidationSettings>
052.                                        <ModelErrorMessage Text="" />
053.                                    </ColumnValidationSettings>
054.                                </telerik:GridBoundColumn>
055.                                <telerik:GridBoundColumn DataField="JobPostCode" FilterControlAltText="Filter JobPostCode column" HeaderText="PostCode" SortExpression="JobPostCode" UniqueName="JobPostCode">
056.                                    <ColumnValidationSettings>
057.                                        <ModelErrorMessage Text="" />
058.                                    </ColumnValidationSettings>
059.                                </telerik:GridBoundColumn>
060.                                <telerik:GridBoundColumn DataField="JobState" FilterControlAltText="Filter JobState column" HeaderText="State" SortExpression="JobState" UniqueName="JobState">
061.                                    <ColumnValidationSettings>
062.                                        <ModelErrorMessage Text="" />
063.                                    </ColumnValidationSettings>
064.                                </telerik:GridBoundColumn>
065.                                <telerik:GridTemplateColumn DataField="JobStatusID" HeaderText="Status Type" UniqueName="JobStatusID"
066.                                    HeaderStyle-Width="200px" SortExpression="JobStatusID">
067.                                    <FilterTemplate>
068.                                        <telerik:RadComboBox ID="comboJobStatus" DataTextField="JobStatusName"
069.                                            DataValueField="JobStatusID" Height="100px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("JobStatusID").CurrentFilterValue %>'
070.                                            runat="server" OnClientSelectedIndexChanged="JobStatusIndexChanged">
071.                                            <Items>
072.                                                <telerik:RadComboBoxItem Text="All" />
073.                                            </Items>
074.                                        </telerik:RadComboBox>
075.                                        <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
076.                                            <script type="text/javascript">
077.                                                function JobStatusIndexChanged(sender, args) {
078.                                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
079.                                                    tableView.filter("JobStatusID", args.get_item().get_value(), "EqualTo");
080.                                                }
081.                                            </script>
082.                                        </telerik:RadScriptBlock>
083.                                    </FilterTemplate>
084.                                    <ItemTemplate>
085.                                        <%# Eval("JobStatus") %>
086.                                    </ItemTemplate>
087.                                </telerik:GridTemplateColumn>
088.                                                               <telerik:GridTemplateColumn DataField="ClientID" HeaderText="Client" UniqueName="ClientID"
089.                                    HeaderStyle-Width="200px" SortExpression="ClientID">
090.                                    <FilterTemplate>
091.                                        <telerik:RadComboBox ID="comboClient" DataTextField="ClientName"
092.                                            DataValueField="ClientID" Height="100px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ClientID").CurrentFilterValue %>'
093.                                            runat="server" OnClientSelectedIndexChanged="ClientIndexChanged">
094.                                            <Items>
095.                                                <telerik:RadComboBoxItem Text="All" />
096.                                            </Items>
097.                                        </telerik:RadComboBox>
098.                                        <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
099.                                            <script type="text/javascript">
100.                                                function ClientIndexChanged(sender, args) {
101.                                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
102.                                                    tableView.filter("ClientID", args.get_item().get_value(), "EqualTo");
103.                                                }
104.                                            </script>
105.                                        </telerik:RadScriptBlock>
106.                                    </FilterTemplate>
107.                                    <ItemTemplate>
108.                                        <%# Eval("Client") %>
109.                                    </ItemTemplate>
110.                                </telerik:GridTemplateColumn>
111.                                <telerik:GridTemplateColumn DataField="AssignedStaffID" HeaderText="Staff" UniqueName="AssignedStaffID"
112.                                    HeaderStyle-Width="200px" SortExpression="AssignedStaffID">
113.                                    <FilterTemplate>
114.                                        <telerik:RadComboBox ID="comboStaff" DataTextField="StaffName"
115.                                            DataValueField="StaffID" Height="100px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("AssignedStaffID").CurrentFilterValue %>'
116.                                            runat="server" OnClientSelectedIndexChanged="StaffIndexChanged">
117.                                            <Items>
118.                                                <telerik:RadComboBoxItem Text="All" />
119.                                            </Items>
120.                                        </telerik:RadComboBox>
121.                                        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
122.                                            <script type="text/javascript">
123.                                                function StaffIndexChanged(sender, args) {
124.                                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
125.                                                    tableView.filter("AssignedStaffID", args.get_item().get_value(), "EqualTo");
126.                                                }
127.                                            </script>
128.                                        </telerik:RadScriptBlock>
129.                                    </FilterTemplate>
130.                                    <ItemTemplate>
131.                                        <%# Eval("AssignedStaff") %>
132.                                    </ItemTemplate>
133.                                </telerik:GridTemplateColumn>
134.                            </Columns>
135.                            <NestedViewTemplate>
136.                                <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
137.                                    <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
138.                                        <telerik:RadPageView runat="server" ID="PageView1">
139.                                            <telerik:RadGrid runat="server" ID="JobStatusGrid">
140.                                                <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
141.                                                    DataKeyNames="JobStatusHistoryID" PageSize="7" HierarchyLoadMode="ServerOnDemand">
142.                                                    <Columns>
143.                                                        <telerik:GridBoundColumn HeaderText="Status Type" HeaderButtonType="TextButton"
144.                                                            DataField="JobStatus" UniqueName="JobStatusID">
145.                                                        </telerik:GridBoundColumn>
146.                                                        <telerik:GridBoundColumn HeaderText="Created By" HeaderButtonType="TextButton"
147.                                                            DataField="CreatedBy" UniqueName="CreatedBy">
148.                                                        </telerik:GridBoundColumn>
149.                                                        <telerik:GridBoundColumn HeaderText="Created On" HeaderButtonType="TextButton"
150.                                                            DataField="CreatedOn" UniqueName="CreatedOn">
151.                                                        </telerik:GridBoundColumn>
152.                                                    </Columns>
153.                                                </MasterTableView>
154.                                            </telerik:RadGrid>
155.                                        </telerik:RadPageView>
156.                                    </telerik:RadMultiPage>
157.                                </asp:Panel>
158.                            </NestedViewTemplate>
159.                        </MasterTableView>
160.                        <ClientSettings AllowDragToGroup="true">
161.                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
162.                        </ClientSettings>
163.                    </telerik:RadGrid>
164.                </div>

ASPX.CS

01.protected void DownloadPDF_Click(object sender, System.EventArgs e)
02.        {
03.            isPdfExport = true;
04.            RadGrid Grid1 = (RadGrid)Page.Master.FindControl("MainContent").FindControl("RadGrid1");
05.            Grid1.ExportSettings.Pdf.AllowPrinting = true;
06.            Grid1.ExportSettings.Pdf.AllowModify = true;
07.            Grid1.ExportSettings.Pdf.AllowCopy = true;
08.            Grid1.ExportSettings.Pdf.AllowAdd = true;
09.            Grid1.ExportSettings.Pdf.DefaultFontFamily = "Helvetica";
10.            Grid1.ExportSettings.Pdf.PageLeftMargin = new Unit(2, UnitType.Mm);
11.            Grid1.ExportSettings.Pdf.PageRightMargin = new Unit(2, UnitType.Mm);
12.            Grid1.ExportSettings.Pdf.PageHeaderMargin = new Unit(0, UnitType.Mm);
13.            Grid1.ExportSettings.Pdf.PaperSize = GridPaperSize.Legal;
14.            Grid1.ExportSettings.Pdf.PageHeight = Unit.Parse("210mm");
15.            Grid1.ExportSettings.Pdf.PageWidth = Unit.Parse("420mm");
16. 
17.            foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns)
18.            {
19.                if (col.UniqueName != "MiddleInitial")
20.                {
21.                    col.HeaderStyle.Width = Unit.Pixel(50);
22.                }
23.            }
24.            Grid1.MasterTableView.ExportToPdf();
25.        }
01.protected void RadGrid1_PdfExporting(object sender, GridPdfExportingArgs e)
02.{
03.    StringBuilder customHTML = new StringBuilder();
04.    customHTML.Append("<p style='color: red; font-weight: bold; font-size: 10pt;'>Title Page</p>");
05.    customHTML.Append("<table style='font-family:Helvetica;font-size:9pt;width:500px;'>");
06.    customHTML.Append("<tr><td>Customer: aaa 1</td><td>Date: bbbb 2</td></tr>");
07.    customHTML.Append("<tr><td>Address: aaa 1</td><td>Email: bbbb 2 </td></tr>");
08.    customHTML.Append("<tr><td>City: aaa 1</td><td>Phone: bbbb 2 </td></tr>");
09.    customHTML.Append("<tr><td>State: aaa 1</td><td>Zip: bbbb 2 </td></tr>");
10.    customHTML.Append("</table>");
11.    e.RawHTML = customHTML + e.RawHTML;
12.}

Cheers
Kostadin
Telerik team
 answered on 05 Oct 2015
2 answers
144 views

I don't know what happened, we had it working but with some UI changes, it stopped working properly.  So, I tried to create a new file, to rule out all the CSS, and to isolate just the RadTreeView and it's still not behaving as expected.  Here's what I have in the .aspx page.

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SearchForm.aspx.cs" Inherits="Cnet_Forum.SearchForm" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:radscriptmanager runat="server" id="RadScriptManager1">
        <Scripts>
            <asp:ScriptReference Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                Name="MicrosoftAjax.js" Path="https://ajax.microsoft.com/ajax/4.0/MicrosoftAjax.js" />
        </Scripts>
    </telerik:radscriptmanager>
    <div>
    <div class="panel-expand">
                <telerik:RadTreeView ID="area_tree_view" runat="server" runat="server" CheckBoxes="True" TriStateCheckBoxes="True" 
                    CheckChildNodes="true" MultipleSelect="True" >
                </telerik:RadTreeView>
            </div>
    </div>
    </form>
</body>
</html>

And the code-behind page:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DbforumData;
using DbforumData.dataset;
using Telerik.Web.UI;

namespace Cnet_Forum
{
    public partial class SearchForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.ConnectionStrings["db"].ConnectionString;
            CandidateDataSource datasource = new CandidateDataSource(db);
            FunctionGroupDataSet functionset = datasource.GetFunctionGroup();
            datasource.Dispose();

            LoadSubjectGrid(functionset);
        }


        protected void LoadSubjectGrid(FunctionGroupDataSet functionset)
        {
            DataRow[] results;


            var view = area_tree_view;
            RadTreeNode groupNode, functionNode;

            foreach (var grouprow in functionset.FunctionGroup) // the parent node
            {
                results = functionset.Function.Select("parentNodeId = " + grouprow.function_group_id);

                groupNode = new RadTreeNode(grouprow.function_group_name, grouprow.function_group_id.ToString())
                {
                    Expanded = false,
                    Checkable = true
                };

                view.Nodes.Add(groupNode);

                foreach (DataRow functionRow in results) //the chile nodes
                {
                    functionNode = new RadTreeNode((string)functionRow["childNodeName"], Convert.ToString(functionRow["childNodeId"]));
                    groupNode.Nodes.Add(functionNode);
                }
            }
        }
    }
}

Obviously you can't run it because it requires db connection but you get the idea.

 

Dimitar Terziev
Telerik team
 answered on 05 Oct 2015
8 answers
313 views

I have a hierarchy grid with a GridClientSelectColumn in the child grid & I'm trying to select the boxes that meet user selected criteria on the page. ​I am able search through the children of the first parent row & select the matching record(s), but ​after finding the match it loses reference to the parent row & gives me an error stating it "Cannot find a cell bound to column name 'ProjectID'". When I step through the code, I see that ​the key value of my GridDataItem is no longer pointing to the ID of the parent (ProjectID), but to the child (DataElementID)! While stepping through the code, if I allow things to bypass the error & iterate through a few times, it will eventually return to the key value to the parent & then find the next match. ??? 

Can someone please explain to me why this is happening?

Here is a snippet of my code...

<telerik:RadGrid ID="RadGrid1" runat="server" ShowStatusBar="false" AutoGenerateColumns="False" PageSize="50" AllowSorting="True" AllowMultiRowSelection="true" AllowPaging="false" GridLines="none" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource" Width="700px" ClientSettings-Scrolling-AllowScroll="true" OnPreRender="RadGrid1_PreRender"  ClientSettings-Scrolling-UseStaticHeaders="true" OnItemDataBound="RadGrid1_ItemDataBound" >
 
    <MasterTableView DataKeyNames="ProjectID" AllowMultiColumnSorting="false" HierarchyLoadMode="ServerBind" >
 
        <DetailTables>
            <telerik:GridTableView DataKeyNames="DataElementID" Name="DataElementID" Width="100%">
                <%-- Child --%>
                <HeaderStyle Font-Bold="true"/>
                <Columns>
                    <telerik:GridClientSelectColumn UniqueName="deSelectColumn" HeaderStyle-Width="5%" ></telerik:GridClientSelectColumn>
                    <telerik:GridTemplateColumn UniqueName="first" HeaderText="1st" HeaderStyle-Width="5%"
                      <ItemTemplate
                          <asp:CheckBox ID="CheckBox1" runat="server" /> 
                      </ItemTemplate
                    </telerik:GridTemplateColumn
                    <telerik:GridBoundColumn DataField="DataElementID" UniqueName="DataElementID" HeaderText="Data Element ID" DataType="System.Int16" HeaderStyle-Width="20%" Display="true" />
                    <telerik:GridBoundColumn DataField="ProjectAreaDescription" UniqueName="ProjectAreaDescription" HeaderText="Project Area Description" DataType="System.String" HeaderStyle-Width="40%" />
                    <telerik:GridBoundColumn DataField="ProjectDataType" UniqueName="ProjectDataType" HeaderText="Project Data Type" DataType="System.String" HeaderStyle-Width="30%" />
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
 
        <%-- Parent --%>
        <HeaderStyle Font-Bold="true"/>
        <Columns>
            <telerik:GridBoundColumn DataField="ProjectID" UniqueName="ProjectID" HeaderText="Project ID" DataType="System.Int16" Groupable="true" HeaderStyle-Width="20%" Display="true" />
            <telerik:GridBoundColumn DataField="ProjectNumber" UniqueName="ProjectNumber" HeaderText="Project Number" SortExpression="ProjectNumber" DataType="System.String" HeaderStyle-Width="20%" />
            <telerik:GridBoundColumn DataField="ContractNumber" UniqueName="ContractNumber" HeaderText="Contract Number" SortExpression="ContractNumber" DataType="System.String" HeaderStyle-Width="20%" />
            <telerik:GridBoundColumn DataField="ProjectName" UniqueName="ProjectName" HeaderText="Project Name" SortExpression="ProjectNumber" DataType="System.String" HeaderStyle-Width="40%" />
        </Columns>
 
    </MasterTableView>
 
    <ClientSettings>
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
        <Resizing AllowColumnResize="false" />
        <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true" />
    </ClientSettings>
 
</telerik:RadGrid>

 

The following code is part of a button click that performs other operations & then performs the selection of the child records that meet the criteria. At the time of selecting the records, I know the value of both the ProjectID (​parent) ​& DataElementID (child). Either way, when I perform the selection I'm running into errors. By the way, currently there are about 700 child records rolled up into about 250 parents.

For Each radRow As GridDataItem In RadGrid1.Items
 
 Dim strID As String = Nothing
 strID = radRow("ProjectID").Text
 
 For i = 0 To arrProjectID.Count - 1
    If strID = arrProjectID(i).ToString Then
       radRow.Expanded = True
       radRow.ChildItem.NestedTableViews(0).Items(0).Selected = True
       Exit For
    End If
 Next
Next
 

Thanks, in advance, for your assistance!

Tonya :)

 

 

Tonya
Top achievements
Rank 1
 answered on 03 Oct 2015
12 answers
103 views

I have EnableMultiSelect=False. I am showing multiple months in the view. On the other months you can select multiple dates. Why is that? How to I disable that too?

 On September if I select a second date it automatically unselects the initial one. Why does it no do that for October?

Maria Ilieva
Telerik team
 answered on 02 Oct 2015
3 answers
147 views

Hi,

I am using Telerik Radgrid version 2014.1.403.40

My grid has 1 level of DetailTables. I am hiding the datakey column that links this with the master tab​le. 

I cannot update Telerik or apply any patch. How can I get around with the issue above? It shows up for IE versions

8 and lower.

 Thanks in advance.

 

 

s
Top achievements
Rank 1
 answered on 02 Oct 2015
1 answer
81 views

Hello,

 

I'm using the rad scheduler template demo as a base for an application and when I try to insert an All Day event I get an error. 

If you try to insert an all day event on the online demo at: http://demos.telerik.chttp://demos.telerik.com/aspnet-ajax/scheduler/examples/templates/defaultcs.aspx you will also get an error I don't know if it's the same or not.

The error I get is an Invalid Operation Exception : "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."

 I can create appointments just fine any where else on the scheduler, I just can't create an all day event on the all day row using a rad scheduler with templates.

Plamen
Telerik team
 answered on 02 Oct 2015
4 answers
83 views

Hello,

In the DbSelectedDate property documentation, it is stated that it behaves exactly like the SelectedDate property. The only difference is that it will not throw an exception if the new value is null or DBNull.

http://www.telerik.com/help/sitefinity/developer-manual/radcalendar.net2-telerik.webcontrols.raddatepicker-dbselecteddate.html

It is also stated that null in C# is Nothing in VB. I use VB and cannot see how SelectedDate can throw an exception if its new value is Nothing. I tried this:
ctlRadDateTimePicker.SelectedDate = Nothing

How is it possible to throw an exception? Why there is this remark?

Best regards,
Nicolas

Nicolas
Top achievements
Rank 1
 answered on 02 Oct 2015
2 answers
1.0K+ views

I'm using RadGrid (it looks great!). The grid contains a few columns of data, including a non-visible column that contains each record's database ID. The last column contains a Button. It is going to be a custom Delete button --  it has to do some other things as well, so I can't just use the built-in delete button.

 My question is, how do I pass the row's ID value to my function for a button click? I'm not sure how to grab and pass that value.

Viktor Tachev
Telerik team
 answered on 02 Oct 2015
2 answers
182 views

Hello,

 I have a radgrid in Batch Edit mode that I want to perform some validation on before postback. This worked for me just fine when the grid was one level (no children), but if I want to add a second level to the hierarchy (one child) then the validation causes code errors.

 This seems to come from SaveAllHierarchyLevels="true". When this is true, it causes the args.set_cancel(true) in the validation step to create issues if the same line is edited and fixed after failing validation, then saved. I believe it has something to do with the differences between the BatchEdit command and the GlobalBatchEdit command.

 Is there something I need to do to implement client-side GlobalBatchEdit validation specifically, that is not part of BatchEdit validation?

function ValidateCommand(sender, args) {
            var failed = false;
            var indic = "";
            //alert(totals[0] + " " + totals[1] + " " + totals[2] + " " + totals[3] + " " + totals[4] + " " + totals[5] + " " + totals[6]);
            checksum();
            for (var i = 0; i < 7; i++) {
                if (totals[i] > 24.0) {
                    failed = true;
                    indic += "Too much time entered! Cannot have more than 24 hours per day. \n";
                    break;
                }
            }
  
            var radGrid = $find('<%= WeeklyTimeGrid.ClientID %>');
            var batchManager = radGrid.get_batchEditingManager();
            var masterTable = radGrid.get_masterTableView();
            var rows = masterTable.get_dataItems();
            var size = rows.length;
  
            for (i = 0; i < size; i++) {
                var s = masterTable.getCellByColumnUniqueName(rows[i], "Phase");
                //alert("(" + s.innerText.trim() + ")");
                if (s.innerText.trim() == "") {
                    indic += "Phase code is required!\n";
                    failed = true;
                    break;
                }
            }
  
            //alert(failed + " " + args.get_commandName() + " " + args.get_commandArgument());
            if (failed && args.get_commandName() == "BatchEdit") { //<--Becomes 'GlobalBatchEdit'
                args.set_cancel(true);
                alert(indic);
            }
        }

protected void WeeklyTimeGrid_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
        {
            string a = _BatchID; //refresh batch info from db
 
            SavedChangesList.Visible = true;
 
            //If the batch is locked...
            if (readyToExport != 0 || hasBeenExported != 0)
            {
                //...don't do anything
                e.Canceled = true;
                NotifyUser("The batch was locked by another user, or has been exported");
                if (WeeklyTimeGrid.Enabled)
                {
                    ToggleBatchLock();
                }
 
                return;
            }
 
            foreach (GridBatchEditingCommand c in e.Commands)
            {//Here is where GlobalBatchEdit fails and BatchEdit is fine (after failing validation once, then correcting and saving)
                if (c.Item == null)
                {
                    c.Canceled = true;
                    NotifyUser("There was an error updating time, please try again. If the problem persists, please contact IT.");
                }
            }
 
            UpdateSelectedEmpTime(e.Commands);
        }

Maria Ilieva
Telerik team
 answered on 02 Oct 2015
5 answers
535 views

Hello all,

I am using ComboBox with multi check box and Filter option. I would like to know how can I get text which i gave in input area (for filtering) in code behind.

 

For example, if i have a combobox which shows all the countries -> typed "Ge" input area. Then menu/option in the dropdown with filter accordingly.

Now my requirment is How will i get the string "Ge" in code behind (in any event) and i prefer to do this code behind rather JS.

 

I hope this makes sense and looking forward for its solution...

 

Thankz

Ivan Danchev
Telerik team
 answered on 02 Oct 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?