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

i have two problems with a grid in batch editing mode and RadDropDownList inside the grid. I set the databinding in code behind for both. The databinding of the RadDropDownList  is in the prerender section of the grid:

protected void rgPmls_PreRender(object sender, EventArgs e)
{RadDropDownList rcbCarrier =    (RadDropDownList)rgPmls.FindControl(rgPmls.MasterTableView.ClientID + "_CarrierId").FindControl("rcbCarrier");

Carrier getCarrier = new Carrier();
rcbCarrier.DataSource = getCarrier.GetCarrier();
rcbCarrier.DataTextField = "Carrier";
rcbCarrier.DataValueField = "CarrierId";
rcbCarrier.DataBind();
}

Here is the grid:

<telerik:RadGrid ID="rgPmls" runat="server" AllowAutomaticDeletes="True"
           AllowAutomaticInserts="True" Skin="Windows7" OnItemInserted="rgPmls_ItemInserted"
           OnItemUpdated="rgPmls_ItemUpdated" AllowAutomaticUpdates="True" AllowPaging="True"
           AutoGenerateColumns="False" Width="1650px" OnBatchEditCommand="rgPmls_BatchEditCommand" Culture="de-DE"  OnItemCommand="rgPmls_ItemCommand" OnNeedDataSource="rgPmls_NeedDataSource" OnPreRender="rgPmls_PreRender">
           <MasterTableView CommandItemDisplay="Top" DataKeyNames="LoadingscheduleId"
               HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
               <BatchEditingSettings EditType="Cell" />
<Columns>
<telerik:GridTemplateColumn HeaderText="Reeder" HeaderStyle-Width="110px" UniqueName="CarrierId" DataField="CarrierId">
    <ItemTemplate>
        <%# Eval("Carrier") %>
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadDropDownList runat="server" ID="rcbCarrier" DataValueField="CarrierId"
            DataTextField="Carrier" Width="100">
        </telerik:RadDropDownList>
    </EditItemTemplate>
    <HeaderStyle Width="110px" HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
</Columns>
<ClientSettings AllowKeyboardNavigation="true">
<Scrolling AllowScroll="True" FrozenColumnsCount="3" UseStaticHeaders="True" />
</ClientSettings></telerik:RadGrid>

The databinding works fine and I can see all the items in the RadDropDownList. But I have the problems when I update the grid:

First problem: When I update the grid in batch editing mode all works fine at the first time and i get the selectedvalues of the RadDrobDownList. When I update
the grid a second time with a new seleted item, I get no value back.

Second problem: When the RadDropDownList has only one item, I also get no value back

What do I forget?

Thx for help.

Regards Thomas
Angel Petrov
Telerik team
 answered on 07 Oct 2014
5 answers
269 views
Hi,
I am evaluating Telerik to replace some controls we have for our project.

We are using a RadSearchBox, and when the user select an entry, based on the entry different things can happen.
One of them is that a popup open with a label inside displaying the user entry name.

So far I have the following

ASP
<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server">
<telerik:RadSearchBox
    ID="RadSearchBox1"
    runat="server"
    Width="300px"
    EmptyMessage="Search..."
    OnClientSearch="aspButtonCallbackFn"
    ShowSearchButton="true">
    <DropDownSettings Height="400" Width="300" />
    <WebServiceSettings Path="Main.aspx" Method="GetResults" />
</telerik:RadSearchBox>
 
<asp:Button runat="server" ID="Button6" OnClick="Button1_Click" Style="display: none" />
<script type="text/javascript" language="javascript">
    function aspButtonCallbackFn() {
        __doPostBack('<%=Button6.UniqueID%>', "");
    }
</script>
</telerik:RadAjaxPanel>
 
<telerik:RadWindow
    ID="modalPopup"
    runat="server"
    Width="360px"
    Height="360px"
    Modal="true">
    <ContentTemplate>
        <div style="height:100px; width:300px; text-align:center;">
            <asp:Table runat="server">
                <asp:TableRow>
                    <asp:TableCell ColumnSpan="2">
                        <asp:Label
                            ID="Lbl_Pnl_ForAdd"
                            runat="server"
                            Text="" />
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell HorizontalAlign="Center">
                        <asp:Button
                            ID="Bttn_Add"
                            Width="100"
                            OnClick="Bttn_Add_Click"
                            Text="Add"
                            runat="server"
                            class="button" />
                    </asp:TableCell>
                    <asp:TableCell HorizontalAlign="Center">
                        <asp:Button
                            ID="Bttn_Cancel_ForAdd"
                            Width="100"
                            OnClick="Bttn_Cancel_ForAdd_Click"
                            Text="Cancel"
                            runat="server"
                            class="button" />
                    </asp:TableCell>
                </asp:TableRow>
            </asp:Table>
        </div>
    </ContentTemplate>
