Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
628 views
I have a RadGrid with EditMode="Batch".  It has a template column.  In this column (in the EditItemTemplate) is a RadComboBox with CheckBoxes="True".  

<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" GridLines="None"
    AllowMultiRowEdit="True"
    AutoGenerateColumns="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False"
    OnNeedDataSource="GridNeedDataSource"
    OnPreRender="GridPreRender">
    <MasterTableView AllowSorting="True" EditMode="Batch">
        <Columns>
            <telerik:GridBoundColumn DataField="Id" HeaderText="Id" UniqueName="IdColumn" Display="False" ReadOnly="True">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderText="Test Values" UniqueName="TestValuesColumn" ItemStyle-Width="400px">
                <EditItemTemplate>
                    <telerik:RadComboBox runat="server" ID="TestValuesComboBox" DropDownAutoWidth="Enabled"
                        HighlightTemplatedItems="True" CheckBoxes="True" EnableCheckAllItemsCheckBox="True">
                    </telerik:RadComboBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
        <BatchEditingSettings OpenEditingEvent="DblClick" />
    </MasterTableView>
</telerik:RadGrid>

protected void GridPreRender(object sender, EventArgs e)
{
    RadGrid grid = sender as RadGrid;
    if (grid != null)
    {
        GridTableView masterTable = grid.MasterTableView;
 
        var editor = masterTable.GetBatchEditorContainer("TestValuesColumn");
        var comboBox = (RadComboBox)editor.FindControl("TestValuesComboBox");
        comboBox.Items.Clear();
 
        for (int i = 1; i <= 10; i++)
        {
            RadComboBoxItem item = new RadComboBoxItem();
            item.Text = i.ToString();
            item.Value = i.ToString();
 
            comboBox.Items.Add(item);
            item.DataBind();
        }
    }
}

What I need to do is pre-check the values that have been previously saved.  I realize that there is really only "one" editor for the entire column, so I was wondering if there was some javascript (handling the BatchEditOpening maybe?) that could run through a comma separated list contained in a hidden field or something, and check the appropriate values when opening the cell for editing?  I set the contents of the RadComboBox in the grid's PreRender event, so it's only done once.

Perhaps another option is to have the RadComboBox set with EnableLoadOnDemand="true" and handle the OnItemsRequested to reload and select the data, after it handles the OnClientDropDownOpening="ClearComboBox" with the following code:

function ClearComboBox(sender, args) {
    if (sender.get_items().get_count() == 0) {
        return;
    }
    else {
        sender.clearItems();
        sender.requestItems("parameter", true);
    }
}

The trouble with option #2 is that I'm not sure how to get any values for that particular row to set up in code-behind.  So I don't know how to get the data from the database for that record.  Also, this will make a call to the database every time they open the ComboBox.

Any thoughts?


Eyup
Telerik team
 answered on 20 Mar 2018
0 answers
163 views

I have the following html:

<sq8:GridTemplateColumn DataField="FieldToFillChoiceValue" FilterImageToolTip="" HeaderText="" SortExpression="FieldToFillChoiceValue" UniqueName="FieldToFillValue" FilterControlAltText="">
    <EditItemTemplate>
        <sq8:TextBox runat="server" ID="tbFieldToFill" ValidationGroup="DecisionGroup" />
        <sq:BindableControl runat="server" TargetControlID="tbFieldToFill" DataField="FieldToFillTextValue"></sq:BindableControl>
        <asp:CustomValidator runat="server" ErrorMessage="CustomValidator" ID="cvFieldToFill" ValidationGroup="DecisionGroup"></asp:CustomValidator>
        <sq8:ComboBox runat="server" ID="cmbFieldToFill" ValidationGroup="DecisionGroup">
            <Localization NoMatches="" ShowMoreFormatString="" AllItemsCheckedString="" ItemsCheckedString="" CheckAllString="" MoreItemsWithoutTotalRowCount="" NoMoreItemsWithoutTotalRowCount=""></Localization>
        </sq8:ComboBox>
        <sq:BindableControl runat="server" TargetControlID="cmbFieldToFill" DataField="FieldToFillChoiceValue" />
    </EditItemTemplate>
    <ItemTemplate>
        <asp:Literal runat="server" ID="FieldToFillChoiceValue" Mode="Encode" />
        <sq:BindableControl runat="server" TargetControlID="FieldToFillChoiceValue" DataField="FieldToFillChoiceValue" />
        <asp:HiddenField runat="server" ID="hfFieldType" />
        <sq:BindableControl runat="server" TargetControlID="hfFieldType" DataField="FieldToFillType"></sq:BindableControl>
    </ItemTemplate>
