Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
189 views
Hello,

Telerik Version we are using:2010.3.1317 we are using .net framework 2.0 and cannot upgrade to 3.5 or 4.0 at the moment.

and the version we are using, i think, is the latest one for 2.0.

Problem Detail:
we have an user control .ascx(Editor) that is wrapping RadEditor.

now using chrome or safari, on pressing "Tab" key it inserts:
<span class="Apple-tab-span" style="white-space:pre"> </span>

to overcome this problem i decided to override Telerik.Web.UI.Editor.CommandList["InsertTab"] event so on .ascx page i did following:
<script type="text/javascript">
 if (typeof (Telerik) != 'undefined') {
        Telerik.Web.UI.Editor.CommandList["InsertTab"] = function(commandName, editor, args) {
   //alert('success");
           editor.pasteHtml("&nbsp;&nbsp;&nbsp;&nbsp;");
        };
    }
</script>

Which is working fine in IE9 but not in chrome/safari. i tried using an alert message but it simply not firing the code.

I would appreciate any/all help i could get.

Rumen
Telerik team
 answered on 15 Oct 2012
9 answers
781 views
Hi,

I have rad combobox with search functionality implemented. I have selected index change event for that combobox, this is my  code . I applied filter starts with

 

<telerik:RadComboBox ID="dropDownListCategory" MarkFirstMatch="True" EmptyMessage="<--select One-->" 

 

 

AllowCustomText="false" runat="server" Width="200px" Height="200px" CssClass="maarginleft10 textBox200"  

 

 

Skin="Web20" AutoPostBack="true" EnableEmbeddedSkins="false" OnSelectedIndexChanged="dropDownListCategory_SelectedIndexChanged" 

 

 

EnableEmbeddedScripts="true"

 

 

</telerik:RadComboBox>

When i type nothing in the combobox the empty message displayed correctly. at the same time i need to validate one  more thing. If i enter the text which is not at all exists there in the dropdown then i need to show the same empty message in tabout. but the postback occurs and taking the invalid text to the server.  I used onblur event but it throws error

 

function OnClientBlur(item) {
//i need the following here

 

if(item.value=="")
// empty message of the combo shd be set if the invalid text typed
// EmptyMessage="<--select One-->" 

 

 

}

how to achieve this. pls help

 

 

Thanks,
Jeevitha

David McClelland
Top achievements
Rank 1
 answered on 15 Oct 2012
2 answers
93 views
I have a website with telerik controls. I am using also the RadStyleSheet in my masterpage. Sometimes the website is loaded without css stylesheet but I dont know why. I know it occured in IE 8. I dont know how to reproduce this problem because sometimes it works OK and sometimes it dont work! This is the RadStyleSheetManager in my masterpage:

<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" EnableStyleSheetCombine="true"
        OutputCompression="AutoDetect">
        <StyleSheets>
            <telerik:StyleSheetReference Path="~/Styles/Site.css" />
            <telerik:StyleSheetReference Path="~/Styles/Handheld.css" />
            <telerik:StyleSheetReference Path="~/Styles/Skins/Button.css" />
            <telerik:StyleSheetReference Path="~/Styles/Skins/Grid.css" />
            <telerik:StyleSheetReference Path="~/Styles/Skins/Menu.css" />
            <telerik:StyleSheetReference Path="~/Styles/Skins/Window.css" />
            <telerik:StyleSheetReference Path="~/Styles/Skins/CTAC/Button.CTAC.css" />
            <telerik:StyleSheetReference Path="~/Styles/Skins/CTAC/Grid.CTAC.css" />
            <telerik:StyleSheetReference Path="~/Styles/Skins/CTAC/Menu.CTAC.css" />
            <telerik:StyleSheetReference Path="~/Styles/Skins/CTAC/Window.CTAC.css" />
        </StyleSheets>
    </telerik:RadStyleSheetManager>

Does someone know how I can fix this?
Khalid
Top achievements
Rank 1
 answered on 15 Oct 2012
1 answer
84 views
I am using related comboboxes as outlined in this article: http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx - I have a series of comboboxes that helps narrow down addresses.  My comboboxes in order are: Country - State - County - Zip - City.  I can successfully pass a single value from one combobox to the next and the result set is narrowed down correctly.  However, if I try to pass the selected values from state, county, and zip to narrow down the potential city selections, I get undefined values for state and county, but zip will pass correctly.  When I perform a postback I can access all the selected values in the comboboxes.  What am I missing?
Nencho
Telerik team
 answered on 15 Oct 2012
1 answer
104 views
Hello,

in addition to following post:
http://www.telerik.com/community/forums/aspnet-ajax/editor/overide-telerik-web-ui-editor-commandlist-inserttab-not-working-in-chrome-safari.aspx

i am having another issue with Rad Editor and that is:
NewLineBr = "false" (due to other bugs on IE)

now using CHROME, when is type following in content area:
a
b
c
d