</telerik:RadWindow>
telerik:RadSearchBox
    ID="RadSearchBox1"
    runat="server"
    Width="300px"
    EmptyMessage="Search..."
    OnClientSearch="aspButtonCallbackFn"
    ShowSearchButton="true">
    <DropDownSettings Height="400" Width="300" />
    <WebServiceSettings Path="Main.aspx" Method="GetResults" />
</telerik:RadSearchBox>
 
<asp:Button runat="server" ID="Button6" OnClick="Button1_Click" Style="display: none" />
<script type="text/javascript" language="javascript">
    function aspButtonCallbackFn() {
        __doPostBack('<%=Button6.UniqueID%>', "");
   }
</script>

<telerik:RadWindow
   ID="modalPopup"
runat="server"
Width="360px"
Height="360px"
Modal="true">
<ContentTemplate>
<div style="height:100px; width:300px; text-align:center;" class="popup_Container">
<asp:Table runat="server">
<asp:TableRow>
<asp:TableCell ColumnSpan="2">
<asp:Label
ID="Lbl_Pnl_ForAddExistingInterest"
runat="server"
Text="" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell HorizontalAlign="Center">
<asp:Button
ID="Bttn_Add_ForAddExistingInterest"
Width="100"
OnClick="Bttn_Add_ForAddExistingInterest_Click"
Text="Add"
runat="server"
class="button" />
</asp:TableCell>
<asp:TableCell HorizontalAlign="Center">
<asp:Button
ID="Bttn_Cancel_ForAddExistingInterest"
Width="100"
OnClick="Bttn_Cancel_ForAddExistingInterest_Click"
Text="Cancel"
runat="server"
class="button" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</ContentTemplate>
</telerik:RadWindow>

C#
[WebMethod]
public static SearchBoxData GetResults(SearchBoxContext context)
{
    return SQLAccess.Instance.Search(context.Text);
}
 
protected void Button1_Click(object sender, EventArgs e)
{
    try
    {
        string selectedData = RadSearchBox1.Text;
        Lbl_Pnl_ForAddExistingInterest.Text = String.Format("Do you want to add {0}?", selectedData);
        RadAjaxPanel2.ResponseScripts.Add(String.Format("$find('{0}').ajaxRequest();", RadAjaxPanel2.ClientID));
 
        string script = "function f(){$find(\"" + modalPopup.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
        ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
   }
}

Any help would be welcomed.
Mickael
Top achievements
Rank 1
 answered on 07 Oct 2014
4 answers
136 views
Does Telerik provide Radar Chart for ASP.Net Web.
I am checking this post www.telerik.com/forums/radar-chart-update but I thing it showing that it does not support for ASP.Net web, but supporting for WPF, Silverlight etc
.
Can anybody help me.
Anjan Kant
Top achievements
Rank 2
 answered on 07 Oct 2014
1 answer
174 views
I have a radgrid that displays number values'

Is it possible to scan the entire grid and highlight all cells who's value is great than say 100?
Konstantin Dikov
Telerik team
 answered on 07 Oct 2014
1 answer
180 views
Is there a way to disable the text box visually and from editing using javascript? I was using the radComboBox and it had the .disable() & .enable() functions. I see AutoCompleteBox has the set_enabled(i) however the control appearance is still enabled.
Nencho
Telerik team
 answered on 07 Oct 2014
1 answer
214 views
Hello all..

I have the following peculiar problem.

aspx
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
          </telerik:RadWindowManager>

<telerik:RadNotification ID="n1" runat="server" Text="" Position="Center"
    AutoCloseDelay="5000" Width="450" Title="" KeepOnMouseOver="true"
    EnableRoundedCorners="true" Animation="Resize" ContentIcon="warning"
    AnimationDuration="700" TitleIcon="none" Font-Size="12px" Font-Bold="True"
    ShowCloseButton ="true">
</telerik:RadNotification>

vb
  Protected Sub grdTenders_DeleteCommand(sender As Object, e As GridCommandEventArgs)

     ... code to set the value of <res> below

    If res = 1 Then
      n1.Title = "Error Deleting"
      n1.Text = "Cannot delete this tender. It has been sent out to at least 1 Manufacturer!"
      n1.Show()
      Exit Sub
    End If

...and further down

Protected Sub grdTenDetails_ItemCommand(sender As Object, e As GridCommandEventArgs)

     ... again code to set the value of res below

    If res = 1 Then
      n1.Title = "Error Editing"
      n1.Text = "Cannot Edit this tender. It has been sent out to at least 1 Manufacturer!"
      n1.Show() 
        e.Canceled = True
        Exit Sub
      End If


