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

- 2 Grid on 1 Page it Work
- 3 Grid on 1 Page Not Work. 

>> RadGrid  working to Grid1_BatchEditCommand and Grid3_BatchEditCommand Not working to Grid2_BatchEditCommand <<

 

<head>
    <title>Test</title>
    <script type="text/javascript">
 
         function SaveGrid(sender, args) {
 
            var grid1 = $find('<%=RadGrid1.ClientID%>');
            var grid1changes = grid1.get_batchEditingManager()._extractChangesString(grid1.get_masterTableView());
            if (grid1changes.length > 0) {
                grid1.get_masterTableView().fireCommand("BatchEdit", grid1changes);
            }
 
            var grid2 = $find('<%= RadGrid2.ClientID%>');
            var grid2changes = grid2.get_batchEditingManager()._extractChangesString(grid2.get_masterTableView());
            if (grid2changes.length > 0) {
                 grid2.get_masterTableView().fireCommand("BatchEdit", grid2changes);
            }
 
            var grid3 = $find('<%= RadGrid3.ClientID%>');
            var grid3changes = grid3.get_batchEditingManager()._extractChangesString(grid3.get_masterTableView());
            if (grid3changes.length > 0) {
                grid3.get_masterTableView().fireCommand("BatchEdit", grid3changes);
            }
 
        }
 
    </script>