on "inspect element" i found it to be:
<p>a</p>
<p>b</p>
<p>c</p>
<p>d</p>

now when i click "Bullet List" tool bar button it become:
<UL>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
</UL>

so far its good, but when i click "Bullet List" toolbar button gain, it become:
a
<br/>
b
<br/>
c
<br/>
d

the issue here is i need to reapply <p> tags again as it was before hittin "Bullet List" button first time.

Any/All help will be appreciated.
Rumen
Telerik team
 answered on 15 Oct 2012
1 answer
94 views
I have a RadGrid which I am exporting to excel.

I'm using 
grid.ExportSettings.ExportOnlyData = false;
grid.ExportSettings.Excel.Format = GridExcelExportFormat.Html;

My grid contains custom aggregates.

When I export. The export is missing all my custom aggregates and the footer and group footer rows.
Kostadin
Telerik team
 answered on 15 Oct 2012
1 answer
63 views
Hi,

Your product is awesome but i need an Editor who fully compatible with open office XML so i can convert Editor's html to .docx file format with track changes.
Please guide me that your Editor support these kind of stuff.

Regards,
Sohail Ahmad
Rumen
Telerik team
 answered on 15 Oct 2012
12 answers
805 views
hi,

I have two combo box

the first one has auto post back true so when selected index changed it fills the second combo box

                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="lblDevGroups" runat="server" Text="Groups"></asp:Label></td>
                            <td>
                                    <telerik:RadComboBox ID="ddlDevGroups" runat="server" Width="200px" MarkFirstMatch="true" AutoPostBack="true" />
                                </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblDevices" runat="server" Text="Devices" Visible="False"></asp:Label></td>
                            <td>
                                <telerik:RadComboBox ID="ddlDevices" runat="server" Width="200px" MarkFirstMatch="true" AutoPostBack="false" Visible="false">
                                    <ItemTemplate>   
                                    <table style="border-bottom: 1px dotted #EFEFEF; margin-bottom: 10px; font-size: 11px;" width="98%">     
                                        <tr>       
                                            <td>         
                                                <img src='<%# DataBinder.Eval(Container, "Normal_IconPath")%>' alt="" />       
                                            </td>       
                                            <td>
                                                 <%#DataBinder.Eval(Container, "Serial_No")%>
                                                (<%#DataBinder.Eval(Container, "Device_Name")%>)
                                            </td>     
                                        </tr>   
                                    </table>
                                    </ItemTemplate>
                                </telerik:RadComboBox>
                                </td>
                            <td>
                                <asp:Button ID="btnEditDevices" runat="server" Text="Edit" Visible="False" /></td>
                        </tr>
                    </table>

the ddlDevGroubs (the first combo box) selected index changed event is:

        ddlDevices.Items.Clear()
        Dim strGroupID As String = ddlDevGroups.SelectedValue
        If Not strGroupID = "" Then

            Dim strSQLDevices As String = "Select ds.ID, ds.Device_ID, ds.Device_Name, ds.Serial_No, ds.Icon, dc.Normal_IconPath  from CTS_DeviceSettings ds inner join dbo.CTS_DeviceIcons dc on ds.Icon = dc.id where ds.group_ID=" & strGroupID
            Dim dsDevices As DataSet = clsDB.getData(strSQLDevices)

            If Not dsDevices Is Nothing Then
                If dsDevices.Tables(0).Rows.Count > 0 Then

                    Dim dtDevices As DataTable = dsDevices.Tables(0)
                    'dtDevices.Columns.Add("DevIDName")

                    'Dim i As Integer = 0
                    'For i = 0 To dtDevices.Rows.Count - 1
                    '    Dim strDevName As String

                    '    If IsDBNull(dtDevices.Rows(i)("Device_Name")) Then
                    '        strDevName = ""
                    '    Else
                    '        strDevName = dtDevices.Rows(i)("Device_Name")
                    '    End If

                    '    Dim strDevID As String = dtDevices.Rows(i)("Device_ID")

                    '    Dim strDevSerialNo As String = ""

                    '    If Not IsDBNull(dtDevices.Rows(i)("Serial_No")) Then
                    '        strDevSerialNo = dtDevices.Rows(i)("Serial_No")
                    '    Else
                    '        strDevSerialNo = ""
                    '    End If

                    '    If Not strDevName = "" Then
                    '        dtDevices.Rows(i)("DevIDName") = strDevSerialNo & " (" & strDevName & ")"
                    '    Else
                    '        dtDevices.Rows(i)("DevIDName") = strDevSerialNo
                    '    End If

                    'Next

                    For Each row As DataRow In dtDevices.Rows
                        row("Normal_IconPath") = Page.ResolveClientUrl(row("Normal_IconPath").ToString())
                    Next

                    ddlDevices.DataSource = dtDevices
                    'ddlDevices.DataTextField = "DevIDName"
                    'ddlDevices.DataValueField = "ID"
                    ddlDevices.DataBind()
                    lblMessage.Visible = False
                    lblDevices.Visible = True
                    ddlDevices.Visible = True
                    ddlDevices.Visible = True
                    btnEditDevices.Visible = True
                    btnEditDevices.Visible = True
                    lblDevices.Visible = True
                Else
                    'No Device Records
                    lblMessage.Text = "No Devices have been Found"
                    lblMessage.Visible = True
                    pnlInfo.Visible = False
                    ddlDevices.Visible = False
                    btnEditDevices.Visible = False
                    lblDevices.Visible = False
                    clsLog.WriteNoRecords("/Members/Devices/Configuration.aspx", strSQLDevices)
                End If

            Else
                'error Devices
                lblMessage.Text = "Error While retriving Devices information"
                lblMessage.Visible = True
                clsLog.WriteSQLError("/Members/Devices/Configuration.aspx", strSQLDevices)
            End If
        Else
            lblMessage.Text = "Please select a group"
            lblMessage.Visible = True
            ddlDevices.Visible = False
            btnEditDevices.Visible = False
            lblDevices.Visible = False
        End If

now after all I got this error:

DataBinding: 'Telerik.Web.UI.RadComboBoxItem' does not contain a property with the name 'Normal_IconPath'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinding: 'Telerik.Web.UI.RadComboBoxItem' does not contain a property with the name 'Normal_IconPath'.

Source Error:

Line 90:                                         <tr>       
Line 91:                                             <td>         
Line 92:                                                 <img src='<%# DataBinder.Eval(Container, "Normal_IconPath")%>' alt="" />       
Line 93:                                             </td>       
Line 94:                                             <td><%#DataBinder.Eval(Container, "Serial_No")%>

so any help please?
Nencho
Telerik team
 answered on 15 Oct 2012
1 answer
305 views
I have the  following scenario.
See Captura1.


1- RadListBox
2- UserGrid
3- Custom transfer buttons.
4- Add Button.

All is working fine except the steps defined in captura1.

I click on Add Button --> Open a new RadWindows, Save, Close this windows and execute AjaxRequest ( THIS WORKS PERFECT!!)
AjaxRequest execute a methods whose reload RadListBox, in debug mode I saw the new User , but in UI RadListBox does not show the new User.


this is my ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AssociateUsers.ascx.cs"
    Inherits="WebSearch.UI.Admin.UserControls.Community.AssociateUsers" %>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">


        function GridCreated() {
            grid = $find("<%=UserGrid.ClientID%>");
            var btnEdit = $find("<%=btnEditUser.ClientID%>");
            var selectedRows = grid.MasterTableView.get_selectedItems();
            if (selectedRows.length == 1 & btnEdit != null) {
                btnEdit.set_visible(true);
                
            } else { btnEdit.set_visible(false) };
        }
        function RowSelected(sender, eventArgs) {
            HideShowEditButton(sender, eventArgs);
        }


        function RowDeselected(sender, eventArgs) {
            HideShowEditButton(sender, eventArgs);
        }


        function HideShowEditButton(sender, eventArgs) {
            var grid = sender;




            var btnEdit = $find("<%=btnEditUser.ClientID%>");
            var selectedRows = grid.MasterTableView.get_selectedItems();
            if (selectedRows.length == 1) {
                btnEdit.set_visible(true);


                var grid = $find("<%=UserGrid.ClientID %>");
                debugger;


                var selectedItem = grid.MasterTableView.get_selectedItems()[0];


                document.getElementById('associateUsers_UserId').value = selectedItem.getDataKeyValue("Id");
                var currentTooltip = btnEdit.get_toolTip();
                var userFullName = selectedItem.getDataKeyValue("FullName");
                if (currentTooltip.indexOf("{UserFullName}") > 0) {
                    currentTooltip = currentTooltip.replace("{UserFullName}", userFullName);
                   
                }
                else {
                    if (currentTooltip.indexOf(document.getElementById('associateUsers_UserNameBefore').value) > 0) {
                        var token = document.getElementById('associateUsers_UserNameBefore').value;
                        currentTooltip = currentTooltip.replace(token, userFullName);
                    } 
                }


                document.getElementById('associateUsers_UserNameBefore').value = userFullName;
                
               
     
                btnEdit.set_toolTip(currentTooltip);  
                


            } else { btnEdit.set_visible(false); }
        }


        function editUser() {


            var id = document.getElementById('associateUsers_UserId').value;
            if (id != null) {
                var oBrowserWnd = GetRadWindow().BrowserWindow;
                var oWindow = oBrowserWnd.radopen("UserForm.aspx?ID=" + id, "UserFormDialog");
                oWindow.set_modal(true);
                oWindow.set_visibleStatusbar(false);
                oWindow.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
                oWindow.setSize(800, 600);
                oWindow.center();
            }




            return false;
        }


        function addUser() {


            var oBrowserWnd = GetRadWindow().BrowserWindow;
            var oWindow = oBrowserWnd.radopen("UserForm.aspx", "UserFormDialog");
            oWindow.set_modal(true);
            oWindow.set_visibleStatusbar(false);
            oWindow.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
            oWindow.setSize(800, 600);
            oWindow.center();
            return false;
        }




        function rbtnClear_OnClientClicking(sender, eventArgs) {
            clearFilterText();
            var listbox = $find("<%=rlbAvailableUser.ClientID%>");
            clearListEmphasis(listbox);
            createMatchingList(listbox, "");
        }


        function rlbAvailableUser_OnClientTransferring(sender, eventArgs) {
            clearListEmphasis(sender);
            clearFilterText();
            createMatchingList(sender, "");
            reDesignControls();
        }








        function filterList() {


            var listbox = $find("<%=rlbAvailableUser.ClientID%>");
            var textbox = $find('<%=tbAvailableFilterUser.ClientID%>');


            clearListEmphasis(listbox);
            createMatchingList(listbox, textbox.get_textBoxValue());
        }


        function clearListEmphasis(listbox) { ClearListEmphasis(listbox); }


        function createMatchingList(listbox, filterText) { CreateMatchingList(listbox, filterText); }


        // Clears the text from the filter.
        function clearFilterText() {
            var textbox = $find('<%=tbAvailableFilterUser.ClientID%>');
            textbox.clear();
        }


    </script>
</telerik:RadCodeBlock>
<asp:Table ID="Table1" runat="server" CssClass="mainTable">
    <asp:TableRow>
        <asp:TableCell CssClass="titleColumnLeftButton">
            <telerik:RadButton ID="btnAddUser" runat="server" Skin="Vista" AutoPostBack="false"
                OnClientClicked="addUser">
                <Icon PrimaryIconUrl="/UI/Images/add.png" PrimaryIconWidth="21px" PrimaryIconHeight="25px"
                    PrimaryIconTop="3px" PrimaryIconLeft="9px" />
            </telerik:RadButton>
        </asp:TableCell>
        <asp:TableCell CssClass="titleColumnRightButton">
            <telerik:RadButton ID="btnEditUser" runat="server" Skin="Vista" AutoPostBack="false"
                OnClientClicked="editUser">
                <Icon PrimaryIconUrl="/UI/Images/pencil.png" PrimaryIconWidth="21px" PrimaryIconHeight="25px"
                    PrimaryIconTop="3px" PrimaryIconLeft="9px" />
            </telerik:RadButton>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
        <asp:TableCell CssClass="titleColumnLeft">
            <asp:Literal runat="server" ID="litAvailable" /></asp:TableCell>
        <asp:TableCell CssClass="titleColumnRight">
            <span style="white-space: normal;">
                <asp:Label runat="server" ID="litSelected" />
            </span>
        </asp:TableCell>
    </asp:TableRow>
   
    <asp:TableRow>
        <asp:TableCell ColumnSpan="2" CssClass="listBoxTable">
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="100%" Width="100%"
                LoadingPanelID="LoadCombo">
                <asp:Table runat="server" ID="tblListBox" CssClass="subTable" >
                    <asp:TableRow>
                        <asp:TableCell CssClass="searchColumnLeft">
                            <asp:Table runat="server" ID="Table2"  CssClass="subTable" >
                                <asp:TableRow>
                                    <asp:TableCell ColumnSpan="2">
                                        <div class="cellTextBoxSearchL">
                                            <telerik:RadTextBox ID="tbAvailableFilterUser" runat="server" Width="100%" autocomplete="on"
                                                onkeyup="filterList();" />
                                        </div>
                                        <div class="cellLabelSearchL">
                                            <telerik:RadButton ID="rbtnClear" runat="server" Width="19px" AutoPostBack="false"
                                                OnClientClicking="rbtnClear_OnClientClicking" Style="margin-left: 1px">
                                                <Icon PrimaryIconUrl="/UI/Images/cross.png" PrimaryIconWidth="18px" PrimaryIconTop="3px"
                                                    PrimaryIconLeft="3px" />
                                            </telerik:RadButton>
                                        </div>
                                    </asp:TableCell>
                                </asp:TableRow>
                                 <asp:TableRow>
                                   <asp:TableCell CssClass="leftColumn">
                            <telerik:RadListBox ID="rlbAvailableUser" runat="server" Width="100%" AllowTransferOnDoubleClick="true"
                                SelectionMode="Multiple" Height="100%" EnableDragAndDrop="true" Sort="Ascending"
                                OnClientTransferring="rlbAvailableUser_OnClientTransferring" AutoPostBackOnTransfer="true">
                            </telerik:RadListBox>
                        </asp:TableCell>
                        <asp:TableCell CssClass="centerColumn">
                            <telerik:RadButton ID="btnToRight" runat="server" Width="19px" AutoPostBack="true"
                                OnClick="btnToRight_Click" Style="margin-left: 1px">
                                <Icon PrimaryIconUrl="/UI/Images/toRight.png" PrimaryIconWidth="16px" PrimaryIconTop="3px"
                                    PrimaryIconLeft="3px" />
                            </telerik:RadButton>
                            <br />
                            <br />
                            <telerik:RadButton ID="btnToLeft" runat="server" Width="19px" AutoPostBack="true"
                                Style="margin-left: 1px" OnClick="btnToLeft_Click">
                                <Icon PrimaryIconUrl="/UI/Images/toLeft.png" PrimaryIconWidth="16px" PrimaryIconTop="3px"
                                    PrimaryIconLeft="3px" />
                            </telerik:RadButton>
                            <br />
                            <br />
                            <telerik:RadButton ID="btnAllToRight" runat="server" Width="19px" AutoPostBack="true"
                                Style="margin-left: 1px" OnClick="btnAllToRight_Click">
                                <Icon PrimaryIconUrl="/UI/Images/allToRight.png" PrimaryIconWidth="16px" PrimaryIconTop="3px"
                                    PrimaryIconLeft="3px" />
                            </telerik:RadButton>
                            <br />
                            <br />
                            <telerik:RadButton ID="btnAllToLeft" runat="server" Width="19px" AutoPostBack="true"
                                Style="margin-left: 1px" OnClick="btnAllToLeft_Click">
                                <Icon PrimaryIconUrl="/UI/Images/allToLeft.png" PrimaryIconWidth="16px" PrimaryIconTop="3px"
                                    PrimaryIconLeft="3px" />
                            </telerik:RadButton>
                            <br />
                        </asp:TableCell>
                                  </asp:TableRow>
                            </asp:Table>
                        </asp:TableCell>
                        <asp:TableCell CssClass="searchColumnRight">
               <telerik:RadGrid ID="UserGrid" runat="server" AutoGenerateColumns="false" Skin="Vista"
                                AllowMultiRowSelection="True" PageSize="10" AllowPaging="true" EnableViewState="false">
                                <MasterTableView DataKeyNames="Id,FullName" ClientDataKeyNames="Id,FullName" CommandItemDisplay="None"
                                    EditMode="InPlace">
                                    <Columns>
                                        <telerik:GridClientSelectColumn CommandName="Select" UniqueName="Select" HeaderStyle-Width="30px"
                                            Resizable="false" />
                                        <telerik:GridTemplateColumn DataField="Id" HeaderText="Id" UniqueName="Id" Visible="false"
                                            ConvertEmptyStringToNull="true">
                                            <InsertItemTemplate>
                                                <telerik:RadTextBox ID="lblId" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Id") %> '
                                                    Width="150px" ReadOnly="true" Enabled="false" CssClass="labelGrid" />
                                            </InsertItemTemplate>
                                             
                                            <EditItemTemplate>
                                                <telerik:RadTextBox ID="txtId" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Id") %> '
                                                    Width="150px" CssClass="labelGrid" ReadOnly="true" />
                                            </EditItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn UniqueName="FullName" DataField="FullName" HeaderStyle-Width="60%">
                                            <ItemTemplate>
                                                <asp:Label ID="lblFullName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "FullName") %>'></asp:Label>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn UniqueName="IsAdmin" DataField="IsInput" DataType="System.Boolean"
                                            HeaderStyle-Width="30%">
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkIsAdmin" Width="120px" runat="server" Checked='<%# (DataBinder.Eval(Container.DataItem,"IsAdmin") is DBNull ?false:Eval("IsAdmin")) %>'
                                                    OnCheckedChanged="chkIsAdmin_Checked" AutoPostBack="true" />
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <ClientEvents OnGridCreated="GridCreated" OnRowSelected="RowSelected" OnRowDeselected="RowDeselected" />
                                </ClientSettings>
                            </telerik:RadGrid>
                        </asp:TableCell>
                      
                     
                    </asp:TableRow>
                </asp:Table>
            </telerik:RadAjaxPanel>
        </asp:TableCell>
    </asp:TableRow>
</asp:Table>
<asp:HiddenField ID="CommunityId" runat="server" />
<asp:HiddenField ID="UserId" runat="server"  />


<asp:HiddenField ID="UserNameBefore" runat="server"  />


this is my ascx.cs

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Resources;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using WebSearch.Components.CommonFunctions;
using WebSearch.Components.GeneralFunctions;
using WebSearch.SecurityModel;
using WebSearch.UI.UserControls;


namespace WebSearch.UI.Admin.UserControls.Community
{
    public partial class AssociateUsers : System.Web.UI.UserControl
    {


        #region Properties&Variables


        private string _culture;


        private ResourceManager _resources;


        private RadAjaxManager AjaxManager { get; set; }


        private RadAjaxLoadingPanel Loading { get; set; }


        public WSOrganization Organization = new WSOrganization();




        public int Id
        {
            get { return Convert.ToInt16(CommunityId.Value); } 
            set { CommunityId.Value = value.ToString(); }
        }




        public Notification _notification  = new Notification();


        public List<WSUser> GetUserAssociated
        {
            get { return CommunityUsers; }
            
        }




        protected List<WSUser> CommunityUsers
        {
            get
            {
                try
                {
                    object obj = Session["CommunityUsers"];


                    if (obj == null )
                    {
                        obj = Organization.GetUsersOfCommunity(Id);


                        if (obj != null)
                        {
                            Session["CommunityUsers"] = obj;
                        }
                        else
                        {
                            obj = new List<WSUser>();
                        }
                    }


                    return (List<WSUser>)obj;
                }
                catch
                {
                    Session["CommunityUsers"] = null;
                }
                return new List<WSUser>();
            }
            set { Session["CommunityUsers"] = value; }
        }


        protected List<WSUser> AvailableUsers
        {
            get
            {
                try
                {
                    object obj = Session["AvailableUsers"];
                    if (obj == null)
                    {
                        obj = Organization.GetAvailableUsers(Id);


                        if (obj != null)
                        {
                            Session["AvailableUsers"] = obj;
                        }
                        else
                        {
                            obj = new List<WSUser>();
                        }
                    }
                    return (List<WSUser>)obj;
                }
                catch
                {
                    Session["AvailableUsers"] = null;
                }
                return new List<WSUser>();
            }


            set { Session["AvailableUsers"] = value; }
        }
        


        #endregion




        #region Events


        #region Page


        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                LoadAjax();
                
            }
            catch(Exception ex)
            {
                _notification.LoadCatchNotification(ex, typeof(CommunityForm).FullName);
            }
           
        }


      


        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);


            GetInfo();
            LoadSettings();




            UserGrid.NeedDataSource += UserGrid_NeedSource;
            UserGrid.ItemCommand += UserGrid_ItemCommand;


        }


        private void UserGrid_ItemCommand(object sender, GridCommandEventArgs e)
        {
           if (e.CommandName == RadGrid.SelectCommandName && e.Item is GridDataItem)
           {
               var a = 1;
           }


        }


        #endregion


        #region Buttons


        protected void btnToRight_Click(object sender, EventArgs e)
        {
             List<WSUser> avalible = AvailableUsers;
             List<WSUser> communityUsers = CommunityUsers;


           foreach(RadListBoxItem item in  rlbAvailableUser.SelectedItems)
           {
               int userId = Convert.ToInt16(item.Value);


               communityUsers.Insert(0, GetUser(AvailableUsers, userId));
               avalible.Remove(GetUser(AvailableUsers, userId));


           }


            AvailableUsers = avalible;
            CommunityUsers = communityUsers;


            FillAvailableUsers();
            UserGrid.DataSource = CommunityUsers;
            UserGrid.Rebind();
            UserGrid.MasterTableView.ClearSelectedItems();


        }




        protected void btnToLeft_Click(object sender, EventArgs e)
        {
            List<WSUser> avalible = AvailableUsers;
            List<WSUser> communityUsers = CommunityUsers;


            foreach (GridDataItem  item in UserGrid.MasterTableView.GetSelectedItems())
            {
                int userId = Convert.ToInt16(item.GetDataKeyValue("Id"));


                avalible.Insert(0, GetUser(CommunityUsers, userId));
                communityUsers.Remove(GetUser(CommunityUsers, userId));


            }


            AvailableUsers = avalible;
            CommunityUsers = communityUsers;


            FillAvailableUsers();
            UserGrid.DataSource = CommunityUsers;
            UserGrid.Rebind();
            UserGrid.MasterTableView.ClearSelectedItems();
        }




        protected void btnAllToRight_Click(object sender, EventArgs e)
        {
            List<WSUser> avalible = AvailableUsers;
            List<WSUser> communityUsers = CommunityUsers;


            foreach (RadListBoxItem item in rlbAvailableUser.Items)
            {
                int userId = Convert.ToInt16(item.Value);


                communityUsers.Insert(0, GetUser(AvailableUsers, userId));
                avalible.Remove(GetUser(AvailableUsers, userId));


            }


            AvailableUsers = avalible;
            CommunityUsers = communityUsers;


            FillAvailableUsers();
            UserGrid.DataSource = CommunityUsers;
            UserGrid.Rebind();
            UserGrid.MasterTableView.ClearSelectedItems();
        }


        protected void btnAllToLeft_Click(object sender, EventArgs e)
        {
            List<WSUser> avalible = AvailableUsers;
            List<WSUser> communityUsers = CommunityUsers;


            foreach (GridDataItem item in UserGrid.MasterTableView.Items)
            {
                int userId = Convert.ToInt16(item.GetDataKeyValue("Id"));


                avalible.Insert(0, GetUser(CommunityUsers, userId));
                communityUsers.Remove(GetUser(CommunityUsers, userId));


            }


            AvailableUsers = avalible;
            CommunityUsers = communityUsers;


            FillAvailableUsers();
            UserGrid.DataSource = CommunityUsers;
            UserGrid.Rebind();
            UserGrid.MasterTableView.ClearSelectedItems();
        }


        #endregion


        #region grid


        protected void UserGrid_NeedSource(object sender, GridNeedDataSourceEventArgs e)
        {
            UserGrid.DataSource = CommunityUsers;
        }


      


        protected void chkIsAdmin_Checked(object sender, EventArgs e)
        {
            CheckBox chkIsAdmin = (CheckBox)sender;
            
            string Id = (chkIsAdmin.Parent.NamingContainer as GridDataItem).GetDataKeyValue("Id").ToString();


            List<WSUser> communityUsers = CommunityUsers;


           (GetUser(CommunityUsers, Convert.ToInt16(Id))).IsAdmin =  chkIsAdmin.Checked;


            CommunityUsers = communityUsers;
        }


        #endregion


        #region ListBox


        protected void rlbChosenUser_SelectedIndexChange(object sender, EventArgs e)
        {
            try
            {


            }
            catch (Exception ex)
            {
                _notification.LoadCatchNotification(ex, typeof(AssociateUsers).FullName);
            }
        }


        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            switch (e.Argument)
            {
                case "RefeshForm":
                    UpdateSession();
                    
                    break;


                
            }
        }


        #endregion
        #endregion


        #region Methods


        #region Page


        private void UpdateSession()
        {
           


            List<WSUser> avalible =AvailableUsers;
            List<WSUser> comunityUsers = CommunityUsers;


            avalible = Organization.GetAvailableUsers(Id);
            comunityUsers = Organization.GetUsersOfCommunity(Id);




            AvailableUsers = avalible;
            CommunityUsers = comunityUsers;
            FillAvailableUsers();
            UserGrid.DataSource = CommunityUsers;
            UserGrid.Rebind();


            foreach(GridDataItem  item in UserGrid.Items)
            {
                if (item.GetDataKeyValue("Id").ToString() == UserId.Value)
                {
                    item.Selected = true;


                   btnEditUser.ToolTip =
                    _resources.GetString(btnEditUser.ID + "_ToolTip", new CultureInfo(_culture)).Replace("{UserFullName}",
                                                                                            item.GetDataKeyValue("FullName").ToString());


                }
            }


            //if (items.Count() > 0)
            //{
            //    foreach (GridDataItem item in items)
            //    {
                    
            //        foreach (GridDataItem row in UserGrid.Items)
            //        {
            //            if (row.GetDataKeyValue("Id").ToString() == item.GetDataKeyValue("Id").ToString())
            //            {
            //                row.Selected = true;
            //            }


            //        }


            //    }
            //}




            //if (items.Count() == 1)
            //{
            //    //string userFullName = items[0].GetDataKeyValue("FullName").ToString();


            //    //btnEditUser.ToolTip =
            //    //_resources.GetString(btnEditUser.ID + "_ToolTip", new CultureInfo(_culture)).Replace("{UserFullName}",
            //    //                                                                        userFullName);
            
            //}


            






        }


        private void PageSettings()
        {
            btnAddUser.Text = _resources.GetString(btnAddUser.ID, new CultureInfo(_culture));
            btnEditUser.Text = _resources.GetString(btnEditUser.ID, new CultureInfo(_culture));
            btnEditUser.ToolTip = _resources.GetString(btnEditUser.ID + "_ToolTip", new CultureInfo(_culture));




            litAvailable.Text = _resources.GetString(litAvailable.ID, new CultureInfo(_culture));
            litSelected.Text = _resources.GetString(litSelected.ID, new CultureInfo(_culture));


            tbAvailableFilterUser.EmptyMessage = _resources.GetString(tbAvailableFilterUser.ID , new CultureInfo(_culture));


            ButtonsSetting();
        }


        private void ButtonsSetting()
        {
            btnToRight.ToolTip = _resources.GetString(btnToRight.ID, new CultureInfo(_culture));
            btnToLeft.ToolTip = _resources.GetString(btnToLeft.ID, new CultureInfo(_culture));
            btnAllToRight.ToolTip = _resources.GetString(btnAllToRight.ID, new CultureInfo(_culture));
            btnAllToLeft.ToolTip = _resources.GetString(btnAllToLeft.ID, new CultureInfo(_culture));
            //if (!Page.IsPostBack) btnEditUser.Visible = false;
        }


        private void LoadAjax()
        {
            AjaxManager = Page.FindControl("RadAjaxManager1") as RadAjaxManager;
            AjaxManager.AjaxRequest += RadAjaxManager1_AjaxRequest;


            Loading = Page.FindControl("LoadCombo") as RadAjaxLoadingPanel;


            if (AjaxManager == null || Loading == null) return;


            AjaxManager.AjaxSettings.AddAjaxSetting(UserGrid, UserGrid);
           
            AjaxManager.AjaxSettings.AddAjaxSetting(AjaxManager, UserGrid);
            AjaxManager.AjaxSettings.AddAjaxSetting(AjaxManager, btnEditUser);
            AjaxManager.AjaxSettings.AddAjaxSetting(btnEditUser, UserGrid);
          
         
        }


        private void GetInfo()
        {
            _culture = Variables.CurrentCulture();
            _resources = Components.GeneralFunctions.Resources.GetAdminUserControlResources("AssociateUsers", "Community");
        }
        
        private void LoadSettings()
        {
            if (string.IsNullOrEmpty(_culture) || _resources == null) GetInfo();
            PageSettings();
            GridSettings();
            
            FillAvailableUsers();
        }




        private static WSUser GetUser(IEnumerable<WSUser> fieldsToSearchIn, int userId)
        {
            return fieldsToSearchIn.FirstOrDefault(x => x.Id == userId);
        }


        #endregion


        #region grid


        private void GridSettings()
        {
            CustomProperties(UserGrid); /* use common properties */
            GridFunction.SetHeaderNameUnCommonGrid(UserGrid, _resources, null,1);
            GridFunction.GridOptions(UserGrid);


        }


        public void CustomProperties(RadGrid grid)
        {
            grid.AllowPaging = true;
            grid.AllowSorting = true;
            grid.CellSpacing = 0;
            grid.EnableHeaderContextMenu = false;
            grid.EnableHeaderContextFilterMenu = false;




            grid.AllowFilteringByColumn = true;
            grid.GridLines = GridLines.None;
            grid.Skin = "Vista";
            grid.Width = Unit.Percentage(100);
            grid.PageSize = 10;




            grid.ItemStyle.VerticalAlign = VerticalAlign.Middle;
            grid.GroupingSettings.CaseSensitive = false;


            grid.PagerStyle.AlwaysVisible = false;
            grid.PagerStyle.Mode = GridPagerMode.NumericPages;




            grid.ClientSettings.ActiveRowIndex = "true";
            grid.ClientSettings.AllowColumnHide = false;


            grid.ClientSettings.Resizing.AllowColumnResize = false;
            grid.ClientSettings.Resizing.ClipCellContentOnResize = true;
            grid.ClientSettings.Resizing.EnableRealTimeResize = true;


            grid.ClientSettings.Scrolling.AllowScroll = false;


            grid.ClientSettings.Scrolling.UseStaticHeaders = true;


            grid.Culture = new CultureInfo(_culture);
            grid.ClientSettings.Selecting.AllowRowSelect = true;


            grid.MasterTableView.GetColumnSafe("RowIndicator").Display = false;
            grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
            
            grid.MasterTableView.Width = Unit.Percentage(100);
            grid.MasterTableView.EnableHeaderContextMenu = false;
        }


       


        #endregion


        #region ListBox


        private void FillAvailableUsers()
        {
            
            RadListBoxItem item;
            rlbAvailableUser.Items.Clear();


            foreach (WSUser cUser in AvailableUsers)
            {
                string textItem;


                if (cUser.FullName.Length > 25)
                {
                    textItem = StringFunction.TruncateString(cUser.FullName, 25);
                }
                else
                {
                    textItem = cUser.FullName;
                }
                item = new RadListBoxItem
                {
                    Text = textItem,
                    Value = cUser.Id.ToString(),
                    ToolTip = cUser.FullName
                };


                rlbAvailableUser.Items.Add(item);
            }
        }


        #endregion


        #endregion


       
    }
}




