Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
252 views
Hi
I have implemented a multicolumn combobox  [same way as in demo] which loads items on demand by calling a webservice.
I need to show a formatted tooltip for each combo item. I tried adding a rad tooltip in the item template,
but the tooltip is not getting generated. I am not sure if I am missing anything. I highly appreciate if anybody could provide a code sample by adding tooltip to multicolumn combobox.

Thanks
VInay
Rumen
Telerik team
 answered on 03 Oct 2019
1 answer
901 views

Hi 

I have a problem with radgrid in batch edit mode. I am trying to find out how I can get all values from all columns/rows when saving. I have not bound this grid to a simple datasource. Based on all data from the grid I need to create and populate a new class and send it to the server (via other functions). So I need to get all values from the grid so I can build and populate the correct class (datatable). My grid consist of both normal editable fields, read-only fields and radcombo boxes. Based on the value in my combobox I make columns read-only or not. I am trying to achive a mass update of a list<class>.

I need to find all values in code-behind! I can find the new values for updated editable fields this example

foreach (GridBatchEditingCommand command in e.Commands)
            {
                if ((command.Type == GridBatchEditingCommandType.Update))
                {
                    Hashtable newValues = command.NewValues;
                    Hashtable oldValues = command.OldValues;

 

But I can not find out how I can get:

1. selected value from radcombobox (datasource for this combo is build on-click).

2. value from read-only columns in the grid.

<%@ Page Title="Mass update of requisition lines/Parts" Language="C#" MasterPageFile="~/SunFlower.Master" AutoEventWireup="true" CodeBehind="RequisitionLineMassUpdate.aspx.cs" Inherits="SunflowerWeb.RequisitionLineMassUpdate" %>
 
<%@ Register Assembly="Sunflower.Web.Controls" Namespace="Sunflower.Web.Controls" TagPrefix="sunflower" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<asp:Content ID="MassUpdateContent" ContentPlaceHolderID="mcph"  runat="server">
     
   <telerik:RadAjaxManagerProxy ID="ManagerProxy" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="MasterAjaxManger">
                <UpdatedControls>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="gridMassUpdate">
                <UpdatedControls>
                </UpdatedControls>
            </telerik:AjaxSetting>
 
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
 
     <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            var ReqLineFunctions = new Array();
 
            function saveAll() {
                var grid1 = $find("<%=gridMassUpdate.ClientID%>");
                var batchManager1 = grid1.get_batchEditingManager();
                var hasChanges = batchManager1.hasChanges(grid1.get_masterTableView());
                if (hasChanges) {
                    batchManager1.saveTableChanges([grid1.get_masterTableView()]);
                } else {
                    var ajaxPanel = $find("<%=RadAjaxPanel1.ClientID%>");
                    ajaxPanel.ajaxRequest("saveChanges");
                }
            }
 
            function GetSelectedFunction(sender, args) {
                var batchManager = sender.get_batchEditingManager();
                var masterTable = sender.get_masterTableView();
                masterTable.get_dataItems();
                var dataItem = $find(args.get_row().id);
                var combo = dataItem.findControl("cbFunction");
                var comboValue = combo.get_selectedItem().get_value();
                return comboValue;            
            }
 
            function GetReqLineId(sender, args) {
                var batchManager = sender.get_batchEditingManager();
                var masterTable = sender.get_masterTableView();
                masterTable.get_dataItems();
                var dataItem = $find(args.get_row().id);
                var reqLineId = dataItem.findElement("lblReqLineId");
                var reqLineIdValue = reqLineId.innerText;
                return reqLineIdValue;            
            }
 
            function batchEditOpening(sender, args) {
 
                var selectedFunc = GetSelectedFunction(sender, args);
                var reqLineId = GetReqLineId(sender, args);
 
                if (selectedFunc !== null && reqLineId !== null) {
                    if (ReqLineFunctions.length > 0) {
                        //Is partnumber updatable
                        for (let i = 0; i < ReqLineFunctions.length; i++) {
                            if (ReqLineFunctions[i].ReqLineId === reqLineId) {
                                var funcs = ReqLineFunctions[i].Functions;
 
                                for (let k = 0;k < funcs.length; k++) {
                                    if (funcs[k].FunctionName === selectedFunc) {
                                        if (!funcs[k].IsPartUpdatable) {
                                            args.set_cancel(true);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
 
            function SelectFunction(sender, eventArgs) {
                //todo: populate the rest of the columns based on the selected function
           
            }
 
            function GetFunctions(sender, args) {
                var text = args._text;
                itemsRequesting(sender, args);
 
                //Dummy collection of functions. todo: replace with functions from api-call
                var funcs = new Array();
                funcs.push({
                     FunctionName: "SuppToTecOk",
                     FunctionDescription : "Receive from supplier",  
                     IsPartUpdatable : true
                  });
 
                funcs.push({
                     FunctionName: "TecOkToCust",
                     FunctionDescription : "Deliver to customer",  
                     IsPartUpdatable : false
                  });
 
                //add to global array so i can lookup and find values later
                var reqlineid = sender.get_attributes().getAttribute("data-reqlineid");
                if (reqlineid !== null) {
                    ReqLineFunctions.push({
                        ReqLineId: reqlineid,
                        Functions: funcs
                    })
                }
 
                FillCombo(sender, funcs);
                sender.highlightAllMatches(sender.get_text());
            }
 
            // This cancels the default RadComboBox behavior
            function itemsRequesting(sender, args) {
                if (args.set_cancel != null) {
                    args.set_cancel(true);
                }
                if (sender.get_emptyMessage() == sender.get_text())
                    sender.set_text("");
            }
 
            function FillCombo(combo, functions) {
                combo.clearItems();
                combo.trackChanges();
                for (var i = 0; i < functions.length; i++) {
                    var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                    comboItem.set_text(functions[i].FunctionDescription);
                    comboItem.set_value(functions[i].FunctionName);
                    combo.get_items().add(comboItem);
                }
            }
 
        </script>
    </telerik:RadCodeBlock>
 
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" OnAjaxRequest="RadAjaxPanel1_AjaxRequest">
        <h1>Mass update parts</h1>
        <h4><asp:Label ID="litTip" runat="server" Text=""></asp:Label></h4>
 
        <div class="buttonFormBorderXL">
            <div class="fltlft buttons tools">
                <telerik:RadButton runat="server" ID="RadButton1" AutoPostBack="false" Text="Save all"  OnClientClicked="saveAll"></telerik:RadButton>
            </div>
        </div>
        <div class="box fltlft formXL clft">
            <img src="fwimages/form_curve01.gif" class="curve01" alt="" />
            <img src="fwimages/form_curve02.gif" class="curve02" alt="" />
            <br />
 
            <div class="simpleList">
                <telerik:RadGrid ID="gridMassUpdate" renderMode="Lightweight" runat="server" OnNeedDataSource="gridMassUpdate_NeedDataSource" AllowAutomaticInserts="True" 
                        AllowPaging="false" AutoGenerateColumns="False" Skin="SunflowerSkin" EnableEmbeddedSkins="False"
                        OnBatchEditCommand="gridMassUpdate_BatchEditCommand" CellSpacing ="0" GridLines="None" Height="680px">
                <ClientSettings>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                </ClientSettings>
                     
                <AlternatingItemStyle Font-Size="8pt" />
                <MasterTableView EditMode="Batch" PageSize="50" CommandItemDisplay="None" AllowPaging="false" DataKeyNames="SearchResultRowId" AutoGenerateColumns="false">
                    <BatchEditingSettings EditType="Cell"/>
                    <Columns>
                        <telerik:GridTemplateColumn Visible="true" ReadOnly="true" UniqueName="SearchResultRowId"  DataField="SearchResultRowId" HeaderText="id">
                            <ItemTemplate>
                                <telerik:RadLabel ID="lblReqLineId" runat="server" Text='<%# Eval("SearchResultRowId")%>'></telerik:RadLabel>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                         
                        <telerik:GridNumericColumn Visible="true" ReadOnly="true" DataField="RequisitionNumber" HeaderText="Requisition" AllowFiltering="false">
                        </telerik:GridNumericColumn>
 
                        <telerik:GridTemplateColumn DataField="PartNumber"  HeaderText="Part" UniqueName="PartNumber">
                            <ItemTemplate>
                                <telerik:RadLabel ID="lblPartNumber" runat="server" Text='<%# Eval("PartNumber")%>'></telerik:RadLabel>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadTextBox ID="txtPartNumber" runat="server" Text='<%# Eval("PartNumber")%>'></telerik:RadTextBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
 
                        <telerik:GridBoundColumn DataField="PartDescription" ReadOnly="true" HeaderText="Description" UniqueName="PartDescription">
                        </telerik:GridBoundColumn>
 
                         <telerik:GridTemplateColumn HeaderText="Function" UniqueName="SelectedFunction">
                            <ItemTemplate>
                                <telerik:RadComboBox ID="cbFunction" RenderMode="Lightweight" runat="server" EnableLoadOnDemand="true" EmptyMessage="Select"
                                    data-reqlineid='<%# Eval("SearchResultRowId")%>' OnClientItemsRequesting="GetFunctions" OnClientSelectedIndexChanged="SelectFunction" Text="Select">
                                </telerik:RadComboBox>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
 
                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <ClientEvents OnBatchEditOpening="batchEditOpening" />
                </ClientSettings>
                <ItemStyle Font-Size="8pt" />
            </telerik:RadGrid>
        </div>
    </div>
    </telerik:RadAjaxPanel>
</asp:Content>

 

and code-behind:

using Sunflower.Web.Controls;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace SunflowerWeb
{
    public partial class RequisitionLineMassUpdate : System.Web.UI.Page
    {
        private bool saveChanges = false;
 
        private List<Sunflower.Business.RequisitionLineMassUpdate> ReqLines
        {
            get
            {
                return (List<Sunflower.Business.RequisitionLineMassUpdate>)Session["ReqLines" + MassUpdateId];
            }
        }
 
        public string MassUpdateId
        {
            get
            {
                return (string)ViewState["MassUpdateId"];
            }
            set
            {
                ViewState["MassUpdateId"] = value;
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["MassUpdateId"] == null && string.IsNullOrEmpty(MassUpdateId))
                    MassUpdateId = Guid.NewGuid().ToString();
                else if (Request.QueryString["MassUpdateId"] != null)
                    MassUpdateId = Request.QueryString["MassUpdateId"];
            }
 
        }
 
        protected void gridMassUpdate_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
        {
            saveChanges = true;
 
            //Trying to read all items....do not work!
            foreach (GridDataItem item in gridMassUpdate.Items)
            {
                string func = item.Cells[4].Text;  //radcombo
                string part = item.Cells[2].Text;  //radtexbox
            }
 
            foreach (GridBatchEditingCommand command in e.Commands)
            {
                if ((command.Type == GridBatchEditingCommandType.Update))
                {
                    Hashtable newValues = command.NewValues;
                    Hashtable oldValues = command.OldValues;
 
                    try
                    {
                        string combinedId = newValues["SearchResultRowId"].ToString();
                        string partNumber = newValues["PartNumber"].ToString();
 
                        //NONONO. Not possible to get value from radcombobox. Why ?
                        string function = newValues["SelectedFunction"].ToString();
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
 
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (saveChanges)
            {
                //Save the values from the other controls
            }
        }
 
        protected void RadAjaxPanel1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "saveChanges")
            {
                saveChanges = true;
            }
        }
 
        protected void gridMassUpdate_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            if (ReqLines.Count > 0)
            {
                gridMassUpdate.DataSource = ReqLines;
            }
        }
 
    }
}

 

Is it possible to get all values from an updated radgrid in batch mode ????

 

Best regards

Lars

 

 

 

 

 

 

Eyup
Telerik team
 answered on 03 Oct 2019
5 answers
251 views

Hello, there is a problem with using RadComboBox on iPad, when the page has scrolling, client can't scroll the combobox and select some value, it's just scrolling a page instead. I could not find the working solution on the forum, so I decided to create new thread, please advice.

 

Test page and login credentials below:

http://umanage.serran.net/_Test/Illya/Default.aspx

iPadTest/iPadTest

Vessy
Telerik team
 answered on 02 Oct 2019
5 answers
194 views
Hi,

I am using exportbuttons in the commanditemsetting to handle exports in my grid. I need to show a tooltip on thehover of export images but I am unable to do so as shown in this example http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/exporting/export-word-csv/defaultcs.aspx

Below is my grid declaration:

<telerik:RadGrid ID="rgBalances" runat="server" DataSourceID="_dataSrcBalances" EnableViewState="false"                         OnPreRender="rgBalances_PreRender" OnItemCommand="rgBalances_ItemCommand"                        OnItemDataBound="rgBalances_ItemDataBound" OnItemCreated="rgBalances_ItemCreated">
       <MasterTableView TableLayout="Fixed" HierarchyDefaultExpanded="true" CommandItemDisplay="Top"
        DataSourceID="_dataSrcBalances" Name="AccountBalance" EnableNoRecordsTemplate="true"
        DataKeyNames="AccountID">
              <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false"     ShowExportToExcelButton="true"   ShowExportToPdfButton="true" ShowExportToWordButton="true" ShowExportToCsvButton="true" />
                            <Columns>                              
                            </Columns>                         
                        </MasterTableView>
                        <ExportSettings ExportOnlyData="true" IgnorePaging="true" FileName="Activity" OpenInNewWindow="true">
                            <Pdf PaperSize="A4" PageLeftMargin="5px" PageRightMargin="5px" PageWidth="297mm"
                                PageHeight="210mm" />
                        </ExportSettings>
                    </telerik:RadGrid>
Rumen
Telerik team
 answered on 02 Oct 2019
12 answers
537 views
Hi,

We are using other 3rd party grids for our asp.net web application. We are in the process of testing Telerik RadGrid. Currently, what we are doing is we have grid.css (custom CSS class) at global location which has all the details of styling. This way, we do not need to set styles at element level. For this, what we did is we checked how vendor grid is rendered and then defined styles like this:

caption

 

h2 {

 

 

text-align: left;

 

 

margin: 15px 0 2px 0;

 

 

padding: 15px 0 2px 0;

 

 

line-height: 1.1em;

 

}

caption

 

p {

 

 

text-align: left;

 

 

margin: 1px 0 2px 0;

 

 

padding: 1px 0 2px 0;

 

 

line-height: 1em;

 

}

 

td

 

table th /* styling for grid header row */

 

{

 

padding: .1em .1em .1em .4em;

 

 

vertical-align: top;

 

 

text-align: center;

 

 

border: 1px solid white;

 

 

background-color: #e2dbc8; /*#f0ece3;*/

 

}

td

 

table td /* styling for grid data rows */

 

{

 

padding: .1em .1em .1em .4em;

 

 

vertical-align: top;

 

 

font-size: .85em;

 

 

text-align: left;

 

 

border: 1px solid white;

 

 

background-color: #f0ece3;

 

}

tr.altrow

 

td, .altrow{ background-color: #e2dbc8; }

 

.gridframe

 

{ border: none;}

 


and set the grid style property to this css file like this :

StyleSetPath

 

="~/grid.css"

So, with radgrid, I would like to achieve the same thing instead of dealing at grid level or element within grid. We have many pages using grid. So, I prefer not to do it at grid level. Please let me know how to do this.
I appreciate your response.

Prathiba

 

Rumen
Telerik team
 answered on 02 Oct 2019
4 answers
608 views
Hi All,
I have a Grid with a BoundColumn that I would like to have the input as a multiline textbox, taking up the width of the grid (that is to the right of the edit form headings).
See the attached picture to see what I mean.
It seems that the Edit Form is not the width of the Grid, but much smaller (it's bounds are where the Textbox ends currently).
I am trying to set the 100% width in the ItemDataBound event of the RadGrid by :
TextBox tb = null;
GridDataItem gdi = e.Item as GridDataItem;
tb = (TextBox)gdi["Notes"].Controls[0];
Is there another way to get this field to become wider?  Setting it to a pixel value works, but is not ideal.
Thanks,
Steele.

Attila Antal
Telerik team
 answered on 01 Oct 2019
1 answer
803 views

I have a radgrid I fill in a procedure.

I do some custom adding of datatable, then some custom columns.

 

All of this works great, until a postback, then the Grid Goes blank.

 

I have read in several places I need to "Refill" the grid in the NeedDataSource.

So do I duplicate everything in the Procedure I use to fill it and format columns etc.

Some of the formating I do on the grid involves adding new colunms  and switching columns.

 

Some of the items involve a databind before I can do the formating.  And in NeedDatasource I cannot do a databind.

 

So I am a little lost in how to handle this situation.

 

Thanks in advance.

 

Roger

Attila Antal
Telerik team
 answered on 01 Oct 2019
1 answer
91 views
Hello Sir,
I want to customize and add new features to the front of my Radwindow how to do?

thank you very much
Rumen
Telerik team
 answered on 01 Oct 2019
1 answer
111 views

We have a RadGrid that include a column with RadRating control. 

Our problem is that Grid takes too much time to load in the browser (aprox 8 seconds). 

The ItemTemplate contains only a TextBlock and a RadRating Control.

When i remove the RadRating , the grid load normally (1 second).

The RadGrill run at server and use OnNeedDataSource. And the versión of dlls is 2014

Any suggestions?

 

Thank you,
kind regards

Rumen
Telerik team
 answered on 01 Oct 2019
10 answers
1.7K+ views
I create columns of my grid dynamically on the server side. These are not created on the client side.

I need to check the name of the first column to this radgrid.
How is this possible ?

I actually tried

var gridID = $find("<%=RadgridDataAval.ClientID %>");
var x = gridID.get_masterTableView().getColumnByUniqueName("Error");
if (x)
  alert ("exists");
else
  alert("doesnt exist");

Error is the name of one of the columns of the grid. However, says it doesn't exist

Also, I don't know if we have examples that show how to fetch colulmn name of a particular column in the mastertableview on the client side.

SOS

thanks,
Jas



Eyup
Telerik team
 answered on 01 Oct 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?