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

How to always have one button toggled in a toggle buttons groupof RadToolBar??

Kate
Telerik team
 answered on 04 Jul 2012
1 answer
114 views
I am trying to use a RadRotator control inside an aspnet UpdatePanel.  The RadRotator displays a set of images whenever the user clicks a button.  It works as expected in IE 9, but when I view the page in Firefox (version 13.0.1), the RadRotator width is set to 0 on the first postback.  It will display on subsequent postbacks -- just not the initial one.    

The develomplent is in VS 2010, and the version of the Telerik library is 2011.3.1115.40.

Here is a simplified example of the ASPX file and CodeBehind that is causing the issue:

ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ImageRotatorTest.WebForm1" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:UpdatePanel runat="server" ID="up1">
      <ContentTemplate>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
             <telerik:RadRotator ID="itemsRotator" runat="server"  Width="600px" Height="118px"
                        ItemHeight="108" ItemWidth="81" WrapFrames="false" RotatorType="Buttons" ScrollDuration="1" FrameDuration="1"
                        Visible="False" >
                        <ItemTemplate>
                            <asp:Image runat="server" Height="108" Width="81" BorderStyle="Solid" BorderColor="DarkGray" BorderWidth="1" ID="JobImage" ImageUrl='<%# Eval("ImagePath") %>' />
                        </ItemTemplate>
             </telerik:RadRotator>
    </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>


CodeBehind:
namespace ImageRotatorTest
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        class RotatorImage
        {
            public RotatorImage(string imagePath)
            {
                ImagePath = imagePath;
            }
            public string ImagePath { get; set; }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DisplayRotator();
        }

        private void DisplayRotator()
        {
            List<RotatorImage> imageList = new List<RotatorImage>();
            imageList.Add(new RotatorImage("Images/Squirrel.jpg"));
            imageList.Add(new RotatorImage("Images/Squirrel.jpg"));
            imageList.Add(new RotatorImage("Images/Squirrel.jpg"));
            itemsRotator.Visible = true;
            itemsRotator.DataSource = imageList;
            itemsRotator.DataBind();
        }
    }
}

The problem seems to be stemming from the fact that the RadRotator visibility is initially set to false, because when it is initially set to true the problem disappears.  Unfortunately, I need to initially hide the RadRotator until the user clicks a button.   Also, eliminating the UpdatePanel is not an option because we have other code that depends on it.  Please help.


Thanks,
Scott Howard
Slav
Telerik team
 answered on 04 Jul 2012
1 answer
128 views
Hi,

I need to implement drag and drop on a treeview in such a way that it should allow drag and drop only between same level of nodes.

Thanks,
Stephen Lewis
Princy
Top achievements
Rank 2
 answered on 04 Jul 2012
5 answers
187 views
Please help me for changing my Slider Items With?

Kindly Regards

   .RadSlider5_Custom .rslItem, .RadSlider5_Custom .rslLargeTick span
             {
                 width: 25px;
                 }

did not work (
omer
Top achievements
Rank 1
 answered on 04 Jul 2012
4 answers
114 views
Hi,

I'm trying to create dynamic dock controls with customs command in their title bar. I've read everywhere that those dock must be re-created in the OnInit event which I think I'm doing.
Here's my code:
1 - I'm adding a dock to the DockLayout by clicking on a radbutton (RadButtonCreate_Click) and load a control within that dock via Loadcontrol.
Everything looks fine at that stage.

2 - When I click on my custom command "SaveToDB", it does work the way I like and insert all the data to the DB and update the title of my dock via a Dock Title Template implementing ITemplate.

3 - When I click again on that command "SaveToDB", nothing happens. The OnClientCommand is fired but the server side handler is no longer called.

What am I doing wrong here ? 

private List<DockState> CurrentDockStates
{
    get
    {
        //Store the info about the added docks in the session. For real life
        // applications we recommend using database or other storage medium
        // for persisting this information.
        List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStatesDynamicDocks"];
        if (Object.Equals(_currentDockStates, null))
        {
            _currentDockStates = new List<DockState>();
            Session["CurrentDockStatesDynamicDocks"] = _currentDockStates;
        }
        return _currentDockStates;
    }
    set
    {
        Session["CurrentDockStatesDynamicDocks"] = value;
    }
}
 
private RadDock CreateRadDockFromState(DockState state)
{
    RadDock dock = new RadDock();
    try
    {
        dock.ID = string.Format("RadDock{0}", state.UniqueName);
 
        dock.ApplyState(state);
        dock.EnableRoundedCorners = true;
 
        dock.Command += new DockCommandEventHandler(dock_Command);
        dock.Commands.Add(new DockCloseCommand());
        dock.Commands.Add(new DockExpandCollapseCommand());
 
        var dockSaveCmd = new DockCommand();
        dockSaveCmd.Name = "SaveToDB";
        dockSaveCmd.Text = "Save";
        dockSaveCmd.CssClass = "sdSaveCmd";
        dockSaveCmd.OnClientCommand = "SaveStopToDB";
        dock.Commands.Add(dockSaveCmd);
    }
    catch (Exception ex)
    {
        return null;
        throw new Exception(ex.Message, ex.InnerException);
    }
    return dock;
}
 
protected void Page_Init(object sender, EventArgs e)
{
    //Recreate the docks in order to ensure their proper operation
    for (int i = 0; i < CurrentDockStates.Count; i++)
    {
        RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);
        RadDockLayout1.Controls.Add(dock);
        CreateSaveStateTrigger(dock);
    }
}
 
