Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
65 views
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    <Scripts>
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
    </Scripts>
</telerik:RadScriptManager>
<script type="text/javascript">
    //Put your JavaScript code here.
</script>
<telerik:RadAjaxManager ID="radAjaxManager" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="radGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="radGrid2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<div>
 
 
    <telerik:RadGrid ID="radGrid1" runat="server"></telerik:RadGrid>
    <telerik:RadGrid ID="radGrid2" runat="server"></telerik:RadGrid>
 
    <telerik:RadCodeBlock runat="server">
    <%= radGrid1.Visible %>
 
    <%= radGrid2.Visible %>
    </telerik:RadCodeBlock>
</div>
</form>
</body>
</html>

 

Please fix.  This is really annoying because all controls in the RadGrid will then have a Visible property value of false, even if they are visible.

Eyup
Telerik team
 answered on 19 May 2016
1 answer
399 views

I have a RadSplitter which house 2 vertical RadPanes both with scroll bars.

The first pane has a RadTreeView inside a .Net User control and the second pane has an IFrame.

I need to set focus on a particular node in the RadtreeView when the page is loaded so I don't have to scroll endlessly to reach that node when the page is first loaded.

I tried using the following approach but it is not working :

function scrollToNode(){
        var selected = $(".rtSelected");
        if(selected.length > 0){
        var TotalScrollNeeded = selected.offset().top
            - $("#radTree").offset().top
            + $("#radTree").scrollTop();
        $("#radTree").animate({ scrollTop: TotalScrollNeeded }, 1000);
        }

Ivan Danchev
Telerik team
 answered on 19 May 2016
5 answers
146 views

I have a SearchBox with a 'none' display style declared in a holding div.

After a javascript event (example click on a button, without postback) I am dynamically creating a new div, and move the SearchBox to it.

I have to do this, because it seems that it is not possible to dynamically create a SearchBox from javascript.

I based the initial hide/show on the post of Brian Azzi.

Everything works fine, but the magnifying glass appears  in on the left of the SearchBox instead of the right side. I attached a screenshot of it.

And that is annoying.

Any solution for that?

I am posting a sample of the xml and javascript I am using.

<div id="telerikHolder">
    <telerik:RadSearchBox
        ID="RdSrchBx"
        runat="server"
        style="display: none;"
        EmptyMessage="Type"
        OnClientSearch="AddSimple"
        OnClientDataRequesting="AddSimple"
        ShowSearchButton="true">
        <DropDownSettings Height="400" Width="550" />
        <WebServiceSettings Path="Main.aspx" Method="GetTypeResults" />
    </telerik:RadSearchBox>
</div>

var el_0_1_1_1 = document.createElement('div');
pParent.appendChild(el_0_1_1_1);
el_0_1_1_1.className = 'popupCellRight';
 
this._typeSearchBoxInput = $("#RdSrchBx");
this._typeSearchBoxInput.show();
//ClearSearchBox(this._typeSearchBoxInput);
 
this._typeSearchBox = null;
var telerikHolder = document.getElementById('telerikHolder');
var childDivs = telerikHolder.getElementsByTagName('div');
for (i = 0; i < childDivs.length; i++) {
    var childDiv = childDivs[i];
    if (childDiv.id == "RdSrchBx") {
        this._typeSearchBox = childDiv;
        break;
    }
}
telerikHolder.removeChild(this._typeSearchBox);
 
el_0_1_1_1.appendChild(this._typeSearchBox);
// this._typeSearchBoxInput = this._typeSearchBoxInput.get_inputElement();

The other problem I have is that this._typeSearchBoxInput does not seem to be a proper Telerik control.

Because when I try to use get_inputElement() on it, I get an undefined exception.

 

 

Ivan Danchev
Telerik team
 answered on 19 May 2016
2 answers
73 views

Hi,

I am using the Maskedtextbox for user input of a mac address, I am using the following code which works fine.  It displays "00-00-00-00-00-00" on initial load and only accepts characters 0-9 and A-F

<telerik:RadMaskedTextBox RenderMode="Lightweight" ID="RadMaskedTextBox3" runat="server" <br>Mask="<0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F><0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F>-<0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F><br><0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F>-<0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F><0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F>-<br><0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F><0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F>-<0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F><br><0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F>-<0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F><0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F>"><br></telerik:RadMaskedTextBox>



The issue arises when I press the backspace to delete, all that happens is the cursor moves back but does not reset the character back to the initial mask value which is what I would expect to happen.

How can I achieve this.

Chris
Chris
Top achievements
Rank 1
 answered on 19 May 2016
4 answers
77 views

I just recently upgraded a project to the latest release (2016.1.113) and am experiencing a change in the appearance of panel headers. Prior to the update the header was highlighted with the reverse/selected when open. After the update only the last panel selected is highlighted. We are using the Metro touch skin (this is a mobile site) and the headers are now difficult to distinguish from the content. Please see the attached screen shot. How do I restore this to have the panel header always highlighted? here is my markup code:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="XPanelBarTest.aspx.vb" Inherits="mobile.autoclick.com.XPanelBarTest" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
       <style type="text/css">
            html .RadPanelBar_MetroTouch .rmRootToggle {
                height:25px;
                width:24px;
                }
 
            html .RadPanelBar_MetroTouch .rmRootToggle:before {
                font-size:18px;
                }
 
            html .RadPanelBar_MetroTouch .rpTemplate
                    {
                    line-height: 18px;
                    }
            html .RadPanelBar_BlackMetroTouch .rpTemplate
                    {
                    line-height: 18px;
                    }
    </style>
 
    <script type="text/javascript" src="/jquery/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="/js/plupload.full.min.js"></script>
    <script type="text/javascript" src="/js/jquery.plupload.queue/jquery.plupload.queue.js"></script>
 
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
         <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Width="99%" Skin="MetroTouch">
            <Items>
                <telerik:RadPanelItem Text="Photos">
                    <ContentTemplate>
                    <div style="overflow:hidden">
                        <div id="container" >
                            <telerik:RadButton ID="radbtnAddPhoto" runat="server" Text="Add New Photos" Width="99%" ></telerik:RadButton>
                             
                        </div>
                        <telerik:RadButton ID="radbtnVehicleNotSaved" runat="server" Text="Please save the vehicle before adding photos." Width="99%" Enabled="false"></telerik:RadButton>
                    </div>
                         
                    </ContentTemplate>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Description" >
                    <ContentTemplate>
                        <div style="overflow:hidden">
                        <fieldset>
                            <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server">
                                <table class="fieldsetTable" >
                                    <tr>
                                        <td style="padding-top:2px; padding-right:8px; padding-bottom:8px" colspan="2">
                                            <telerik:RadButton ID="radbtnScanner" runat="server" Text="Scan VIN" ButtonType="LinkButton" CssClass="fieldsetTable"  ></telerik:RadButton
                                            <telerik:RadButton ID="radbtnDecodeVin" runat="server" Text="Decode VIN" ></telerik:RadButton>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="lablecell_1">
                                            VIN:<span class="Reqd">*</span>
                                        </td>
                                        <td class="tablecell">
                                            <asp:TextBox runat="server" ID="txtVin" Width="200px" CssClass="tdText" MaxLength="21"></asp:TextBox>
                                            <telerik:RadWindow ID="radwinSelectTrimLevel" runat="server" Title="Select Trim Level" Width="290px" Behaviors="Move, Close, Resize" Skin="MetroTouch" Modal="true" CenterIfModal="true">
                                                <ContentTemplate>
                                                    <table style="margin:10px; width:96%">
                                                        <tr>
                                                            <td>
                                                                <label runat="server" id="lblPopupCommentsLabel" class="tdText">Please Select A Trim Level:</label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:RadioButtonList ID="rblistTrimLevels" runat="server" Width="90%" CssClass="rbtext" style="line-height:30px"></asp:RadioButtonList>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align:center">
                                                                <telerik:RadButton ID="rdbTrimLevelOK" runat="server" Text="OK" Width="90px"></telerik:RadButton>
                                                            </td>
                                                        </tr>
                                                    </table
 
                                                </ContentTemplate>
                                            </telerik:RadWindow>
                                        </td>
                                    </tr>
                                     
                                </table>
                            </telerik:RadAjaxPanel>
                             
                        </fieldset>
                         
                        </div>
                    </ContentTemplate>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Status">
                    <ContentTemplate>
                    <div style="overflow:hidden">
                            <table style="margin:5px">
                                <tr>
                                    <td style="width:100%">
                                        <table class="fieldsetTable">
                                            <tr>
                                                <td class="tablecell" colspan="2">
                                                    <asp:CheckBox runat="server" ID="cbShowOnLine" Text="Show On Line:" TextAlign="Left"  />
                                                </td>
                                            </tr>  
                                            <tr>
                                                <td style="width:44px">
                                                    New/Used:<span class="Reqd">*</span
                                                </td>
                                                <td class="tablecell">
                                                    <asp:DropDownList runat="server" ID="ddNewUsed" CssClass="dropdownText">
                                                        <asp:ListItem Text="-- New/Used --" Value="2"></asp:ListItem>
                                                        <asp:ListItem Text="New" Value="1"></asp:ListItem>
                                                        <asp:ListItem Text="Used" Value="0"></asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    Status:<span class="Reqd">*</span
                                                </td>
                                                <td class="tablecell">
                                                     
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    Condition:<span class="Reqd">*</span
                                                </td>
                                                <td class="tablecell">
                                                     
                                                </td>
                                            </tr>
                                        </table>
 
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align:right" colspan="2">
                                        <span class="fieldsetTable">* Required</span>
                                    </td>
                                </tr>
                            </table>
                    </div>
                    </ContentTemplate>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Price">
                    <ContentTemplate>
                    <div style="overflow:hidden">
                            <table class="fieldsetTable" style="margin:5px">
                                <tr>
                                    <td valign="top" style="width: 50%;">
                                        <table class="fieldsetTable" style="width:100%">
                                            <tr>
                                                <td class="tablecell">
                                                    List:<br />
                                                    <asp:TextBox runat="server" ID="txtListPrice" Width="100px" CssClass="tdText numberTextBox"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tablecell">
                                                    Markup (Pack):<br />
                                                    <asp:TextBox runat="server" ID="txtMarkup" Width="100px" CssClass="tdText numberTextBox"></asp:TextBox>
                                                </td>
                                            </tr>
                                                                 
                                        </table>
                                    </td>
                                    <td valign="top" style="width: 50%;">
                                        <table class="fieldsetTable" style="width:100%">
                                            <tr>
                                                <td class="tablecell">
                                                    Cost/ACV:<br />
                                                    <asp:TextBox runat="server" ID="txtCostACV" Width="100px" CssClass="tdText numberTextBox"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tablecell">
                                                    Advertised Price:<br />
                                                    <asp:TextBox runat="server" ID="txtAdvertisedPrice" Width="100px" CssClass="tdText numberTextBox"></asp:TextBox>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="middle" colspan="2" style="padding-top:4px">
                                        Custom Price Text - overrides vehicle price (70 characters max):<br />
                                        <asp:TextBox runat="server" ID="txtCustomPriceText" Width="98%" CssClass="tdText" TextMode="MultiLine" Rows="2" Height="30px"></asp:TextBox>
 
                                    </td>
                                </tr>
                            </table>
                    </div>
                    </ContentTemplate>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Equipment">
                    <ContentTemplate>
                    <div style="overflow:hidden">
                        <telerik:RadAjaxPanel ID="RadAjaxPanel3" runat="server" >
                                <div style="margin:5px">
                                    <asp:TextBox runat="server" ID="txtEquipment" Width="99%" Height="80px" CssClass="tdText"
                                                                                            TextMode="MultiLine"></asp:TextBox><br />
                                    <asp:Panel ID="panelOptions" runat="server" Visible="false" Width="99%">
                                        Additional Optional Equipment (check all that apply):<br />
                                         
                                    </asp:Panel>
                                </div>
                        </telerik:RadAjaxPanel>
                    </div>
                    </ContentTemplate>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Web Description / Video">
                    <ContentTemplate>
                    <div style="overflow:hidden">
                        <div style="margin:5px">
                           <span  class="fieldsetTable">Description On Web:</span><br />
                            <asp:TextBox runat="server" ID="txtWebDescription" Width="98%" Height="106px" CssClass="tdText"
                                                                                TextMode="MultiLine"></asp:TextBox> <br />
                            <asp:CheckBox runat="server" ID="cbUseAutoclickImages" Text="Use Autoclick Images" CssClass="fieldsetTable" />
                            <br /><br />
                            <span  class="fieldsetTable">Embeded Video:</span><br />
                            <asp:Button ID="btnPasteVideoCode" runat="server" CssClass="tdText" Text="Paste Embedded Code" Width="164px" OnClientClick="PasteFromClipboard(); return false;" /> 
                            <asp:Button ID="btnClearVideoCode" runat="server" CssClass="tdText" Text="Clear" Width="55px" OnClientClick="ClearVideoCode(); return false;" /><br />
                            <asp:TextBox runat="server" ID="txtVideoLink" Width="98%" Height="70px" CssClass="tdText" ForeColor="DarkGray"
                                ReadOnly="false" TextMode="MultiLine" onchange="javascript:VideoCodeChanged(this);"
                                ToolTip="Upload your video to Youtube then click the 'Embed' button and copy and paste the code into this field. Your video will appear on the Vehicle Detail page." ></asp:TextBox>
                        </div>                   
 
                    </div>
                    </ContentTemplate>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>
 
    </form>
</body>
</html>
 

Thanks.

Charles

Ivan Danchev
Telerik team
 answered on 19 May 2016
1 answer
2.1K+ views

Hi,

I'm making some progress formatting the header row of my Excel export, but I'd really like to have the columns automatically adjust to fit the width of the content.

Here's my OnInfrastructureExporting event handler:

protected void grdControls_InfrastructureExporting(object sender, GridInfrastructureExportingEventArgs e)
{
    var colCount = e.ExportStructure.Tables[0].Columns.Count;
    // Set the header style for all columns
    ExportStyle headerStyle = new ExportStyle();
    headerStyle.ForeColor = Color.White;
    headerStyle.BackColor = Color.Blue;
    headerStyle.Font.Bold = true;
 
    for (var i = 1; i <= colCount; i++)
    {
        e.ExportStructure.Tables[0].Cells[i, 1].Style = headerStyle;
        e.ExportStructure.Tables[0].Columns[i].Width = 200; // Would like auto-width !!
    }
}

 

I've seen similar threads but they are related to export formats other than Xlsx.

Any idea how I can accomplish auto-fit using the above handler?  Or do I need to do that elsewhere?

Thanks for any advice.

Jim

Kostadin
Telerik team
 answered on 19 May 2016
5 answers
344 views

I am having a problem validating the Async File upload control, using a Custom Validator and JavaScript.

The JS I'm using is:

 function isAttachmentValid(sender, args) {

var upload = $find("<%= RadUpload1.ClientID %>");
    args.IsValid = upload.getUploadedFiles().length != 0;

}

This works perfectly fine if I submit the form right away, but if I save the form and come back to it upload.getUploadedFiles().length always = 0 and validation fails.

I should also note that I don't have access the server-side code so validation must be done on the client.

 

Hristo Valyavicharski
Telerik team
 answered on 19 May 2016
1 answer
64 views

Hi,

I'm programmatically creating a grid on the server side, and would like to use the HeaderContextMenu to allow filtering (particularly, we're interested in the 2-step filtering provided in the menu). Because the other options are available elsewhere or are not used in our system, we'd like to have the context menu simply show the "filter" submenu. I can remove elements of the context menu using this code:

this.grid.HeaderContextMenu.ItemCreated += (ss, aa) =>
{
    if (aa.Item.Value == "FilterMenuParent" || (aa.Item.Parent is RadMenuItem && (aa.Item.Parent as RadMenuItem).Value == "FilterMenuParent"))
    {
    }
    else
    {
        aa.Item.Remove();
    }
};
However, everything I've tried to do in order to move the Filter Menu up to the top-level menu has failed.

In the attached image, the red-bordered menu is what we'd like to appear when right-clicking a column title.

Is there a way for me to do this? I've tried hooking into various menu events to replace the menu items with the filter menu, but it seems like it's not possible. The closest I can get so far is the top-level menu simply having the "Filter" option, which opens the Filter Menu. I'd like to skip that first step and just have the filter menu appear.

Eyup
Telerik team
 answered on 19 May 2016
5 answers
559 views
Hi,

I have come across a strange behavior with the RadWindow control. I added a RadComboBox in the ContentTemplate of a RadWindow. On clicking the RadComboBox the drop down opens and if I click the Close button of the RadWindow without selecting any item, the RadWindow gets closed but the drop down element is still visible to the user and items can be selected.

Another issue is I open the RadWindow and click the Maximize button in the title bar and the RadWindow gets maximized. Now when the RadComboBox is clicked, the drop down element is not visible to the user. Once the maximized window is closed (even Minimized), the drop down element can be seen in the corresponding position in the screen where the RadComboBox is rendered inside the RadWindow. The user is able to select any item from the drop down element. This issue can be replicated with any RadControl(any version) that has a drop down element such as RadDropDownList, RadDropDownTree.