The first notification works fine.
The second time the notification should be shown (on the second sub) the window pops up without title or text!
It is functional, but the values for <title> and <text> remain the default ones (empty)
I stopped the code in n1.Show() and the values are correct. Then I continue the code and still no text/title.

I even tried to add another notification (r2) on the page and changed the code on the second sub, but still the second window comes up empty!


Any information would be appreciated...




Marin Bratanov
Telerik team
 answered on 07 Oct 2014
11 answers
288 views
Hi,

  I am highlighting first menu item from codebehind by: RadMenu1.Items(0).HighlightPath(). That works as expected.

However, when i am trying to do the same from Javascript i struggle.

I tried:

  function RadMenu1_OnClientItemClicking(sender, eventArgs) {     

          var item = eventArgs.get_item();      
          item.set_selected(true)

This results in both menu items highlighted. Additional problem that when i click outside menu, second item of menu looses it highlight state, but first item stays highlighted.

Another way i tried

         var menu = $find("<%= RadMenu1.ClientID %>");
          var firstItem = menu.get_items().getItem(0).set_selected(true);
          var secondItem = menu.get_items().getItem(1).set_selected(false);
          menu.commitChanges();

Kinda same issues.

Please advice
Boyan Dimitrov
Telerik team
 answered on 07 Oct 2014
2 answers
158 views
Hello all,

I have:

in .aspx
 <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
          </telerik:RadWindowManager>
  <script type="text/javascript">
    function confirmCallbackFn(arg) {
      if (arg) { //the user clicked OK
      __doPostBack("<%=HiddenButton.UniqueID %>", "");
      }
    }

    </script>
 
<div id="divMain" style="position: relative; top: 0px;">
<asp:Button ID="HiddenButton" Text="" OnClick="HiddenButton_Click"
  runat="server" Visible="False" />

....



in the code (inside a delete event of a radgrid)
RadWindowManager1.RadConfirm("Delete this Tender?", "confirmCallBackFn", 330, 180, Nothing, "Confirm")

...and

Protected Sub HiddenButton_Click(sender As Object, e As System.EventArgs) Handles HiddenButton.Click
...the actual code which deletes the Tender from the database
End Sub


While the RadConfirm does get executed, the radconfirm window is not appearing on the page.

Could you please point out my mistake?

Thanks






    


Dimitrios
Top achievements
Rank 1
 answered on 07 Oct 2014
2 answers
140 views
Hi all,
Please help me.
When i use RadCombobox control in filter the column, I get an error:
Selection out of range
Parameter name: value
Exception Details: System.ArgumentOutOfRangeException: Selection out of range
Parameter name: value

1. .aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager>
            <telerik:RadGrid ID="RadGrid1" ShowGroupPanel="false" runat="server" AutoGenerateColumns="False" AllowFilteringByColumn="true" PageSize="3" EnableLinqExpressions="true">
                <ClientSettings>
                    <Resizing AllowColumnResize="true" EnableRealTimeResize="true" />
                    <Scrolling AllowScroll="true" />
                </ClientSettings>
                <MasterTableView>
                    <ColumnGroups>
                        <telerik:GridColumnGroup Name="Left" HeaderText="LEFT" HeaderStyle-HorizontalAlign="Center">
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                        </telerik:GridColumnGroup>
                        <telerik:GridColumnGroup Name="Center" HeaderText="CENTER" ParentGroupName="Left"></telerik:GridColumnGroup>
                        <telerik:GridColumnGroup Name="Right" HeaderText="RIGHT" ParentGroupName="Left"></telerik:GridColumnGroup>
                    </ColumnGroups>
                    <Columns>
                        <telerik:GridBoundColumn DataField="A" HeaderText="AAA" HeaderStyle-HorizontalAlign="Center" ColumnGroupName="Left">
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                            <FilterTemplate>
                                <telerik:RadComboBox ID="cbFilterUserSPIMI" AppendDataBoundItems="true" runat="server"
                                    Height="150px" Width="110px" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("A").CurrentFilterValue %>'
                                    OnClientSelectedIndexChanged="IndexChangedUserSPIMI" OnInit="cbFilterUserSPIMI_Init">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="All" />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RDFilterScriptBlockUserSPIMI" runat="server">
                                    <script type="text/javascript">
                                        function IndexChangedUserSPIMI(sender, args) {
                                            var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID%>");
                                            tableView.filter("A", args.get_item().get_value(), "EqualTo");
                                        }
                                    </script>
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="B" HeaderText="BBB" HeaderStyle-HorizontalAlign="Center" ColumnGroupName="Left">
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                            <FilterTemplate>
                                <telerik:RadComboBox ID="cbFilterB" AppendDataBoundItems="true" runat="server" Height="150px" Width="110px"
                                    SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("B").CurrentFilterValue %>' OnClientSelectedIndexChanged="IndexChangeBBB"
                                    OnInit="cbFilterB_Init">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="All" />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RDBlockforB" runat="server">
                                    <script type="text/javascript">
                                        function IndexChangeBBB(sender, args) {
                                            var tableView = $find("<%#((GridItem)Container).OwnerTableView.ClientID%>");
                                            tableView.filter("B", args.get_item().get_value(), "EqualTo");
                                        }
                                    </script>
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="C" HeaderText="CCC" HeaderStyle-HorizontalAlign="Center" ColumnGroupName="Center">
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="D" HeaderText="DDD" HeaderStyle-HorizontalAlign="Center" ColumnGroupName="Right">
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="E" HeaderText="EEE" HeaderStyle-HorizontalAlign="Center" ColumnGroupName="Right">
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
    </form>
</body>
</html>

2. codebehind

using System;
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 WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RadGrid1.DataSource = GetDB();
            RadGrid1.DataBind();
        }

        protected DataTable GetDB()
        {
            DataTable dtb = new DataTable();

            dtb.Columns.Add("A", typeof(string));
            dtb.Columns.Add("B", typeof(string));
            dtb.Columns.Add("C", typeof(string));
            dtb.Columns.Add("D", typeof(string));
            dtb.Columns.Add("E", typeof(string));

            DataRow dr;

            for (int i = 0; i < 3; i++)
            {
                dr = dtb.NewRow();

                if (i < 1)
                {
                    dr[0] = @"Demo-A\abc";
                    dr[1] = "BBB Demo";
                    dr[2] = "Demo CCC";
                    dr[3] = "DDD Demo";
                    dr[4] = "Demo EEE";
                }
                else if (i == 1)
                {
                    dr[0] = "A/u1010";
                    dr[1] = "BBB*/u2020";
                    dr[2] = "Admid/CCC";
                    dr[3] = "DDD/&^u8080";
                    dr[4] = @"U5050\EEE";
                }
                else if (i == 2)
                {
                    dr[0] = "*&^%\u1011010";
                    dr[1] = "BBB/&^%$#@";
                    dr[2] = "$$$$$/CCC";
                    dr[3] = @"DDD\U56565656%";
                    dr[4] = "EEE/***(((";
                }

                dtb.Rows.Add(dr);
            }

                return dtb;
        }

        string temp = string.Empty;

        protected void cbFilterUserSPIMI_Init(object sender, EventArgs e)
        {

            RadComboBox combo = sender as RadComboBox;
            combo.DataSource = this.GetDB().AsEnumerable().Select(row => row.Field<string>("A")).Where(s => !string.IsNullOrEmpty(s)).Distinct().OrderBy(s => s);
        }

        protected void cbFilterB_Init(object sender, EventArgs e)
        {
            RadComboBox combo = sender as RadComboBox;
            combo.DataSource = this.GetDB().AsEnumerable().Select(row => row.Field<string>("B")).Where(s => !string.IsNullOrEmpty(s)).Distinct().OrderBy(s => s);
        }

    }
}

