Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
208 views
Hi,

I have implemented stylesheetManager for my application.
I am trying to set different theme on postback i.e. by adding css files dynamically.

here is sample code:

private void AddStyleSheets(RadStyleSheetManager styleSheetManager)
        {
            styleSheetManager.StyleSheets.Clear();
  
            if (SessionManager.CurrentSessionManager.PageTheme.ToLower().Equals("tone"))
            {
                styleSheetManager.StyleSheets.Add(new Telerik.Web.UI.StyleSheetReference("SNet.RTO.Skins.TOne.ComboBox.css", "SNet.RTO.Skins.TOne"));
            }
            else
            {
                styleSheetManager.StyleSheets.Add(new Telerik.Web.UI.StyleSheetReference("CustomSkins.ComboBox.css", "CustomSkins"));
            }
  
            styleSheetManager.ApplyStyleSheetSkin(Page);
        }

I am calling above method on Page's Init event.

Style is set on first time load only and never works after postback. I have read following post but of no use.
http://www.telerik.com/community/forums/aspnet-ajax/scriptmanager-and-stylesheetmanager/stylesheetmanager-does-not-update-head-section-after-ajax-postback.aspx

Any help? Thanks in anticipation.
Simon
Telerik team
 answered on 09 Feb 2012
7 answers
175 views
I have a couple of RadListBox controls on a page configured to use the Listbox\ Transfer functionality as outlined in this Demo.

I have bound an "onkeypress" event to both listboxes in the code behind. Thus

lstFirstListBox.Attributes.Add("onkeypress", "filterListBox('" + lstFirstListBox.ClientID + "', event);");
lstSecondListBox.Attributes.Add("onkeypress", "filterListBox('" + lstSecondListBox.ClientID + "', event);");

similar to this Forum Thread and the attached example.

The problem I have encountered is that the 'onkeypress" event does not fire in Firefox. It fires in IE without any problems.

However, it will fire in Firefox after I transfer an item from one listbox to the other. In this case it does not metter which listbox has focus the event is fired on 'FirstListBox" every time. That is, I transfer an item from First to Second and then perform a key press, it fires on First. I tranfer an item from Second to First and then perform a keypress, it fires on First.

For testing I have limited the "filterListBox" function to pop up an alert with the first parameter which, apart from in IE, is always the FirstListBox clientID.

I also tried binding the event using jQuery and got the exact same behaviour.

The event does seem to fire at all in Chrome or Safari no matter what combination of clicks or trickery I attempt.

Any ideas would be greatly appreciated.
Bozhidar
Telerik team
 answered on 09 Feb 2012
1 answer
92 views
Hi everyone.

Actually i run into a problem where i have 2 radlistbox, they are inside an updatepanel wich the update is conditional. The thing is that i dont want them to postback, so i just took the autopostback off.. it works great, its really fast, but if i got the page a postback it throws an index error. this error just occur if i left 0 itens at the first radlistbox, if exists one it didnt occur.

