Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
1.1K+ views
Hi,

I am using RadDropDownList in GridTemplateColumn, and I want to get the row index when SelectedIndexChanged event of RadDropDownList is fired.
My code looks like below:

ASPX:
        <telerik:RadGrid runat="server" ID="RadGrid1" AllowSorting="false" AutoGenerateColumns="false" AllowMultiRowSelection="True" GridLines="Both">
            <ClientSettings AllowColumnsReorder="false" ReorderColumnsOnClient="False">
                <Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>
                <Resizing AllowColumnResize="true" EnableRealTimeResize="false" />
                <Selecting AllowRowSelect="True"></Selecting>
            </ClientSettings>
            <GroupingSettings ShowUnGroupButton="False"></GroupingSettings>
 
            <MasterTableView EnableHeaderContextMenu="false" EditMode="Batch" >
                <BatchEditingSettings EditType="Cell" OpenEditingEvent="MouseOver"/>
                <Columns>
                    <telerik:GridClientSelectColumn Reorderable="False" Resizable="False" >
                    </telerik:GridClientSelectColumn>
                    <telerik:GridBoundColumn DataField="Organ" HeaderText="Organ" Resizable="False" DataType="System.String" ReadOnly="true">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn UniqueName="OptionColumn" HeaderText="Option" Resizable="False">
                        <ItemTemplate >
                            <%# Eval("Option")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadDropDownList ID="MyList" runat="server" DataSourceID="LinqDS1" DataTextField="Text" DataValueField="Value" OnSelectedIndexChanged="MyList_SelectedIndexChanged" AutoPostBack="True">
                            </telerik:RadDropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
 
<asp:LinqDataSource ID="LinqDS1" runat="server" EnableDelete="False" EnableInsert="False" EnableUpdate="false" OnSelecting="LinqDS1_Selecting"></asp:LinqDataSource>

Code-behind:
01.protected void MyList_SelectedIndexChanged(object sender, DropDownListEventArgs e)
02.{
03.    var dropDownList = sender as RadDropDownList;
04.    if (dropDownList != null)
05.    {
06.        // try to get the row index
07.        var item = dropDownList.NamingContainer as GridDataItem;
08.        if( item != null )
09.        {
10.            sources[ item.RowIndex ] = e.Text;
11.        }
12.    }
13.}

I searched in the forum and find some hints as above code snippet, but at line 7, I always get a null reference.

Do you have any advice? Thanks in advance!
Srividhya
Top achievements
Rank 1
 answered on 02 Aug 2016
2 answers
58 views

I have a scheduler control on a default.aspx page.

It works fine if the URL is http://sitename/default.aspx

However normally our site has rewrite rules that change the URL to http://sitename/

When that happens the scheduler displays but you can't switch views or days.

Any suggestions?

Thanks

Charlotte

Charlotte
Top achievements
Rank 1
 answered on 02 Aug 2016
1 answer
102 views

Hi,

We have a vb.net project in ASP.NET that we install on many client servers, recently two users have discovered that they can't change tabs on the below page. There's no reason for this to happen, they have the same website files as all other customers, same version of Telerik 2016 Q2 (also tested on 2015 Q3), same IIS installation options. It appears to be a problem with the installation onto the server rather than a browser issue because we can recreate the issue on all browsers. We also have a "cloud" version of the same software which we host ourselves where the same browsers do not present the same issue hinting towards a server issue. The rad tab strip control works elsewhere in the application on the server using virtually the same code and as mentioned before works on other customers servers, so I'm completely at a loss.

 

Any help is greatly appreciated.

 

The page contains a series of textboxes, combo boxes and Checkboxes that I've removed as otherwise it was over a 1000 lines of code!

 