</head>
<body>
    <form id="Form1" runat="server">
        <telerik:RadScriptManager Runat="server"></telerik:RadScriptManager>
           
           
        <telerik:RadButton runat="server" ID="RadButton1" Text="SaveAllChanges" AutoPostBack="false" OnClientClicked="SaveGrid"></telerik:RadButton>
   
           
        <telerik:GridNumericColumnEditor ID="NumericEditor1" runat="server">
            <NumericTextBox ID="NumericTextBox1" runat="server" Width="60px" />
        </telerik:GridNumericColumnEditor>
           
        <telerik:GridTextBoxColumnEditor runat="server" ID="TextEditor">
            <TextBoxStyle Width="120px" />
        </telerik:GridTextBoxColumnEditor>
   
        <!--Grid1------------>
 
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource3"
            AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
            AllowAutomaticDeletes="true" AllowSorting="true" PageSize="3" >
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView DataSourceID="SqlDataSource3" AutoGenerateColumns="False"
                DataKeyNames="CustomerID" EditMode="Batch" CommandItemDisplay="Top">
                <Columns>
        
                    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
                        UniqueName="CustomerID">
                    </telerik:GridBoundColumn>
   
   
                   <telerik:GridTemplateColumn HeaderText="ContactName" HeaderStyle-Width="180px" UniqueName="ContactName" >
                        <ItemTemplate>
                            <%# Eval("ContactName") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" Text='<%# Bind("ContactName") %>' runat="server"></asp:TextBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
   
   
                    <telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName"
                        UniqueName="CompanyName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle"
                        UniqueName="ContactTitle">
                    </telerik:GridBoundColumn>
                
   
                       
                 <telerik:GridBoundColumn DataField="Phone" HeaderStyle-Width="135px" HeaderText="Quantity Per Unit"
                        SortExpression="" ColumnEditorID="TextEditor" UniqueName="QuantityPerUnit">
                    </telerik:GridBoundColumn>
   
   
                    <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
   
     
        <!--Grid2------------>
   
        <telerik:RadGrid ID="RadGrid2" GridLines="None" runat="server" AllowAutomaticDeletes="True"
            AllowAutomaticInserts="True" PageSize="3" Skin="Default" AllowAutomaticUpdates="True" AllowPaging="True"
            AutoGenerateColumns="False" Width="750px" DataSourceID="SqlDataSource1">
   
            <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ProductID"
                DataSourceID="SqlDataSource1" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
                <BatchEditingSettings EditType="Cell" />
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="ProductID" SortOrder="Descending" />
                </SortExpressions>
                <Columns>
                    <telerik:GridBoundColumn DataField="ProductName" HeaderStyle-Width="210px" HeaderText="ProductName" SortExpression="ProductName"
                        UniqueName="ProductName">
                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
                            <RequiredFieldValidator ForeColor="Red" Text="*This field is required">
                            </RequiredFieldValidator>
                        </ColumnValidationSettings>
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Category" HeaderStyle-Width="180px" UniqueName="CategoryID" DataField="CategoryID">
                        <ItemTemplate>
                            <%# Eval("CategoryName") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadDropDownList runat="server" ID="CategoryIDDropDown" DataValueField="CategoryID"
                                DataTextField="CategoryName" DataSourceID="SqlDataSource2">
                            </telerik:RadDropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridNumericColumn DataField="UnitsInStock" HeaderStyle-Width="80px"
                        ColumnEditorID="NumericEditor1" HeaderText="Units In Stock" SortExpression="UnitsInStock"
                        UniqueName="UnitsInStock">
                    </telerik:GridNumericColumn>
                    <telerik:GridBoundColumn DataField="QuantityPerUnit" HeaderStyle-Width="135px" HeaderText="Quantity Per Unit"
                        SortExpression="QuantityPerUnit" ColumnEditorID="TextEditor" UniqueName="QuantityPerUnit">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="Discontinued" HeaderStyle-Width="80px" HeaderText="Discontinued" SortExpression="Discontinued"
                        UniqueName="Discontinued">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridTemplateColumn HeaderText="UnitPrice" ColumnEditorID="NumericEditor1"
                        HeaderStyle-Width="80px" SortExpression="UnitPrice" UniqueName="TemplateColumn"
                        DataField="UnitPrice">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblUnitPrice" Text='<%# Eval("UnitPrice", "{0:C}") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <span>
                                <telerik:RadNumericTextBox Width="55px" runat="server" ID="tbUnitPrice">
                                </telerik:RadNumericTextBox>
                                <span style="color: Red">
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
                                        ControlToValidate="tbUnitPrice" ErrorMessage="*Required" runat="server">
                                    </asp:RequiredFieldValidator>
                                </span>
                            </span>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="50px" ButtonType="ImageButton"
                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                    </telerik:GridButtonColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
 
 
        <!--Grid3------------>
   
        <telerik:RadGrid ID="RadGrid3" GridLines="None" runat="server" AllowAutomaticDeletes="True"
            AllowAutomaticInserts="True" PageSize="3" Skin="Default" AllowAutomaticUpdates="True" AllowPaging="True"
            AutoGenerateColumns="False" Width="750px" DataSourceID="SqlDataSource1">
   
            <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="PersonID"
                DataSourceID="SqlDataSource1" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
                <BatchEditingSettings EditType="Cell" />
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="PersonID" SortOrder="Descending" />
                </SortExpressions>
                <Columns>
                    <telerik:GridBoundColumn DataField="PersonName" HeaderStyle-Width="210px" HeaderText="PersonName" SortExpression="PersonName"
                        UniqueName="PersonName">
                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
                            <RequiredFieldValidator ForeColor="Red" Text="*This field is required">
                            </RequiredFieldValidator>
                        </ColumnValidationSettings>
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Position" HeaderStyle-Width="180px" UniqueName="PositionID" DataField="PositionID">
                        <ItemTemplate>
                            <%# Eval("PositionName")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadDropDownList runat="server" ID="PositionIDDropDown" DataValueField="PositionID"
                                DataTextField="PositionName" DataSourceID="SqlDataSource2">
                            </telerik:RadDropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridNumericColumn DataField="PersonNickname" HeaderStyle-Width="80px"
                        ColumnEditorID="NumericEditor1" HeaderText="Nickname" SortExpression="Nickname"
                        UniqueName="Nickname">
                    </telerik:GridNumericColumn>
                    <telerik:GridBoundColumn DataField="PersonContract" HeaderStyle-Width="135px" HeaderText="Contract"
                        SortExpression="PersonContract" ColumnEditorID="TextEditor" UniqueName="PersonContract">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="PersonFundNumb" HeaderStyle-Width="80px" HeaderText="PersonFundNumb" SortExpression="PersonFundNumb"
                        UniqueName="PersonFundNumb">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="50px" ButtonType="ImageButton"
                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                    </telerik:GridButtonColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
   