here goes the code. 
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <plk:Formulario ID="frmDistribuidor" runat="server" Titulo="Distribuidores" Visible="false">
                <asp:Panel ID="pnlDistribuidorUnico" runat="server" Visible="false">
                    <div>
                        <asp:Label ID="label4" runat="server" Text="Distribuidor"></asp:Label>
                        <span style="padding-left: 73px;">
                            <asp:DropDownList ID="ddlDistribuidor" Width="280px" runat="server">
                            </asp:DropDownList>
                        </span>
                    </div>
                </asp:Panel>
                <asp:Panel ID="pnlDistribuidorLooping" runat="server" Visible="false">
                    <div style="float: left; padding-left: 20px;">
                        <div class="esq larg300">
                            <div style="background-color: #3C49A5; width: 300px; height: 20px;">
                                <div style="padding-top: 4px; text-align: center; color: White; height: 20px;">
                                    Distribuidores de Preferência
                                </div>
                            </div>
                            <telerik:RadListBox ID="RadListBox1" runat="server" Width="300px" Height="150px"
                                SelectionMode="Multiple" AllowTransfer="True" TransferToID="RadListBox2"
                                AllowReorder="True" EnableDragAndDrop="True" PersistClientChanges="true" OnClientTransferred="onClientTransferredHandler" AutoPostBackOnReorder="true" CssClass="RadListBox">
                                <ButtonSettings ShowTransferAll="false" ShowTransfer="false" VerticalAlign="Middle"
                                    ShowReorder="false" AreaWidth="50px" />
                            </telerik:RadListBox>
                        </div>
                        <div class="esq alt150" style="text-align: center; padding-left: 10px">
                            <br />
                            <br />
                            <br />
                            <asp:ImageButton ID="btnParaDireita" ImageUrl="~/Imagens/btn-Rigth.png" runat="server"
                                ToolTip="Adicionar" OnClientClick="return transferRight()" />
                            <br />
                            <asp:ImageButton ID="btnParaEsquerda" ImageUrl="~/Imagens/btn-Left.png" runat="server"
                                ToolTip="Remover" OnClientClick="return transferLeft()" />
                            <br />
                            <br />
                            <img id="btnAjudaListBox" runat="server" alt="Ajuda" src="../../Imagens/btn-ajudar.png" />
                            <telerik:RadToolTip ID="RadToolTip1" runat="server" AnimationDuration="0" AutoCloseDelay="0"
                                Position="MiddleRight" RelativeTo="Element" ShowCallout="False" ShowDelay="0"
                                ShowEvent="OnClick" Skin="Hay" TargetControlID="btnAjudaListBox" Text="Para inclusão de um distribuidor no processo de looping, selecione-o na <br /> lista de Distribuidores de Preferência e arraste para a lista de Distribuidores <br /> Selecionados, ou pressione o botão adicionar.">
                            </telerik:RadToolTip>
                        </div>
                        <div class="esq larg300" style="padding-left: 10px">
                            <div style="background-color: #3C49A5; width: 300px; height: 20px;">
                                <div style="padding-top: 4px; text-align: center; color: White; height: 20px;">
                                    Distribuidores Selecionados
                                </div>
                            </div>
                            <telerik:RadListBox ID="RadListBox2" runat="server" Width="300px" Height="150px"
                                SelectionMode="Multiple" AllowReorder="true"
                                EnableDragAndDrop="true" PersistClientChanges="true" AutoPostBackOnReorder="true" CssClass="RadListBox">
                                <ButtonSettings ShowTransferAll="false" ShowReorder="false" VerticalAlign="Middle"
                                    AreaWidth="50px" />
                            </telerik:RadListBox>
                        </div>
                        <div class="esq alt150" style="text-align: center; padding-left: 10px;">
                            <div class="marginTop47">
                                <asp:ImageButton ID="btnParaCima" ImageUrl="~/Imagens/btn-Up.png" runat="server"
                                    OnClientClick="return reorderUp()" ToolTip="Mover para Cima" />
                            </div>
                            <div>
                                <asp:ImageButton ID="btnParaBaixo" ImageUrl="~/Imagens/btn-Down.png" runat="server"
                                    OnClientClick="return reorderDown()" ToolTip="Mover para Baixo" />
                            </div>
                        </div>
                    </div>
                </asp:Panel>
                <div style="clear: both;">
                </div>
                <asp:Panel ID="pnlDistribuidorVisualizacao" runat="server" Visible="false">
                    <div class="esq larg300" style="padding-left: 200px">
                        <div style="background-color: #3C49A5; width: 300px; height: 20px;">
                            <div style="padding-top: 4px; text-align: center; color: White; height: 20px;">
                                Distribuidores Selecionados
                            </div>
                        </div>
                        <telerik:RadListBox ID="RadListBoxVisualizacao" runat="server" Width="300px" SelectionMode="Single"
                            AllowReorder="false" AutoPostBackOnReorder="true" EnableDragAndDrop="false" CssClass="RadListBox">
                            <ButtonSettings ShowTransferAll="false" ShowReorder="false" ShowDelete="false" ShowTransfer="false"
                                VerticalAlign="Middle" AreaWidth="50px" />
                        </telerik:RadListBox>
                    </div>
                </asp:Panel>
                <div style="clear: both;">
                </div>
                <br />
                <div>
                    <div align="center">
                        <asp:Label ID="label3" runat="server" Text="Forma de Pagamento" Font-Underline="true"
                            Font-Bold="true"></asp:Label>
                    </div>
                    <div align="center" class="alinhaDivPrazoPagamento">
                        <asp:RadioButtonList ID="rblPrazo" runat="server" CssClass="Formulario" Height="12px"
                            RepeatDirection="Horizontal" Width="184px" BorderStyle="None" CausesValidation="True"
                            Visible="true">
                            <asp:ListItem Value="1">À vista</asp:ListItem>
                            <asp:ListItem Value="2">A prazo</asp:ListItem>
                        </asp:RadioButtonList>
                    </div>
                </div>
            </plk:Formulario>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnVisualizar" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnCorrigir" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>