Thank you very much
Hung
Top achievements
Rank 1
 answered on 07 Oct 2014
1 answer
99 views
I have a RibbonBarSplitButton containing three RibbonBarButton items. If I set the SplitButton to enabled and the child Buttons to disabled, the SplitButton uses the disabled image, even though the control itself is enabled.

If I dynamically set the first button to enabled, the SplitButton image is not updated and still shows as disabled. After enabling the child button, I have to disable the SplitButton and then re-enable it for its image to change.

Is this a bug or am I missing something in how the controls are supposed to interact?

I am on Q2 2014 SP1

<telerik:RibbonBarSplitButton ID="testSplit" Text="Split Button" Size="Large" ImageUrlLarge="Enabled.png"
    DisabledImageUrlLarge="Disabled.png" ImageRenderingMode="Dual" Enabled="true" >
    <Buttons>
        <telerik:RibbonBarButton ID="testSub1" Text="Option 1" ImageUrl="MyIcon.png"
            DisabledImageUrl="MyIconDis.png" Enabled="false" Value="alert('Option 1 clicked')" />
        <telerik:RibbonBarButton ID="testSub2" Text="Option 2" ImageUrl="MyIcon.png"
            DisabledImageUrl="MyIconDis.png" Enabled="false" Value="alert('Option 2 clicked')" />
    </Buttons>
</telerik:RibbonBarSplitButton>
.
Derek
Top achievements
Rank 1
 answered on 06 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?