</form
</body
 
<!-----------Behind Code ----------->
 
 Protected Sub Grid1_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs) Handles Grid1.BatchEditCommand
        If e.Commands.Count > 0 Then
            '.............................................
        End If
    End Sub
 
<!-----------Not Working Grid2_BatchEditCommand  ----------->
    Protected Sub Grid2_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs) Handles Grid2.BatchEditCommand
        If e.Commands.Count > 0 Then
            '.............................................
        End If
    End Sub
 
    Protected Sub Grid3_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs) Handles Grid3.BatchEditCommand
        If e.Commands.Count > 0 Then
            '.............................................
        End If
    End Sub
Viktor Tachev
Telerik team
 answered on 29 Jun 2016
1 answer
188 views

Hi,

I am using a RadListBox and I would like to find if the items that are selected in this list when clicking on a search button. However, when doing the following I have no item selected (the Label text is = 0) and I do not see why?

 

In my Search.ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Search.ascx.cs" Inherits="Controls.Search.Search" %>

<telerik:RadListBox ID="List1" runat="server" SelectionMode="Multiple" CssClass="rListBx"/>

 

In my Search.ascx.cs:

Label.Text = List1.SelectedItems.Count().ToString();

My Search_Click function is in a partial class that inherits from System.Web.UI.UserControl 

 

In my Search.ascx.designer.cs

protected global::Telerik.Web.UI.RadListBox List1;

 

An idea about what I am doing wrong here?

Thanks

 

 

Sophie
Top achievements
Rank 1
 answered on 29 Jun 2016
2 answers
81 views
Hi,
I want to find out changes to the controls on the form if any element is changed but without saving it if the user moves to the other pages I want to show the user to ‘some unsaved changes are there do you want to save it or not?’ something like to show to the user. For archiving this I am using the JavaScript. With this I was able to find out any changes to all the controls on the form except RadAsyncUpload control.
Can you please advise how can I find out the changes to this RadAsyncUpload control using javascript?
Thanks,
Ivan Danchev
Telerik team
 answered on 29 Jun 2016
2 answers
94 views

So I'm binding the data to the treelist via datatable. It defintely has data (over 2000 rows), and I'm using the needsdatasource event handler to bind. It must be recognizing SOMETHING because after it binds, the column names from the data appear in the list it just show no data. VS 2015 is that makes a difference. Code below:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="xxx.aspx.cs" Inherits="xxx.xxx.xxx" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title></title>
</head>
 
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
    <div>
        <div>
            <telerik:RadDateTimePicker runat="server" ID="datePicker" Width="175px"></telerik:RadDateTimePicker><asp:Button runat="server" ID="btnLoad" Text="Load" OnClick="btnLoad_Click" /><asp:Button runat="server" ID="btnExport" OnClick="btn_Export_Click" Text="Export To Excel" /><br />
 
                <telerik:RadTreeList ID="RadTreeList1" runat="server" AllowPaging="true" PageSize="3" DataKeyNames="USERID"
                   OnNeedDataSource="RadTreeList1_NeedDataSource"  ParentDataKeyNames="CustomerID">
                     
                </telerik:RadTreeList>
 
 
        </div>
 
     
    </div>
    </form>
</body>
</html>



using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace xxx.xxx
{
    public partial class Tracker : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            datePicker.SelectedDate = DateTime.Now;
        }
 
        protected void RadTreeList1_NeedDataSource(object sender, Telerik.Web.UI.TreeListNeedDataSourceEventArgs e)
        {
            var dt = GetDataSource();
            RadTreeList1.DataSource = dt;
        }
        protected void btnLoad_Click(object o,EventArgs e)
        {
            RadTreeList1.Rebind();
        }
        protected void btn_Export_Click(object o,EventArgs e)
        {
            RadTreeList1.ExportSettings.Excel.Format = TreeListExcelFormat.Biff;
           
            RadTreeList1.ExportToExcel();
        }
        public DataTable GetDataSource()
        {
            var dt = new DataTable();
            var strQuery = "";
 
            strQuery += " select ";
            strQuery += " USERID [CustomerID]";
            strQuery += ", USERID ";
            strQuery += ", FileInput";
            strQuery += ", MeterNo ";
            strQuery += ", MeterName ";
            strQuery += " ,LastReadTime ";
            strQuery += " from xx i ";
            strQuery += " JOIN xxx u ON u.CustomerID = i.USERID ";
            strQuery += " where ConnectionDevice = 18 AND isActive=1";
            strQuery += " and u.isParent = 1 ";
            strQuery += " AND Time<@Time ";
            strQuery += " order by userid,fileinput,meterno";
 
            using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["xxx"].ConnectionString))
            {
                con.Open();
                var cmd = new SqlDataAdapter(strQuery, con);
                cmd.SelectCommand.Parameters.AddWithValue("@Time", "11/1/2015");
                cmd.Fill(dt);
            }
            return dt;
        }
    }
}