001.<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SystemSettings.aspx.vb"
002.    Inherits="SystemSettings" UICulture="auto" Culture="auto" %>
003. 
004.<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
005.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
006.<html xmlns="http://www.w3.org/1999/xhtml">
007.<head runat="server">
008.    <title>Configuration</title>
009.    <style type="text/css">
010.        .style1 {
011.        }
012. 
013.        .style2 {
014.            width: 200px;
015.        }
016. 
017.        .style3 {
018.        }
019.    </style>
020.</head>
021.<body onkeydown="return noBackspace(event)" onload="InitWindow();">
022.    <form id="form1" runat="server">
023.        <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
024.        </telerik:RadStyleSheetManager>
025.        <telerik:RadSkinManager ID="RadSkinManager1" runat="server">
026.        </telerik:RadSkinManager>
027.        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
028.        </telerik:RadScriptManager>
029.        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
030.        <telerik:RadInputManager ID="RadInputManager1" runat="server">
031.            <telerik:RegExpTextBoxSetting ErrorMessage="Time in HH:MM required" ValidationExpression="\d\d:\d\d">
032.                <TargetControls>
033.                    <telerik:TargetInput ControlID="txtStartOfDay" />
034.                    <telerik:TargetInput ControlID="txtEndOfDay" />
035.                    <telerik:TargetInput ControlID="txtDayStart" />
036.                    <telerik:TargetInput ControlID="txtDayFinish" />
037.                    <telerik:TargetInput ControlID="txtLunchStart" />
038.                    <telerik:TargetInput ControlID="txtLunchFinish" />
039.                </TargetControls>
040.            </telerik:RegExpTextBoxSetting>
041.            <telerik:RegExpTextBoxSetting ErrorMessage="Please enter a valid email address."
042.                            ValidationExpression="^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$" ClearValueOnError="False">
043.                <TargetControls>
044.                    <telerik:TargetInput ControlID="txtSystemEmail" />
045.                    <telerik:TargetInput ControlID="txtGlobalSend" />
046.                    <telerik:TargetInput ControlID="txtEmailErrorsTo" />
047.                </TargetControls>
048.            </telerik:RegExpTextBoxSetting>
049.        </telerik:RadInputManager>
050.        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
051.            <script type="text/javascript" src="scripts\editwindow.js">
052.            </script>
053.            <script type="text/javascript">
054.                function showColourPicker() {
055.                    var ow = window.radopen("ColourSettings.aspx?category=-SYSTEM-&PageID=8120&ID=", "ColourPicker");
056.                    ow.setSize(500, 400);
057.                    return false;
058.                }
059.            </script>
060.            <script type="text/javascript">
061.                function ShowProjectCustomFields() {
062.                    var width = parseInt((window.innerWidth * 80) / 100);
063.                    var height = parseInt((window.innerHeight * 80) / 100);
064.                    var ow = window.radopen("CustomFields.aspx?TableName=Project", "ProjectCustomFields", width - 6, height - 6);
065.                    ow.center();
066.                    return false;
067.                }
068.                function MaxFlexiHistory() {
069.                   var ow = window.radopen("MaxFlexiHistory.aspx", "MaxFlexiHistory");
070.                   ow.Maximize();
071.                   return false;
072.                }
073.            </script>
074.        </telerik:RadCodeBlock>
075.        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="2">
076.            <Tabs>
077.                <telerik:RadTab runat="server" Text="Time Entry" PageViewID="pageTimeEntry"></telerik:RadTab>
078.                <telerik:RadTab runat="server" Text="Time Entry Layout" PageViewID="pageLayout"></telerik:RadTab>
079.                <telerik:RadTab runat="server" Text="Validation" PageViewID="pageValidation" Selected="True"></telerik:RadTab>
080.                <telerik:RadTab runat="server" Text="Leave" PageViewID="pageLeave"></telerik:RadTab>
081.                <telerik:RadTab runat="server" Text="Flexitime" PageViewID="pageFlexitime"></telerik:RadTab>
082.                <telerik:RadTab runat="server" Text="Targeting" PageViewID="pageTargeting"></telerik:RadTab>
083.                <telerik:RadTab runat="server" Text="Billing" PageViewID="pageBilling"></telerik:RadTab>
084.                <telerik:RadTab runat="server" Text="Email" PageViewID="pageEmail"></telerik:RadTab>
085.                <telerik:RadTab runat="server" Text="Terminology" PageViewID="pageTerminology"></telerik:RadTab>
086.                <telerik:RadTab runat="server" Text="System" PageViewID="pageSystem"></telerik:RadTab>
087.            </Tabs>
088.        </telerik:RadTabStrip>
089.        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="100%" SelectedIndex="2">
090.            <telerik:RadPageView ID="pageTimeEntry" runat="server">
091.                <div>
092. 
093.                </div>
094.            </telerik:RadPageView>
095.            <telerik:RadPageView ID="pageLayout" runat="server">
096.                <div>
097. 
098.                </div>
099.            </telerik:RadPageView>
100.            <telerik:RadPageView ID="pageValidation" runat="server" Width="100%">
101.                <div>
102. 
103.                </div>
104.            </telerik:RadPageView>
105.            <telerik:RadPageView ID="pageLeave" runat="server" Width="100%">
106.                <div>
107. 
108.                </div>
109.            </telerik:RadPageView>
110.            <telerik:RadPageView ID="pageFlexitime" runat="server" Width="100%">
111.                <div>
112. 
113.                </div>
114.            </telerik:RadPageView>
115.             <telerik:RadPageView ID="pageTargeting" runat="server" Width="100%">
116.                <div>
117. 
118.                </div>
119.            </telerik:RadPageView>
120. 
121.            <telerik:RadPageView ID="pageBilling" runat="server" Width="100%">
122.                <div>
123. 
124.                </div>
125.            </telerik:RadPageView>
126.            <telerik:RadPageView ID="pageEmail" runat="server" Width="100%">
127.                <div>
128. 
129.                </div>
130.            </telerik:RadPageView>
131.            <telerik:RadPageView ID="pageTerminology" runat="server" Width="100%">
132.                <div>
133.                </div>
134.            </telerik:RadPageView>
135.            <telerik:RadPageView ID="pageSystem" runat="server">
136.                <div>
137. 
138.                </div>
139.            </telerik:RadPageView>
140.        </telerik:RadMultiPage>
141.        <div class="button-line">
142.            <asp:Button ID="btnSave" runat="server" Text="Save" Width="100px" /> 
143.        <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="100px" />
144.        </div>
145.        <asp:ObjectDataSource ID="dsSecurityGroup" runat="server" SelectMethod="List" TypeName="dbSecurityGroup">
146.            <SelectParameters>
147.                <asp:Parameter DefaultValue="false" Name="ShowArchived" Type="Boolean" />
148.            </SelectParameters>
149.        </asp:ObjectDataSource>
150.        <telerik:RadWindowManager ID="RadWindow1" runat="server" Left="" Top="" Modal="True"
151.            ReloadOnShow="True" ShowContentDuringLoad="False" VisibleStatusbar="False" EnableViewState="False">
152.        </telerik:RadWindowManager>
153.        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
154.            <AjaxSettings>
155.                <telerik:AjaxSetting AjaxControlID="RadGrid1">
156.                    <UpdatedControls>
157.                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
158.                    </UpdatedControls>
159.                </telerik:AjaxSetting>
160.            </AjaxSettings>
161.        </telerik:RadAjaxManager>
162.        <asp:Label ID="ScriptPlaceholder" runat="server"></asp:Label>
163.    </form>
164.</body>
165.</html>