I tried Remove RadAjaxPanel, and Add

AjaxManager.AjaxSettings.AddAjaxSetting(btnAddUser, rlbAvailableUsers); --> BUT ListBox disappear show a gray  
 line.
And then I added 

AjaxManager.AjaxSettings.AddAjaxSetting(btnToleft, rlbAvailableUsers); -->ListBox disappear show a  gray  
line.
 

AjaxManager.AjaxSettings.AddAjaxSetting(btnAllToleft, rlbAvailableUsers);  -->ListBox disappear show a gray line. 





I need help!!! Please!!!
regards
           


Nencho
Telerik team
 answered on 15 Oct 2012
6 answers
140 views
hi i have usercontrol(cascading dropdown) in radgrid edit template
if i use
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">

 <AjaxSettings>

 <telerik:AjaxSetting AjaxControlID="RadGrid1">

 <UpdatedControls>

 <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />

 </UpdatedControls>

 </telerik:AjaxSetting>

 </AjaxSettings>

 </telerik:RadAjaxManagerProxy>
works fine, but does not work RadAjaxLoadingPanel1
if i use

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 <AjaxSettings>

 <telerik:AjaxSetting AjaxControlID="RadGrid1">

 <UpdatedControls>

 <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />

 </UpdatedControls>

 </telerik:AjaxSetting>

 </AjaxSettings>

 </telerik:RadAjaxManager>
does not work and gives me a javascript error.
is there a solution? thanks

 

 

 

 

 

Eyup
Telerik team
 answered on 15 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?