Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
54 views
Hi,

I want to hide 2 command buttons when the user is in edit mode.  I've tried doing it in PreRender, ItemCreated without success.  Would you please help~

Thanks,

Helen

This is my CommandItemTemplate

<CommandItemTemplate>
  <div style="padding: 5px 5px;">
    <table>
    <tr>
        <td width="8%" >
            <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert"
                Visible='<%# !gdvBuilding.MasterTableView.IsItemInserted %>'>
                <img style="border:0px;vertical-align:middle;" alt="" src="../../images/add.png" />Add new
            </asp:LinkButton
        </td>                                   
        <td width="20%" align="left" >
            <asp:LinkButton ID="LinkButton1" OnClick="LinkButton1_Click" Visible="false"
                runat="server" CommandName="UpdateSelected">
                <img style="border:0px;vertical-align:middle;" alt="" src="../../images/disk_save.png" />Synchorize Info to SOS
            </asp:LinkButton
        </td>
        <td width="72%"></td>
        <td width="10%">                        
            <asp:LinkButton ID="btnRefresh" Text="Refresh" OnClick="btnRefresh_Click" runat="server" >
                <img style="border:0px;vertical-align:middle;" alt="" src="../../images/table_refresh.png" />Refresh
            </asp:LinkButton>
        </td>
    </tr>
    </table>
</div>
</CommandItemTemplate>


Helen
Top achievements
Rank 1
 answered on 27 Feb 2014
3 answers
515 views
I've just upgraded to the latest Telerik Ajax controls.

In several of my screens, I use an OnClientClicked event to disable the RadButton after one click to prevent multiple posts.

Now it seems to be failing.  The button is disabled but the postback never occurs.  (If I remove the OnClientClicked, the postback works.)

It is my understanding that this approach is now obsolete.  (I am aware of the 'SingleClick' option and I intend to try it.)

However I have another screen that is using the identical approach and it is still working.  So far I have not been able to find any significant difference.  I'd like to know what's happening here.

Danail Vasilev
Telerik team
 answered on 27 Feb 2014
3 answers
122 views
I have a Rad Grid with Buttons in the GridTemplateColumn that update a Crystal Reports Viewer on the page.

I also have a few other buttons on the page that update the database then refresh the grid.

When I add the other buttons to the Ajax Manager to update the grid the template column buttons no longer refresh the Crystal View.

If I add the panel where the viewer resides to the manager the Viewer disappears when I click the buttons in the Template column.
Maria Ilieva
Telerik team
 answered on 27 Feb 2014
1 answer
60 views
Hi,

PFA.

It is possible to perform filtring sorting and grouping on the column which has drop downlist inside it..

Please check and let me know if possible to do it.

Reply asap.


thanks.
Boyan Dimitrov
Telerik team
 answered on 27 Feb 2014
3 answers
199 views

Hi,

I work on a large, enterprise application built with many user controls.  The user controls have NO ASCX, they are completely defined at runtime in CS files.  Additionally, when developing user controls for the application and implementing new functionality, I don't have control over the framework or hierarchy of the parent controls which will consume my user controls.  They might be nested 5 layers deep, user control on top of user control.

I've seen many posts about the perils of using RadAjaxManager with UpdatePanels, but I don't have a choice in the matter and I haven't encountered the same issues others have reported.  So I apologize if this is redundant but I've not seen anything about my scenario or the strange behavior I'm seeing.

Basically, if a parent up the control hierarchy employs an UpdatePanel, when the AsyncUpload control posts pack (using RadAjaxManager), the ajax response is improperly formatted and the ajax path to the RadAjaxManager target control(s) actually appears in the html markup and that containers child controls are rendered twice.  The html render is completely broken as you can see in the mock up I have included.  I think this may be a bug in RadAjaxManager.  

I'm including code for 3 files - 3 layers of hierarchy, which demonstrates the issue.

fileUpload.aspx
ParentControl.cs (created by fileUpload)
UploadControl.cs (created by ParentControl) <-- this is the only one I have control over.

Notes:
Keep in mind that if we equate this to my situation, UploadControl is the only one I can change, I don't have access to ParentControl or fileUpload.
In the demo app, the issue only happens if the UpdateMode of the panel in ParentControl.cs is set to Always.  This has something to do with the fact that everything in UloadControl sits on a generic Panel.  If I remove the Panel and just drop the objects in UploadControl directly in the Controls collection, then the ajax render will be messed up regardless of the UpdateMode setting in the ParentControl.  Changing the UpdateMode in the ParentControl is not an option, there are often good reasons why it's set to Always - other children of the parent may rely on that setting.

As always, thanks in advance,
JD

fileUpload.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="fileUpload.aspx.cs" Inherits="TelerikApp.fileUpload" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     
    </div>
    </form>
</body>
</html>

fileUpload.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using TelerikApp.Controls;
 