Peter Milchev
Telerik team
 answered on 02 Aug 2016
6 answers
223 views
I don't see any built in client-side functionality to auto-resize a column in a RadTreelist like there is in the RadGrid. Could anyone provide a resource or code on how to accomplish this with my own function?

Here is the code I am using for a set width RadGrid to accomplish this. Essentially, it is auto-resizing all the columns then taking whatever is left over and adding it to the column of my choosing. I want to accomplish the same thing.

            function GridCreated(sender, args) {
                var grid = sender;
                var columns = grid.get_masterTableView().get_columns();
                var oldGridWidth = 0;
                var newGridWidth = 0;
                var primaryColumnIndex;

                for (var i = 0; i < columns.length; i++) {
                    oldGridWidth = oldGridWidth + columns[i].get_element().offsetWidth;
                    columns[i].resizeToFit();
                    newGridWidth = newGridWidth + columns[i].get_element().offsetWidth;
                    if (columns[i].get_uniqueName().charAt(0) == "*") {
                        primaryColumnIndex = i;
                    }
                }

                var varWidth = newGridWidth - oldGridWidth;
                var origWidth = columns[primaryColumnIndex].get_element().offsetWidth;
                grid.get_masterTableView().resizeColumn(primaryColumnIndex, origWidth - varWidth);
            }
Maria Ilieva
Telerik team
 answered on 02 Aug 2016
1 answer
173 views

We recently upgraded Sitecore to the 8.1 Update 3 version. With the upgrade path, the Telerik assembly was also updated. After the upgrade, we started receiving complaints about snippet formatting being changed when accepting the change. Below is a before and after view of the content.

Does anyone have any tips on a fix or what the next step should be? Thanks!

 

Example Snippet Code:

<!-- mug right -->
<div class="mug right">  <img alt="" width="80" height="106" src="~/media/14B3501FFB3A422C911BD4D43F35A44D.ashx" />
<p class="name"><strong>Name</strong></p>
</div>
<!-- /mug right -->

What it looks like after accepting:

...paragraph content ends here.</p>

<p class="BodyCxSpMiddle"><!-- mug right -->
<div class="mug right">  <img alt="" width="80" height="106" src="~/media/14B3501FFB3A422C911BD4D43F35A44D.ashx" />  </div>
</p>
<p class="name"><strong>Name</strong></p>
<p class="BodyCxSpMiddle">
<div class="mug right">&nbsp;</div>
<!-- /mug right --></p>