and here its the javascript for the buttons, well, the buttons to the left and right has the same problem, so i took out the return false, making a postback doing the work correctly... well.. unfortunely it blinks the page.... but its fast...

function transferRight() {
                var listBox = $find("<%= RadListBox1.ClientID %>");
 
                var selectedItem = listBox.get_selectedItems();
                if (selectedItem == null) {
                    alert("É necessário selecionar um item primeiro.");
                    return false;
                }
 
                listBox.transferToDestination(selectedItem);
            }
 
            function transferLeft() {
                var listBox = $find("<%= RadListBox1.ClientID %>");
                var listBox2 = listBox.get_transferTo();
                var selectedItem = listBox2.get_selectedItems();
                if (selectedItem == null) {
                    alert("É necessário selecionar um item primeiro.");
                    return false;
                }
 
                listBox.transferFromDestination(selectedItem);
            }


hope u guys help me....  thx in advance ^^
Bozhidar
Telerik team
 answered on 09 Feb 2012
1 answer
49 views

Hello everybody,

I am using a radwindow  that will be opened from my radGrid through some JavaScript code,

<script type="text/javascript">

            function ShowEditForm(id, rowIndex) {

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

 

                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();

                grid.get_masterTableView().selectItem(rowControl, true);

 

                window.radopen("EditFormCS.aspx?PanelId=" + id, "UserListDialog");

                return false;

            }

            function ShowInsertForm() {

                window.radopen("EditFormCS.aspx", "UserListDialog");

                return false;

            }

            function refreshGrid(arg) {

                if (!arg) {

                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");

                }

                else {

                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");

                }

            }

            function RowDblClick(sender, eventArgs) {

                window.radopen("EditFormCS.aspx?PanelId=" + eventArgs.getDataKeyValue("PanelId"), "UserListDialog");

            }

        </script>

 

After a while it enconcuter an error when I am trying to open the radwindow, and it seems that it never free the resources(memory)  after I close

the radwindow.I have read so many posts and none  of them come to solve the problem.

For   instance I used Garbage collector to free the resource but it dosnt work.I restart

 The Server(Immagin how terrible is  it when so many Users are connected )and it is ok until it take whole the memory again.

The structur is :

Myfolder :

                myPage(RaddGrid is in this page and radwindow will be opened  through a link insid the Grid)

                EditForm(content of radwinow)

 

And in EditForm after user Submit  it will close the radwindow

<script type="text/javascript">

            function CloseAndRebind(args) {

                GetRadWindow().BrowserWindow.refreshGrid(args);

                GetRadWindow().close();

            }

 

            function GetRadWindow() {

                var oWindow = null;

                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog

                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)

 

                return oWindow;

            }

 

            function CancelEdit() {

                GetRadWindow().close();

            }

            function onError(input, args) {

                var message = "Invalid character: ";

 

                message += "accepts only numberic values.";

                document.getElementById("numInput").innerHTML = args.get_inputText();

                document.getElementById("numErrorOut").innerHTML = message;

            }

            function onKeyPress(input, args) {

 

                document.getElementById("numInput").innerHTML = "";

                document.getElementById("numErrorOut").innerHTML = "";

 

            }

            function Close() {

                GetRadWindow().Close();

            }

        </script>

And my GC is in the submit event :

  GC.Collect();

        GC.WaitForPendingFinalizers();

        GC.Collect();

 

