Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
132 views
Hello,
I have a table colulmn which contains some IDs. And I have a List<something> which contains reference values for those IDs. Is there a simple way to display those values in the grid column?
It's not possible to use data relations and so on, and the only way to get data is the way described above. And it's not possible to use a ComboBox to display data. I tried to create a template column and put the label there but this would take very much time when combination of large lists and tables is used. Is there a way to do that faster?

Here is what I do in template:
public override void InstantiateIn(Control container)
        {
            Label lbl = new Label();
            lbl.DataBinding += label_DataBinding;
            container.Controls.Add(lbl);
}        
 
        void label_DataBinding(object sender, System.EventArgs e)
        {
            Label lbl = (Label)sender; 
            GridDataItem dataItem = lbl.NamingContainer as GridDataItem;
            DataRowView drv = (DataRowView)dataItem.DataItem;
            RefItem item = Item.refdef.ItemsFlat.Find(m => m.Id == drv[Item.user_name].ToGuid());
            if (item == null)
            {
                lbl.Text = "";
                return;
            }
            lbl.Text = item.Caption;
        }
Dmitry
Top achievements
Rank 1
 asked on 04 Aug 2011
0 answers
130 views
Hi, I have the following problem, I have an Ajax Accordion and I have a js callAccordionExtender.js in the master page I have RadScriptManager and sends me the nexterror: Microsoft JScript runtime error: Object does not support this property or method, couldhelp?

pag. aspx
<%@ Page Language="VB" MasterPageFile="~/MasterPages/master1.master"
    AutoEventWireup="false" CodeFile="page.aspx.vb" Inherits="test_page" Title="page" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphJavaScript" runat="Server">
    <script src="../Scripts/AccordionExtender.js" type="text/javascript"></script>
    <script type="text/javascript">
        var accordionAllExpanded = false;
        var launch = false;
        function pageLoad() {
            if (launch) {
                $find('<%=modalManualFee.ClientID %>').show();
            }
            setAccordionExtension();
        }
        function hideModal() {
            $find('<%=modalManualFee.ClientID %>').hide();
        }
        function launchModal() {
            launch = true;
        }
        function HideButtonOnClick(button) {
            if (typeof Page_ClientValidate != 'undefined') {
                Page_ClientValidate();
                if (Page_IsValid) button.style.display = 'none';
            }
            else {
                button.style.display = 'none';
            }
        }
        function accordionExpandAll(button) {
            $find('<%=accLocations.ClientID %>_AccordionExtender')._expandAllPanes(!accordionAllExpanded);
            if (!accordionAllExpanded) {
                button.innerText = "Collapse All";
                button.className = "button left icon_collapse"
            }
            else {
                button.innerText = "Expand All";
                button.className = "button left icon_expand"
            }
            accordionAllExpanded = !accordionAllExpanded;
        }
    </script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cphContentMain" runat="Server">
 <telerik:RadAjaxManager ID="AjaxManager" runat="server">
        <AjaxSettings>
 <telerik:AjaxSetting AjaxControlID="accLocations">
                <UpdatedControls>
 <telerik:AjaxUpdatedControl ControlID="pnlCart" LoadingPanelID="RadAjaxLoadingPanel" />
 </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
<ajaxToolkit:Accordion ID="accLocations" EnableViewState="true" runat="server">
                <HeaderTemplate>
.........
 </ajaxToolkit:Accordion>
</asp:Content>
file js