<p>Content starts back up...

Marin Bratanov
Telerik team
 answered on 02 Aug 2016
5 answers
87 views

Hello,

I've added some logic to the OnClientPasteHtml method in Javascript, which ensures that the <a> tag has a href of "#" and adds a OnClick attribute. We're doing this so that mailto links are (roughly) encoded, so bots do not spam the email address, etc.

This is my code:

 

function OnClientPasteHtml(sender, args) {
    var commandName = args.get_commandName();
    var value = args.get_value();

if (commandName == "LinkManager" || commandName == "SetLinkProperties") {
        breakme: if (/href="mailto:([^@]+)@([^?"]+)(?:\?subject=([^"]+))?[^>]+>([^<]+)/i.test(value)) {
            var valueSplit = value.match(/href="mailto:([^@]+)@([^?"]+)(?:\?subject=([^"]+))?[^>]+>([^<]+)/i);

            // Email address
            if (typeof valueSplit[1] == "undefined" || typeof valueSplit[2] == "undefined") {
                break breakme;
            }
            var addrPrefix = valueSplit[1];
            var addrSuffix = valueSplit[2];
            // Subject
            var subject = '';
            if (typeof valueSplit[3] !== "undefined") {
                subject = valueSplit[3];
            }
            // Text
            var linkText = '';
            if (typeof valueSplit[4] !== "undefined") {
                linkText = valueSplit[4];
            }

            // Final output example = <a onclick="href='mailto:'+'first.name'+'@'+'domain.com'+'?subject=hello world'" href="#">Email Me.</a>
            var valueFinal = '';
            if (Prototype.Browser.IE) {
                // TODO: Fix IE bug
            }
            else{
                valueFinal = "<a onclick=\"href='mailto:'+'" + addrPrefix + "'+'@'+'" + addrSuffix + "'+'?subject=" + subject + "'\" href=\"#\">" + linkText + "</a>";
            }
            args.set_value(valueFinal);
        }
}

 

It works perfectly, in Firefox, but I seem to be getting odd results in IE (and possibly Chrome).

When I debug in IE, I can see that valuFinal is in the correct format, but then when you click or view html, the <a> tag changes, to this:

<a onclick="href='mailto:'+'website'+'@'+'domain.com'+'?subject=domain.com feedback'" href="mailto:website@domain.com?subject=domain.com feedback">mailto:website@domain.com?subject=domain.com feedback</a>

As you can see, the href is not a "#" and the link text is being replaced by the same mailto link.

 

I use Sitecore.NET 7.2 (rev. 140526), which is using Telerik 2012.1.607.35 DLL version.

We don't really want to upgrade any versions so a fix for my current state will be ideal.

Any information will be great! Thanks :)

Marin Bratanov
Telerik team
 answered on 02 Aug 2016
1 answer
130 views

Hi, I am testing a bug on your online Demo of the Editor - Track Changes and if :

1) I bold a non tracked word

2) I Append an "s" to the previous non tracked word

3) delete the space between the previous word and the bolded word

the tracking will delete the first letter of the bolded word? We have clients that have complained about it.

They had a non tracked phrase "total income (1)" and they added an "s" to income and then deleted the space but the "(" ended up being strikedthrough.

Symon

Nikolay
Telerik team
 answered on 02 Aug 2016
0 answers
118 views

Hi,

I am working on Telerik Radeditor with Markdown mode. But when I underline the text then it does not work.

Is there any way to support the underlining in markdown mode? Below is the example which I am referring for the implementation of Markdown mode.

http://demos.telerik.com/aspnet-ajax/editor/examples/import-export/markdown-import-export/defaultcs.aspx

Please help me ASAP.

 

Thanks in advance.

Avinash
Top achievements
Rank 1
 asked on 02 Aug 2016
1 answer
311 views
Is there a way to via server-side or client side to freeze the top row of headers?
Ivan Danchev
Telerik team
 answered on 02 Aug 2016
1 answer
100 views

Hi, if I open a RadDropDownTree and then I press enter to automatically select all the items.

 

                                                    <telerik:RadDropDownTree RenderMode="Lightweight" ID="RadDropDownTree3" runat="server" Width="100%" CheckBoxes="TriState"
                                                        DefaultMessage="Seleziona la zona" OnNodeDataBound="RadDropDownTree1_NodeDataBound" Skin="Bootstrap" >
                                                        <DropDownSettings />
                                                    </telerik:RadDropDownTree>

 

You can avoid this behavior ?

Veselin Tsvetanov
Telerik team
 answered on 02 Aug 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?