Marin Bratanov
Telerik team
 answered on 09 Feb 2012
1 answer
124 views
Hi,

I want to create a Grid like this, but without fix encoded SQL Statements.

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

Is it possible to make it with a objectDataSource? Finally I want to give after a SelectMethod, UpdateMethod, and DeleteMethod.
This methods are then in my code behind. Is there a sample exactly for this question?

Regards and Thanks

Princy
Top achievements
Rank 2
 answered on 09 Feb 2012
2 answers
458 views
i am using radwindow in user control which should open on click of button, if i use opernerElementID it does not open, if i use javascript
it does not show the controls which are to be inside rad window here is code

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GridColumnSelector.ascx.cs" Inherits="GCSTestApplication.Controls.GridColumnSelector" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<script type="text/javascript">
    function showWin() {
 
        var rwManager = $find("<%= rWindow.ClientID %>");
        rwManager.show();
        return false;
    }
</script>
<telerik:RadButton ID="btnShowMenu" OnClientClicked="showWin" AutoPostBack="false" runat="server" Text="Show ">
</telerik:RadButton>
 
<telerik:RadWindowManager Behaviors="Close"  ID="rwm" runat="server">
<Windows>
<telerik:RadWindow ID="rWindow" ClientIDMode="Static" Title="Save layout" runat="server" Modal="true" Height="200" Width="400">
    <ContentTemplate>
        <asp:Label ID="Label1" runat="server" Text="Show some text" />
    </ContentTemplate>
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
please help me
Toad
Top achievements
Rank 1
 answered on 09 Feb 2012
1 answer
31 views
Hello.

I am use Sheduler control and i have a problem.

In then calendar in the monthview i can see event but i cant see all name of one event.

I need display all name in of event in the Sheduler monthview without use tolltip.
Thnaks

 
Plamen
Telerik team
 answered on 09 Feb 2012
3 answers
125 views
Is there a smart way to expand the parent of an inserted item and to select the inserted item.
In the demos items are added to a collapsed parent. It would be a better user experience.
Tsvetina
Telerik team
 answered on 09 Feb 2012
10 answers
713 views
Hello,

I'm building up a grid by dynamically adding Template Columns. The reason I'm using "GridTemplateColumn" is due to the structure of the datasource. The bound object must be used to determine the cell value during data binding. I set the Template Column to a implementation of ITemplate, this class contains the databinding event which determines the cell value.

An example would be the "MyTemplate" class in this example:
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html 

Since I'm setting up all my columns this way, I'm wondering if I will have issues with filtering. I tried setting the "GridTempalteColumn" data type to "DateTime", hoping to get the calendar picker, but it only filtered the filter options. Is it possible to setup my template column with "DateTime" filtering which contains the calendar picker?

I also have a scenario where we would like to have a multi-select dropdown as a filter control. Do you know if this is possible? I've seen examples that use a regular dropdown list, but I haven't noticed anything that allows multiple selections.

Thanks!
Marin
Telerik team
 answered on 09 Feb 2012
2 answers
95 views
Hello, I'm trying to create grid columns types of which I don't know at runtime.
For that I'm using (GridElement) class with Dictionary property:
public class GridElement
    {
        Dictionary<string, object> properties = new Dictionary<string, object>();
 
        public object this[string name]
        {
            get
            {
                if (properties.ContainsKey(name))
                    return properties[name];
 
                return null;
            }
            set
            {
                properties[name] = value;
            }
        }
 
        public Dictionary<string, object> Properties
        {
            get { return properties; }
            set { properties = value; }
        }
    }

I'd like to do something like that..
List<GridElement> elementList= new List<GridElement>();
 
//Adding some data to elementList
 
//trying to generate columns
  foreach (var element in elementList[0].Properties)
            {
                GridBoundColumn column = new GridBoundColumn();
                this.TestRadGrid.MasterTableView.Columns.Add(column);
                column.HeaderText = element.Key.ToString();
                column.DataField = ???
            }
 
  this.TestRadGrid.MasterTableView.DataSource = elementList;
Any suggestions how can i make this work?
Radoslav
Telerik team
 answered on 09 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?