function setAccordionExtension() {
    Sys.Application.add_load(Sys.Extended.UI.AccordionBehavior.prototype._expandAllPanes =
                function expandAllPanes(openOrClose) {
                    this._changeSelectedIndex(-1, true);
                    for (var i = 0; i < this._panes.length; i++) {
                        // Get the animation for each pane (creating it on demand if it doesn't
                        // already exist)
                        var pane = this._panes[i];
                        var animation = this._getAnimation(pane);
                        animation._opening = openOrClose;
                        var open = null;
                        var close = null;


                        // Stop any animations that are still playing (i.e. that haven't finished
                        // opening or closing from changing previous panes)
                        if (animation.get_isPlaying()) {
                            animation.stop();
                        }


                        // Get the pane ready to be animated by setting
                        this._startPaneChange(pane, animation._opening);


                        // Setup the fade effect if we are using it
                        if (this._fadeTransitions) {
                            animation._fade.set_effect(animation._opening ? Sys.Extended.UI.Animation.FadeEffect.FadeIn :
                                Sys.Extended.UI.Animation.FadeEffect.FadeOut);
                        }


                        // Set the length animation and the target
                        if (this._autoSize === Sys.Extended.UI.AutoSize.Fill) {
                            animation.set_target(pane.content._original);
                            animation._length.set_startValue(CommonToolkitScripts.getContentSize(pane.content._original).height);
                            animation._length.set_endValue(animation._opening ? this._getRemainingHeight(true) : 0);
                        } else {
                            animation.set_target(pane.content);
                            animation._length.set_startValue(pane.content.offsetHeight);
                            animation._length.set_endValue(animation._opening ? this._getRemainingHeight(false) : 0);
                        }


                        //Open or Close all the pannels
                        if (openOrClose) {
                            animation._opening = true;
                            open = animation;


                            if (open) {
                                open.play();
                            }
                        }
                        else {
                            animation._opening = false;
                            close = animation;
                            if (close) {
                                close.play();
                            }
                        }
                    }
                }
                );
}
ROLANDO
Top achievements
Rank 1
 asked on 04 Aug 2011
3 answers
142 views
I want to display an error message in the grid if some operation has failed  (update, delete, etc)
Ive followed an example suggested in the forums, but it doesnt work

protected void RadGridImages_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            List<Business.Logic.BusinessObjects.ArtistImage> lst = new List<Business.Logic.BusinessObjects.ArtistImage>();
            int aid = -1;
            bool isOK = int.TryParse(this.HiddenArtistID.Value, out aid);
            if (isOK)
            {
                lst = artistImageManager.Get(aid);
                if (lst != null)
                {
                    this.RadGridImages.DataSource = lst;
                }
                else
                {
                    if (this.RadGridImages.DataSourceID == "")
                    {
                        this.RadGridImages.DataSource = new string[] { };
                    }
                }
            }
            if (!string.IsNullOrEmpty(gridMessage))
            {
                DisplayMessage(gridMessage);
            }
        }
        private void DisplayMessage(string text)
        {
            RadGridImages.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text)));
        }

gridMessage is supplied a value when something fails, I then rebind the grid

there IS a value in gridMessage when the NeedDataSource is fired, but the error message never gets displayed.
Anyone see what Im doing wrong here ?
Maria Ilieva
Telerik team
 answered on 04 Aug 2011
2 answers
151 views
Hi,

My aspx page has radgrid and a dropdownlist. I want to populate this dropdownlist based on the value captured from a cell on selecting a single radgrid row.

I have set AllowMultiRowSelection ="false"  and on clientsettings <Selecting AllowRowSelect="True"></Selecting>.

How can I do this?

Or if am using <ClientEvents OnRowSelected="RowSelected" /> and call some javascript I can get the cell value. How will I make use of this to populate the dropdown. The dropdown population is in codebehind.

Thanks,
Shinu
Top achievements
Rank 2
 answered on 04 Aug 2011
1 answer
152 views
I would like to use RadEditor to edit content in a CMS.

Of course I want WYSIWYG editing using the same style sheet that I use in the website.

From what I have read in the forums and documentation it seems that I need to create a second style sheet just for RadEditor to use.