namespace TelerikApp
{
    public partial class fileUpload : System.Web.UI.Page
    {
        protected WebControl _DivPageContent = new WebControl(HtmlTextWriterTag.Div);
 
 
        protected void Page_Init(object sender, EventArgs e)
        {
 
            this._DivPageContent.Controls.Add((Control)(new ParentControl()));
            _DivPageContent.ID = "_DivPageContent";
            this.form1.Controls.Add(_DivPageContent);
 
            RadAjaxManager manager = new RadAjaxManager();
            manager.ID = "RadAjaxManager1";                
            this.form1.Controls.Add(manager);              
        }
    }
}


ParentControl.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace TelerikApp.Controls
{
    public class ParentControl : WebControl
    {
        private RadButton _someButton = new RadButton();
        UpdatePanel _update = new UpdatePanel();
        UploadControl _upLoad = null;
 
        protected override void OnInit(EventArgs e)
        {
            this._someButton.ID = "SomeButton";
            this._someButton.Text = "Click Me";
            this._someButton.AutoPostBack = true;
            this._someButton.Click += _someButton_Click;
 
            this._update.ID = "myUpdatePanel";
            this._update.UpdateMode = UpdatePanelUpdateMode.Always; //.Conditional Fixes issue in some cases
 
            this._upLoad = new UploadControl();
            this._upLoad.ID = "myUpLoadControl";
 
            this._update.ContentTemplateContainer.Controls.Add(this._upLoad);
 
            this._update.ContentTemplateContainer.Controls.Add(new LiteralControl("<br/><br/>More Controls on the UpdatePanel<br/>"));
            this._update.ContentTemplateContainer.Controls.Add(this._someButton);
            this.Controls.Add(_update);
 
            base.OnInit(e);
        }
 
        void _someButton_Click(object sender, EventArgs e)
        {
            //any silly functionality
            if (this._someButton.ToolTip == "") this._someButton.ToolTip = "0";
            int count = int.Parse(this._someButton.ToolTip) + 1;
            this._someButton.Text = "You've Clicked " + count.ToString() + " times";
            this._someButton.ToolTip = (count).ToString();
        }
    }
}


UploadControl.cs
using System;
using System.Threading;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace TelerikApp.Controls
{
    public class UploadControl : WebControl
    {
        private RadButton _btUpload = new RadButton();
        private RadAsyncUpload _fiInput = new RadAsyncUpload();
        private DropDownList _DdDocumentTypes = null;
        private Label _lbl = new Label();
        private RadAjaxManager _ajaxManager = new RadAjaxManager();
        private Panel _DocUploadControlPanel = new Panel();
        private RadAjaxLoadingPanel _ajaxLoadingPanel = null;
 
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
 
            ScriptManager scriptManager = new ScriptManager();
            scriptManager.ID = "scriptManager";
            this.Page.Form.Controls.Add(scriptManager);
 
            this._lbl.ID = "_lbl";
            this._lbl.Text = "";
 
            this._DocUploadControlPanel.ID = "_DocUploadControlPanel";
            this._DocUploadControlPanel.CssClass += " docUploadControlPanel";
            this._DocUploadControlPanel.Style.Add("display", "inline-block");
            this._DocUploadControlPanel.BackColor = System.Drawing.Color.LightBlue;
 
            this._DdDocumentTypes = new DropDownList();
            this._DdDocumentTypes.ID = "DDLDocumentTypes";
            this._DdDocumentTypes.EnableViewState = false;
            this._DdDocumentTypes.AutoPostBack = false;
            this._DdDocumentTypes.Items.Add(new ListItem("type1"));
            this._DdDocumentTypes.Items.Add(new ListItem("type2"));
 
            this._ajaxLoadingPanel = new RadAjaxLoadingPanel();
            this._ajaxLoadingPanel.ID = "_ajaxLoadingPanel";
            this._ajaxLoadingPanel.Transparency = 50;
            this._ajaxLoadingPanel.BackColor = System.Drawing.Color.DarkGray;
            this._ajaxLoadingPanel.Skin = "Default";
 
            this._fiInput.ID = "FileInput";
            this._fiInput.MultipleFileSelection = Telerik.Web.UI.AsyncUpload.MultipleFileSelection.Disabled;
            this._fiInput.FileUploaded += FileUploaded;
 
            this._btUpload.ID = "UploadButton";
            this._btUpload.CausesValidation = false;
            this._btUpload.Text = "Upload";
 
            DataBind();
 
            this._DocUploadControlPanel.Controls.Add(this._ajaxLoadingPanel);
            this._DocUploadControlPanel.Controls.Add(this._DdDocumentTypes);
            this._DocUploadControlPanel.Controls.Add(this._fiInput);
            this._DocUploadControlPanel.Controls.Add(this._btUpload);
            this._DocUploadControlPanel.Controls.Add(new LiteralControl("<br/>"));
            this._DocUploadControlPanel.Controls.Add(this._lbl);
            this.Controls.Add(_DocUploadControlPanel);
 
        }
 
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            _ajaxManager = RadAjaxManager.GetCurrent(Page);
            _ajaxManager.AjaxSettings.AddAjaxSetting(this._btUpload, this._DocUploadControlPanel, this._ajaxLoadingPanel);
            //_ajaxManager.AjaxSettings.AddAjaxSetting(_btUpload, _lbl);
 
        }
 
        private void FileUploaded(object sender, FileUploadedEventArgs e)
        {
            Thread.Sleep(2000);
            _lbl.Text = "UPLOADED " + e.File.FileName + " TYPE: " + this._DdDocumentTypes.SelectedValue;
            _lbl.BackColor = System.Drawing.Color.LightGreen;
        }
 
    }
 
}


 