private void CreateSaveStateTrigger(RadDock dock)
{
    //Ensure that the RadDock control will initiate postback
    // when its position changes on the client or any of the commands is clicked.
    //Using the trigger we will "ajaxify" that postback.
    dock.AutoPostBack = true;
    dock.CommandsAutoPostBack = true;
 
    AsyncPostBackTrigger saveStateTrigger = new AsyncPostBackTrigger();
    saveStateTrigger.ControlID = dock.ID;
    saveStateTrigger.EventName = "DockPositionChanged";
    UpdatePanel1.Triggers.Add(saveStateTrigger);
 
    saveStateTrigger = new AsyncPostBackTrigger();
    saveStateTrigger.ControlID = dock.ID;
    saveStateTrigger.EventName = "Command";
    UpdatePanel1.Triggers.Add(saveStateTrigger);
}
 
void dock_Command(object sender, DockCommandEventArgs e)
{
    if (e.Command.Name == "Close")
    {
        ScriptManager.RegisterStartupScript(
        UpdatePanel1,
        this.GetType(),
        "RemoveDock",
        string.Format(@"function _removeDock() {{ 
                        Sys.Application.remove_load(_removeDock); 
                        $find('{0}').undock(); 
                        $get('{1}').appendChild($get('{0}')); 
                        $find('{0}').doPostBack('DockPositionChanged'); 
                        }}; 
                        Sys.Application.add_load(_removeDock);", ((RadDock)sender).ClientID, UpdatePanel1.ClientID),
                      true);
 
    }
    else if (e.Command.Name == "SaveToDB")
    {
        var dock = ((RadDock)sender);
        var stop = new Stop()
        {
            Id = int.Parse(dock.Tag),
            Name = ((RadTextBox)stopCtrl.FindControl("rtbName")).Text,
            Description = ((RadTextBox)stopCtrl.FindControl("TB_description")).Text,
        };
 
        if (stop.Id < 0)
        {
            stop.Id = stop.Insert();
            dock.Tag = stop.Id.ToString();
        }
        else
            stop.Update();
    }
}
 
protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)
{
    //Populate the event args with the state information. The RadDockLayout control
    // will automatically move the docks according that information.
    foreach (DockState state in CurrentDockStates)
    {
        e.Positions[state.UniqueName] = state.DockZoneID;
        e.Indices[state.UniqueName] = state.Index;
    }
}
 
protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)
{
    //Save the dock state in the page Session. This will enable us
    // to recreate the dock in the next Page_Init.
    CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();
}
 
protected void RadButtonCreate_Click(object sender, EventArgs e)
{
    var dock = new RadDock();
    dock.DockMode = DockMode.Docked;
    dock.EnableRoundedCorners = true;
    dock.UniqueName = Guid.NewGuid().ToString();
    dock.ID = string.Format("RadDock{0}", dock.UniqueName);
    dock.Tag = "-1";
    StopFormTplEmpty widget = (StopFormTplEmpty)GlobalUtils.LoadControl(this, "~/Templates/StopFormTplEmpty.ascx");
    widget.EnableViewState = true;
    dock.ContentContainer.Controls.Add(widget);
 
    dock.TitlebarTemplate = new DockTitleTemplate(dock, StopType.Unknown, "New");
    dock.Width = Unit.Percentage(100);
    dock.Height = Unit.Pixel(420);
    dock.Commands.Add(new DockCloseCommand());
    dock.Commands.Add(new DockExpandCollapseCommand());
    var dockSaveCmd = new DockCommand();
    dockSaveCmd.Name = "SaveToDB";
    dockSaveCmd.Text = "Save";
    dockSaveCmd.CssClass = "sdSaveCmd";
    dockSaveCmd.OnClientCommand = "SaveStopToDB";
    dock.Commands.Add(dockSaveCmd);
    dock.CommandsAutoPostBack = true;
    dock.Command += new DockCommandEventHandler(dock_Command);
    UpdatePanel1.ContentTemplateContainer.Controls.Add(dock);
 
    ScriptManager.RegisterStartupScript(
    dock,
    this.GetType(),
    "AddDock",
    string.Format(@"function _addDock() {{ 
                        Sys.Application.remove_load(_addDock); 
                        $find('{1}').dock($find('{0}'),{2});  
                        $find('{0}').doPostBack('DockPositionChanged'); 
                        }}; 
                        Sys.Application.add_load(_addDock);", dock.ClientID, RadDockZoneStops.ID, 0),
                                                            true);
    CreateSaveStateTrigger(dock);
}
Slav
Telerik team
 answered on 04 Jul 2012