Here is the code I tried.

ASPX:
<telerik:RadWindow ID="RadWindow1" runat="server" OpenerElementID="RadButton1">
    <ContentTemplate>
        <br />
        <br />
        <telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">
            <Items>
                <telerik:RadComboBoxItem runat="server" Text="Item A" />
                <telerik:RadComboBoxItem runat="server" Text="Item B" />
                <telerik:RadComboBoxItem runat="server" Text="Item C" />
            </Items>
        </telerik:RadComboBox>
    </ContentTemplate>
</telerik:RadWindow>
<telerik:RadButton ID="RadButton1" runat="server" Text="Open RadWindow">
</telerik:RadButton>

JavaScript:
<script type="text/javascript">
    function OnClientSelectedIndexChanged(sender, args) {
        alert("OnClientSelectedIndexChanged Fired");
    }
</script>

I took a sample video of this strange behavior and you can find it here.

Thanks,
Shinu.
Marin Bratanov
Telerik team
 answered on 19 May 2016
1 answer
550 views

Hello,

I would like to change the binding of the ItemTemplate of a GridTemplateColumn in code behind. I am trying to use the click event of a button outside of the grid to change the binding. On the button click, I would like change the Text value of the ItemTemplate to '<%#Eval("Choose")%>'. Please assist.

APSX:

<telerik:GridTemplateColumn HeaderText="SSA Decision" SortExpression="SSA_Decision" UniqueName="SSA_Decision">
<ItemTemplate>
    <asp:Label ID="lblSSADecision" runat="server" Text='<%#Eval("SSA_Decision")%>' />
</ItemTemplate>
<EditItemTemplate>
    <telerik:RadComboBox runat="server" ID="cboSSADecision" Skin="WebBlue" Width="105px">
    <Items>
            <telerik:RadComboBoxItem Text="Yes" Value="True" />
            <telerik:RadComboBoxItem Text="No" Value="False" />
            <telerik:RadComboBoxItem Text="Please Choose" Value="Choose" Selected="true" />
    </Items>
    </telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>

Thanks!

Eyup
Telerik team
 answered on 19 May 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?