Maria Ilieva
Telerik team
 answered on 27 Feb 2014
1 answer
162 views
Hello Team,

I am using telerik treeview with silk skin, but now my requirement is that i want to customize my treeview skin. i tried a lot on this but it dn't work. there are various problem which i facing and also mention my requirement:
1: how can i hide the defaults dotted images.
2: how can i remove the border width of node.
3. Make Parents node in different colour.
4. Change Colour on mouse over .


I have attached the screen shot of demo which i want in my project and also attached the css of customize skin of treeview.
Please help me out how can i solve my problem. 
Magdalena
Telerik team
 answered on 27 Feb 2014
5 answers
2.4K+ views
Hello,

Just out of curiosity, what are the RadCodeBlock and RadScriptBlock controls used for?  What is their purpose?  What advantages does the RadScriptBlock give you over defining your own <script></script> tags without it?

Thanks.
Maria Ilieva
Telerik team
 answered on 27 Feb 2014
0 answers
68 views
Header Context Menu for Column max count
Մուշեղ
Top achievements
Rank 1
 asked on 27 Feb 2014
4 answers
278 views
Let's say I have a grid containing a set of Schools, and each of the schools has a detail table containing a list of courses. I'm looking for a way to filter the schools and courses by course title through the use of a FilterExpression. As of now, I am iterating through each school item and and setting the FilterExpression of the NestedTableView. Not only is this method cumbersome, but it only filters the courses, not the schools, so any schools without courses after filtering display "No child records to display." 
Angel Petrov
Telerik team
 answered on 27 Feb 2014
3 answers
134 views
The standard RadEditor lacks a dialog to insert/edit DIV elements, so I built my own custom dialog to be able to do that.

Inserting the DV element works fine. However, editing an existing DIV does not. Instead of replacing the existing DIV element, a new DIV is created within the existing DIV.

Telerik.Web.UI.Editor.CommandList["InsertDIV"] = function (commandName, editor, args) {
            var argument = null, elem = editor.getSelectedElement(); //returns the selected element.  
 
            if (elem && elem.tagName && elem.tagName == "DIV") {
                editor.selectElement(elem);
                argument = elem;
            }
            else {
                var l_sContent = editor.getSelectionHtml();
                if (l_sContent == '') { l_sContent = 'Inhoud DIV...'; }
 
                var l_oDiv = editor.get_document().createElement("DIV");
                l_oDiv.innerHTML = l_sContent;
                argument = l_oDiv;
            }
 
            var callbackInsertDIV = function (sender, args) {
                if (args != null) {
                    var l_sStyle = "", l_sClass, l_sID, l_sContent = "Inhoud DIV...";
 
                    if (args.width && args.width != '') { l_sStyle += 'width:' + args.width + ';' }
                    if (args.height && args.height != '') { l_sStyle += 'height:' + args.height + ';' }
                    if (args.padding && args.padding != '') { l_sStyle += 'padding:' + args.padding + ';' }
                    if (args.margin && args.margin != '') { l_sStyle += 'margin:' + args.margin + ';' }
                    if (l_sStyle.length > 0) { l_sStyle = " style='" + l_sStyle + "'" }
 
                    if (args.class && args.class != '') { l_sClass = " class='" + args.class + "'" }
                    if (args.id && args.id != '') { l_sID = " id='" + args.id + "'" }
                    if (args.content && args.content != '') { l_sContent = args.content }
 
                    var l_sHtml = String.format("<div{0}{1}{2}>" + l_sContent + "</div>", l_sStyle, l_sClass, l_sID);
                    editor.pasteHtml(l_sHtml);
                }
            }
 
            editor.showExternalDialog(
            'RadEditor/dlgInsertDIV.aspx',
            argument,
            600,
            250,
            callbackInsertDIV,
            null,
            'DIV element invoegen/wijzigen',
            true,
            Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize,
            false,
            true);
        };

In editing an existing DIV, how can I replace/update the existing DIV instead of inserting an extra one?

Best regards, Marja
Ianko
Telerik team
 answered on 27 Feb 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?