1 answer
99 views
Hello Team,
I am facing problem in dynamic creation grid structure and bind data and not able to see nested grid data below is code for same. Please do help me asap.

Looking forward to your response.


RadGridData.AutoGenerateColumns = false;

            //generate grid columns/ grid structure
            GridBoundColumn ZoneColumn;
            GridTableView gridTableView = new GridTableView();
            for (int ColumnCount = 0; ColumnCount < ZoneData.Tables[0].Columns.Count; ColumnCount++)
            {
                ZoneColumn = new GridBoundColumn();
                RadGridData.MasterTableView.Columns.Add(ZoneColumn);
                ZoneColumn.DataField = Convert.ToString(ZoneData.Tables[0].Columns[ColumnCount]);
                ZoneColumn.HeaderText = Convert.ToString(ZoneData.Tables[0].Columns[ColumnCount]);
                ZoneColumn.UniqueName = Convert.ToString(ZoneData.Tables[0].Columns[ColumnCount]);
                ZoneColumn.SortExpression = Convert.ToString(ZoneData.Tables[0].Columns[ColumnCount]);

                gridTableView.AutoGenerateColumns = false;
                for (int innerColumnCount = 0; innerColumnCount < ZoneData.Tables[1].Columns.Count; innerColumnCount++)
                {
                    ZoneColumn = new GridBoundColumn();
                    gridTableView.Columns.Add(ZoneColumn);
                    ZoneColumn.DataField = Convert.ToString(ZoneData.Tables[1].Columns[innerColumnCount]);
                    ZoneColumn.HeaderText = Convert.ToString(ZoneData.Tables[1].Columns[innerColumnCount]);
                    ZoneColumn.UniqueName = Convert.ToString(ZoneData.Tables[1].Columns[innerColumnCount]);
                    ZoneColumn.SortExpression = Convert.ToString(ZoneData.Tables[1].Columns[innerColumnCount]);
                }
                RadGridData.MasterTableView.DetailTables.Add(gridTableView);
            }


            RadGridData.MasterTableView.AutoGenerateColumns = false;
            RadGridData.MasterTableView.DetailTables[0].AutoGenerateColumns = false;
            GridRelationFields relationFields = new GridRelationFields();
            relationFields.MasterKeyField = "ID";
            relationFields.DetailKeyField = "ID";
            gridTableView.ParentTableRelation.Add(relationFields);


            RadGridData.MasterTableView.DataSource = ZoneData.Tables["Zone"]; //ZoneData is dataset with table data
            RadGridData.MasterTableView.DetailTables[0].DataSource = ZoneData.Tables["ZoneContract"];



Thanks & Regards
Radoslav
Telerik team
 answered on 04 Jul 2012
5 answers
93 views
I have a grid with a GridHTMLEditorColumn containing, obviously, HTML. When I access the value of the cell client-side it appears as if the RadFormDecorator is attempting to decorate controls INSIDE the GridHTMLEditorColumn. For example, this is what it does to a button:
    <a class="rfdSkinnedButton" href="javascript:void(0)">
      <button id="Button3" class="rfdDecorated" tabIndex="-1">

I had the same problem using just a GridBoundColumn and a GridTemplateColumn containing a textarea.

How do I get the RadFormDecorator to leave my HTML data alone without disabling it completely (which might be difficult, since it is on the Master Page)?
Bozhidar
Telerik team
 answered on 04 Jul 2012
1 answer
219 views
Is there a way to modify the styling of the RadHTMLChart?  I have done this many times with the radGrid and other telerik controls.  For example,  I would like to change the font of the legend, add borders around the legend, or change spacing between series in the bar chart.  Is there a way to do that or is this under development and to be released at a later date?
Marin Bratanov
Telerik team
 answered on 04 Jul 2012
2 answers
135 views
We have started replacing the ASP.NET charts with RadHTML Charts.  How do we adjust the font size for the X and Y series.  I can't seem to find a property to do that.  Setting up the font size property at the chart level doesn't seem to impact anything.

Thanks.
Marin Bratanov
Telerik team
 answered on 04 Jul 2012
1 answer
114 views
How to loop through selected items in radgrid in external button click and retrieve their cell value?
Shinu
Top achievements
Rank 2
 answered on 04 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?