Like I said it displays the treelist with all the columns from the query and corresponding datatable fine, but it's not displaying any data despite having 2000+records. 

 

Kostadin
Telerik team
 answered on 29 Jun 2016
2 answers
218 views

Hi,

I have 4 icon tiles that are shape=wide set to TileRows=2. How do I centre these on the screen (left-right)?

Al
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 29 Jun 2016
1 answer
91 views

Hi,

I need to create a multi-level form for one of my requirements.

I have to create around 8 levels and each level will contain about 15 user fields (fields like textbox,checkbox, dropdown, radio buttons, file upload options so on..)

Will using RadWizard control be apt for my requirements ? and if i use radwizard will there be any performance issue as i will be having more that 100 user fields in a single page. Also, thanks to let me know if there are any other alternative for achieving my requirements. 

Thanks in advance for the response.

 

Dimitar
Telerik team
 answered on 29 Jun 2016
6 answers
267 views
is it possible to insert technical formulas into the radeditor?
we want to buy the kwizcom wikiplus and i've heard, that they use the telerik radeditor as editor.
our users want a technical formular editor like LaTeX.

or is there another editor we can install to have this feature?

thanks for your help.
Rumen
Telerik team
 answered on 29 Jun 2016
2 answers
177 views
I have added to my form a change to my save button if any (various) inputs are changed.
$(document).ready(function () {
    $("input,select,textarea").change(function () {
        $("#<%=btnSaveDataFull.clientid %>").addClass('SkinPulgin_button_update');
    });
});


this works for the textboxes, textareas ,comboboxes
but not dropdownlists changes.
Magdalena
Telerik team
 answered on 29 Jun 2016
1 answer
76 views

I am very confused by the following. The system design is a masterpage with 2 ContentPlaceHolders. The RadMenu is part of the masterpage with a SqlDataSource, and I am using "Silk" skin.

On the Content Page everything looks correct menu where it should be, however as soon as I add a RadNotification in the Contant Page, the menu side is bigger, it looks like the padding is off... However when I remove the RadNotification, everything goes back to normal...

Does anybody as to why this is happening, and how to fix it?

Magdalena
Telerik team
 answered on 29 Jun 2016
4 answers
247 views

Hello,

Have a model radwindow open where the contents of the page contains an asp repeater that generates dynamically rad input controls.

Everything works great until something in the page does an ajax callback.

At that point it is is still ok until you try to do something with the radwindow (move, close, resize ect..)

When you do I get the following error message 

"Error: Unable to get property 'reflowing' of undefined or null reference"

trigger [Line: 11557, Col: 33], Telerik.Web.UI.WebResource.axd
b.DropDown.prototype.reflow [Line: 12369, Col: 1], Telerik.Web.UI.WebResource.axd
Anonymous function [Line: 12401, Col: 36], Telerik.Web.UI.WebResource.axd
m.event.dispatch [Line: 1522, Col: 8380], Telerik.Web.UI.WebResource.axd
r.handle [Line: 1522, Col: 5064], Telerik.Web.UI.WebResource.axd

This error only occurs in IE (tested in IE 11, chrome and firefox)

Was wondering if anyone has run into this before and what can be done to fix this.

Thanks.

cramer
Top achievements
Rank 1
 answered on 28 Jun 2016
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?