In my CMS system the dynamic content is in a specific container, so I hoped I could just specify the ID or class name of the container and RadEditor could use the website style sheet but this does not appear to be possible. (something like CKEDITOR's bodyClass or bodyId)

My other option, which I have used with other editors, is to make the CSS classes that are used in the content area the default for that HTML tag. For example, if all hyperlinks in the content area are to be red then that is the default for the "A" tag and if I want any other colour outside of the content area then I apply a class name to it. This method works with RadEditor except it ruins the display of toolbars and dialogs if some attributes are changed, for example LI tags. Unfortunately the RadEditor style sheet for toolbars and dialogs don't reset a lot of CSS attributes.

So my question is, is there a way of using RadEditor in this circumstance, without having to create a second style sheet and have to maintain two style sheets?
Rumen
Telerik team
 answered on 04 Aug 2011
2 answers
78 views

Hi,
With the help of the posts in  http://www.telerik.com/community/forums/aspnet/grid/72051-radgrid-print.aspx#1532370 I could print the entire contents of radgrid in Internet Explorer and mozilla .But  I am not able to print the radgrid of certain web pages of the application  in same version of   mozilla while able to do that in internet explorer.For those pages, the below function PrintRadGrid returns null for $find(radGridId).

For the non-working pages , if i put a alert  as the first line of the function PrintRadGrid , then it is working

Could any body please explain why this happens and  how to make it working ...

function getOuterHTML(obj) {
            if (typeof (obj.outerHTML) == "undefined") {
                var divWrapper = document.createElement("div");
                var copyOb = obj.cloneNode(true);
                divWrapper.appendChild(copyOb);
                return divWrapper.innerHTML
            }
            else
                return obj.outerHTML;
        }

        function PrintRadGrid(radGridId) {

            var radGrid = $find(radGridId);
            var previewWnd = window.open('about:blank', '', '', false);
            var sh = '<%# ClientScript.GetWebResourceUrl(grdName.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",grdName.Skin)) %>';
            var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link></head>";
            var htmlcontent = styleStr + "<body>" + getOuterHTML(radGrid.get_element().parentNode) + "</body></html>";
            previewWnd.document.open();
            previewWnd.document.write(htmlcontent);
            previewWnd.document.close();
            previewWnd.print();
            previewWnd.close();

            radGrid.get_masterTableView().fireCommand("EnablePaging", "");
        } 

And in code behind

 RadPnl.ResponseScripts.Add("PrintRadGrid('" + grdNmae.ClientID + "')");

Thanks

 

 

Daniel
Telerik team
 answered on 04 Aug 2011
3 answers
48 views
Version: 2011.1.519.35

When you left click down and hold on the slider handle and move your mouse left or right the handle will not move. If you click in front or behind the handle on the slide scale the handle will move. This only happens in IE9.

Can you confirm replication of this issue? If so, when can we expect a fix?
Niko
Telerik team
 answered on 04 Aug 2011
2 answers
164 views
Hi, I have an hierarchical grid.  masterTableView and DetailTables.
DetailTables has a GridClientSelectColumn that allows to select rows (multiselection)

<telerik:RadGrid ID="RadGridResources" runat="server" Width="950px" ShowStatusBar="true"
            AutoGenerateColumns="False" PageSize="7" AllowSorting="True" AllowMultiRowSelection="True"
            AllowPaging="True">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <MasterTableView Width="100%" DataKeyNames="IDResource" AllowMultiColumnSorting="True" HierarchyDefaultExpanded="true">
                
                    <DetailTables>
                        <telerik:GridTableView DataKeyNames="IDSlot" Name="Slot" Width="100%">
                            <Columns>
 
                                 <telerik:GridClientSelectColumn HeaderStyle-Width="40px"
                                                                UniqueName="CheckboxSelectIDSlotColumn"                                                                
                                                                >
                                    <HeaderStyle Width="40px" />
                                </telerik:GridClientSelectColumn>
                                 
                                <telerik:GridBoundColumn SortExpression="IDSlot" HeaderText="IDSlot" HeaderButtonType="TextButton"
                                    DataField="IDSlot">
                                </telerik:GridBoundColumn>                             
 
                                <telerik:GridBoundColumn SortExpression="Code" HeaderText="Code" HeaderButtonType="TextButton"
                                    DataField="Code">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="Description" HeaderText="Description" HeaderButtonType="TextButton"
                                    DataField="Description">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                       
                <Columns>
                    <telerik:GridBoundColumn SortExpression="IDResource" HeaderText="IDResource" HeaderButtonType="TextButton"
                        DataField="IDResource">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Code" HeaderText="Code" HeaderButtonType="TextButton"
                        DataField="Code">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Description" HeaderText="Description" HeaderButtonType="TextButton"
                        DataField="Description">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
 
            <ClientSettings enablePostBackOnRowClick="true">
                <ClientEvents  />
                <Selecting AllowRowSelect="true" />
            </ClientSettings>
        </telerik:RadGrid>


any time a row is selected I would like to get all the selected rows collection. Think can use selectedIndexChanged...

Protected Sub RadGridResources_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGridResources.SelectedIndexChanged
        Try
 
            Dim selectedItems As New ArrayList
            Dim idSlot As Long
 
                For i = 0 To RadGridResources.SelectedItems.Count - 1
                    Dim dataItem As GridDataItem = RadGridResources.SelectedItems(i)
                    idSlot = dataItem("IDSlot").Text
                    selectedItems.Add(idSlot)
                  
 
                Next
 
              'TO DO
 
 
        Catch ex As Exception
 
        End Try
    End Sub

In the away here above I find all IDSlot (child) selected values but I don't know how to find their IDResource (parent)

Thank you
Jean-Marc
Top achievements
Rank 1
 answered on 04 Aug 2011
11 answers
523 views
Hi,
I have a rad combobox in Ajax update panel inside an ascx control. I need to show a confirm box every time the combo box is changed based on a condition. If the user chooses not to go with the change, I need to set the combo box value to the previous one.
I was able to use ScriptManager.RegisterStartupScript to show the confirm box from the SelectedIndexChanged event. But I'm not able to set the combo box value to previous one. I keep getting null for $find on the combo box. Please find the related code below. Any help is greatly helpful as I need to resolve this ASAP.

ASCX code:
<telerik:RadCodeBlock ID="rcbCodeBlock" runat="server">

    <script type="text/javascript">
        function ShowConfirmOrgCode(oldValue, combo) {
            if (!confirm('Do you want to continue...?')) {
                var orgcombo = $find(combo);
                if (orgcombo != null) {
                    alert(orgcombo.get_selectedIndex());
                    orgcombo .findItemByValue(oldValue).select();
                }
            }
        }
    </script>

</telerik:RadCodeBlock>

           <asp:UpdatePanel ID="updatePanelOrgCode" runat="server">
                <ContentTemplate>
                 <telerik:RadComboBox ID="ddlOrgCode" Width="300px" runat="server" AutoPostBack="true" Height="100px"
                DropDownWidth="570px" MarkFirstMatch="true" EnableLoadOnDemand="false" />
            <asp:RequiredFieldValidator ID="ddlOrgCodereqval" Enabled="true" runat="server" ControlToValidate="ddlOrgCode"
                Display="None" InitialValue="<<- Select Organization Code ->>" ErrorMessage="Organization code is required."
                ValidationGroup="Group1"></asp:RequiredFieldValidator>
            <asp:HiddenField ID="hiddenOrgCode" runat="server" />
            <asp:HiddenField ID="hiddenHasAccess" runat="server" />
                </ContentTemplate>
            </asp:UpdatePanel>


Code Behind:

        protected void ddlOrgCode_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if (ddlOrgCode.SelectedIndex != -1)
            {
                OrganizationCodeCollection ogc = base.CurrentPDCreator.GetAssignedOrganizationCodes();
                int selectedOrgCode = Convert.ToInt32(ddlOrgCode.SelectedValue);
                string oldValue = hiddenOrgCode.Value;
                bool hasAccess = ogc.Contains(selectedOrgCode);
                string sorg = ddlOrgCode.ClientID;
                if (!hasAccess)
                {
                    hiddenHasAccess.Value = hasAccess.ToString();
                    string strScript = "setTimeout(ShowConfirmOrgCode('" + oldValue + "', '" + sorg + "'), 500);";
                    ScriptManager.RegisterStartupScript(updatePanelOrgCode, GetType(), "OrgCodePopup", strScript, true);
                }
                else
                {
                    hiddenOrgCode.Value = selectedOrgCode.ToString();
                }
            }
        }
Dimitar Terziev
Telerik team
 answered on 04 Aug 2011
2 answers
161 views
Hi,

I'm using the radbutton with the download icon to allow users to download files.

This works fine in most cases accept for mime types that the browser recognizes and opens directly
in the browser when the user would rather not open the file, but prefers to "Save As..." the file instead.

When I use a standard ASP.net hyperlink the user can either click to open or right click and select
"Save Target As..." and save it without opening it.

Is there any way to make the browsers work this way when using the radbutton as a download hyperlink?

Thank,
Scott
Slav
Telerik team
 answered on 04 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?