</sq8:GridTemplateColumn>

 

And I'm signed to OnBatchEditOpening and OnBatchEditOpened events.

My problem is that when I get to the OnBatchEditOpened handler, the value of tbFieldToFill is "TextBox" (which is the value of the hidden field) without me setting or binding any value to the control.

In the OnBatchEditOpening handler, the text box still haven't been rendered.

How and why does the value get into the textbox control?

Thanks for any help.

Evgeny
Top achievements
Rank 1
 asked on 20 Mar 2018
0 answers
295 views

Hello,

I have 3 web parts each of which raise a different client side event to which the other 2 web parts react. Two of the web parts are asp .NET (Telerik) while the third is strictly client side JavaScript and REST services.

My issue is that the 2 asp .net web parts each perform a post back when they react to the event, passing some data to the server. Only one of the asp .net web parts processes their post back correctly. If the other ASP .NET web part is removed, everything works correctly.

I have considered serializing the post backs, so that one does not occur until the first has completed and rendered back to the client.

Is there a better way? Also my post backs are not showing the loading panel which does appear normally.

My client side event listener and post back code looks like this:

document.addEventListener('ADSBarcodeEvent', function (evt) {
    var barcode = evt.detail[0];
    var assetType = evt.detail[1];
    __doPostBack("<%=HiddenSearchRadButton.UniqueID%>", barcode + "||" + assetType);
}, false);

and on the server:

protected void HiddenSearchRadButton_Click(object sender, EventArgs e)
 {
     ProcessingExternalEvent = true; // stop infinite loop of events
 
     string passedArgument = Request.Params.Get("__EVENTARGUMENT");
     // barcode + "||" + assetType
     if (passedArgument.Contains("||"))
     {
         string[] delimiter = new string[] { "||" };
         string[] arguments = passedArgument.Split(delimiter, StringSplitOptions.None);
         string barcode = arguments[0];
         string assetType = arguments[1];
Marcel
Top achievements
Rank 1
 asked on 19 Mar 2018
1 answer
145 views

Dears,

 

I am new to RadGrid. I've a grid displayed without the Add New Record button. 

 

I dont understand that. I am using NeedDataSource event to bind the data

 

Regards,

 

Endashaw

Rumen
Telerik team
 answered on 19 Mar 2018
4 answers
551 views
I can't make the radpagelayout control has 100% width and height in big resolution (1920x1080). Do you can help me?
Flemming
Top achievements
Rank 1
Veteran
 answered on 17 Mar 2018
1 answer
441 views

 

The code is posted below. When I click on the selection list I want the id of the selection list item to appear in the query string of browser after a partial postback. Is this possible?

 

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="telerik.aspx.cs" Inherits="Webtest.telerik" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>     <title></title>     <script>         function getQueryStringValue(key) {             return decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURIComponent(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));         }         function addIdtoQueryString(itemId) {             var querystring = getQueryStringValue("filter");                          if(querystring=="")             {                 querystring = itemId;             }             else             {                 querystring = querystring + "+" + itemId;             }             return querystring;         }         function deleteIdFromQueryString(itemId) {             var querystring = getQueryStringValue("filter");             var ids = querystring.split("+");             var newQuerystring = "";             for (var i = 0; i < ids.length; i++) {                 console.log(ids[i]);             }             var indexOfItemToDelete = ids.indexOf(itemId);             ids.splice(indexOfItemToDelete, 1);             for (var i = 0; i < ids.length; i++) {                 if (i != 0) {                     newQuerystring += "+";                 }                 newQuerystring += ids[i];             }             return newQuerystring;         }         function itemClicked(list, args) {             var querystring ="";             if (args.get_item().get_checked() == true)             {                 querystring = addIdtoQueryString(args.get_item().get_value());             }             else             {                 querystring = deleteIdFromQueryString(args.get_item().get_value());             }             if (querystring != "")                 document.forms["form1"].action = "?filter=" + querystring;             else                 document.forms["form1"].action = "?";             alert(document.forms["form1"].action);         }     </script></head><body>     <form id="form1" runat="server">                         <telerik:RadScriptManager ID="rsManager" runat="server" AsyncPostBackTimeout="7200" />                 <telerik:RadAjaxManager ID="raManager" runat="server" EnableAJAX="true" />             <telerik:RadAjaxManagerProxy ID="rampCommodity" runat="server" >         <ajaxsettings>                <telerik:AjaxSetting AjaxControlID="paCommodity">                 <UpdatedControls>                     <telerik:AjaxUpdatedControl ControlID="paCommodity"></telerik:AjaxUpdatedControl>                 </UpdatedControls>             </telerik:AjaxSetting>         </ajaxsettings>     </telerik:RadAjaxManagerProxy>             <asp:Panel ID="paCommodity" runat="server">     <div>          <telerik:RadCheckBoxList runat="server" ID="Questionnaire" AutoPostBack="true"  CssClass="content" OnSelectedIndexChanged="Questionnaire_SelectedIndexChanged">              <ClientEvents OnItemClicked="itemClicked">              </ClientEvents>              <Items>                 <telerik:ButtonListItem Text="Game apps (puzzles, charades, etc.)" Value="0"  />                 <telerik:ButtonListItem Text="Sports apps (sports schedules, scores, headlines, etc.)" Value="1" />                 <telerik:ButtonListItem Text="Travel apps (airplane tickets, tourist guides, transportation info, etc.)" Value="2" />                 <telerik:ButtonListItem Text="News apps (news, national headlines, technology announcements, etc.)" Value="3" />                 <telerik:ButtonListItem Text="Entertainment apps (puzzles, charades, etc.)" Value="4" />                 <telerik:ButtonListItem Text="Social networking apps (location check-ins, friend status updates, etc.)" Value="5" />                 <telerik:ButtonListItem Text="Weather apps (local forecasts, natural disaster updates, etc.)" Value="6" />                 <telerik:ButtonListItem Text="Other" Value="7" />             </Items>         </telerik:RadCheckBoxList>              </div>                 </asp:Panel>          </form></body></html>

Attila Antal
Telerik team
 answered on 16 Mar 2018
2 answers
204 views

Hi I am goingnuts , please help me!  RadGauge needle value updates fine to specified value on local host but not when I have published the code? 

 

http://temperatur.gpslogik.se/1  is the published code.  (throws input error on the Chrome developer console, I dont understand) 

Here is part of my code!

 

      
                                <telerik:RadLabel ID="RadLabel6" runat="server" Text="LarmtillstÃ¥nd" Font-Size="Small"  AutoPostBack="True" Font-Bold="True"></telerik:RadLabel><br/>
                                <telerik:RadLabel ID="RadLabel3" runat="server" Text="Normal" BackColor="#33CC33" Font-Bold="True" ForeColor="White" Width="300px" ></telerik:RadLabel>

                           <div class="demo-container size-thin">
                                        <telerik:RadRadialGauge runat="server" ID="RadRadialGauge1" Width="200px" Height="200px" Skin="Bootstrap">
                                            <Pointer Value="0">
                                                <Cap Size="0.1" />
                                            </Pointer>
                                            <Scale Min="0" Max="40" MajorUnit="10" >
                                                <Labels Format="{0} C°" />
                                                <Ranges>
                                                    <telerik:GaugeRange Color="#add8e6" From="0" To="5" />
                                                    <telerik:GaugeRange Color="Green" From="5" To="25" />
                                                    <telerik:GaugeRange Color="#ff0000" From="25" To="40" />                                     
                                                </Ranges>
                                            </Scale>
                                        </telerik:RadRadialGauge>
                               <p></p>
                               <telerik:RadHtmlChart ID="RainfallChart" runat="server" Layout="Sparkline" Width="300px" Height="60px" PlotArea-XAxis-Reversed="true">
                                            <PlotArea>
                                                <Series>
                                                    <telerik:AreaSeries DataFieldY="RainfallData">
                                                        <Appearance FillStyle-BackgroundColor="#00b37d"></Appearance>
                                                        <TooltipsAppearance Color="White" />
                                                    </telerik:AreaSeries>
                                                </Series>
                                            </PlotArea>
                                        </telerik:RadHtmlChart><br />
                               <telerik:RadLabel ID="RadLabel7" Text="Temperatur trend" runat="server"></telerik:RadLabel>                  
                                  <div class="demo-containers">
              

 

 OBJCONN.Close() : OBJCONN.Open()
        'Fyll dropdown med användare
        Dim Q As New SqlCommand("SELECT * FROM temperature_values where TempDescription='" & unit & "'", OBJCONN)
        Dim R As SqlDataReader = Q.ExecuteReader
        If R.HasRows = True Then
            Do While R.Read

                adress1 = R("TemperatureAdress")
                TidX = R("TempTimeStamp")
                lat = R("Temperature_latitude")
                lng = R("Temperature_longitude")
                groupname = R("Temperatur_groupName")
                TempDescription = R("TempDescription")
                value = R("TempValue")
            Loop
        End If
        OBJCONN.Close()
        RadLabel2.Text = "<strong>Kl: " & TidX & "<br>" & groupname & " / " & TempDescription & "<br> Temperatur är " & value & "°C</strong>" ', Senast kända adress " & adress1


        'Hämta aktuellt värde och tid för vald temperaturgivare

        RadRadialGauge1.Pointer.Value = value

        Timer1.Enabled = True
        RainfallChart.DataSource = GetData()
        RainfallChart.DataBind()

Rumen
Telerik team
 answered on 16 Mar 2018
0 answers
125 views

Hi,

I am Updating my table using a Vista on MSSQL.

Everything is fine on text fields except a ComboBox that is missing the ReBind. I have refresh the page using the Refresh button on my form.

 

How can I call the Refresh event onSave event?

 

Thx,

Valerio

Valerio
Top achievements
Rank 1
 asked on 16 Mar 2018
0 answers
162 views
Suppose I am using two RadTextBox control and I want to differentiate those two using css.

    <telerik:RadTextBox ID="rtb_1" runat="server"></telerik:RadTextBox>
    <telerik:RadTextBox ID="rtb_1" runat="server"></telerik:RadTextBox>

For example when I hover over , this gets generated..please find attached image..

Now, If I apply style here..

    .riHover {
                background: red !important; 
            }

This will get apply on every input controls of this page, but I want to apply it over first textbox control.

How can I achieve that??
Bb
Top achievements
Rank 1
 asked on 16 Mar 2018
4 answers
114 views
I'm using the editor to allow people to edit HTML that will be sent in an email.

When someone inserts an image it's using a relative path for the image so in the email the image is broken.

Is there a simple way to tell the editor to use a fully-qualified URL for images inserted into it?

Thanks,
Kevin
Rumen
Telerik team
 answered on 16 Mar 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?