Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
180 views
Hello forum,
we have three RadHtmlCharts on one page and we would like to export them to excel, all at once.
So our plan is to make a new RadGrid in code-behind, add those three charts to this grid and export that grid.
So i wrote this piece of Code:
private void ExportChartsToExcel() {
    RadGrid chartWrapperGrid = new RadGrid();
    chartWrapperGrid.ID = "ChartWrapperGrid";
    chartWrapperGrid.AutoGenerateColumns = false;
 
    GridBoundColumn boundColumn1 = new GridBoundColumn();
    boundColumn1.DataField = "Chart1";
    boundColumn1.HeaderText = "Chart 1";
    chartWrapperGrid.MasterTableView.Columns.Add(boundColumn1);
    GridBoundColumn boundColumn2 = new GridBoundColumn();
    boundColumn2.DataField = "Chart2";
    boundColumn2.HeaderText = "Chart 2";
    chartWrapperGrid.MasterTableView.Columns.Add(boundColumn2);
    GridBoundColumn boundColumn3 = new GridBoundColumn();
    boundColumn3.DataField = "Chart3";
    boundColumn3.HeaderText = "Chart 3";
    chartWrapperGrid.MasterTableView.Columns.Add(boundColumn3);
 
    DataTable chartTable = new DataTable();
    chartTable.Columns.Add("Chart1");
    chartTable.Columns.Add("Chart2");
    chartTable.Columns.Add("Chart3");
    RadHtmlChart[] chartArray = new RadHtmlChart[] { Chart1, Chart2, Chart3 };
    chartTable.Rows.Add(chartArray);
    chartWrapperGrid.DataSource = chartTable;
 
    this.form1.Controls.Add(chartWrapperGrid);
    chartWrapperGrid.ExportSettings.OpenInNewWindow = true;
    chartWrapperGrid.ExportSettings.ExportOnlyData = true;
    chartWrapperGrid.ExportSettings.IgnorePaging = true;
    chartWrapperGrid.MasterTableView.ExportToExcel();
}

The download starts as wanted but the in the grid are only the titles with "Telerik.Web.UI.RadHtmlChart" under it.
Why are the Chart not shown?


What am i doing wrong?
Danail Vasilev
Telerik team
 answered on 14 Apr 2013
0 answers
113 views
I want to change a MultiView Active View when a ItemCommand is fired, the next snippet is executed buy the 
view is not changing
Protected Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)
        If (e.CommandName = "review") Then
            mvFunciones.SetActiveView(vEdit)
         
        End If
    End Sub


<
asp:UpdatePanel runat="server">
        <ContentTemplate>
            <asp:MultiView ID="mvFunciones" runat="server">
                <asp:View ID="vList" runat="server">
                    <div class="container">
                         <div class="row">
                            <div class="span12">
                                <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                                    <script type="text/javascript">
                                        var timer = null;
 
                                        function KeyUp() {
                                            if (timer != null) {
                                                clearTimeout(timer);
                                            }
                                            timer = setTimeout(LoadTable, 500);
                                        }
 
                                        function LoadTable() {
                                            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("FilterGrid");
                                        }
                                    </script>
                                </telerik:RadCodeBlock>
 
                                <%--<telerik:RadScriptManager runat="server" ID="RadScriptManagerLista" />--%>
                                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                                    <AjaxSettings>
                                        <telerik:AjaxSetting AjaxControlID="RadGrid1">
                                            <UpdatedControls>
                                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                                                <%-- LoadingPanelID="RadAjaxLoadingPanel1"--%>
                                            </UpdatedControls>
                                        </telerik:AjaxSetting>
                                        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                                            <UpdatedControls>
                                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                                                <%--LoadingPanelID="RadAjaxLoadingPanel1"--%>
                                            </UpdatedControls>
                                        </telerik:AjaxSetting>
                                         
                                        
 
                                         
                                    </AjaxSettings>
                                </telerik:RadAjaxManager>
 
 
                                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="25">
                                    <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
                                        style="border: 0px;" />
 
 
                                </telerik:RadAjaxLoadingPanel>
                                <asp:TextBox ID="TextBox1" onkeyup="KeyUp();" runat="server"></asp:TextBox>
                                <telerik:RadGrid ID="RadGrid1" Width="100%" AllowPaging="True" PageSize="10" runat="server"
                                    AllowSorting="true" GridLines="None" AllowFilteringByColumn="true" CssClass="table table-striped" AutoGenerateColumns="False"
                                    AlternatingItemStyle-CssClass="linea1" OnNeedDataSource="RadGrid1_NeedDataSource" selecte
                                    OnItemCommand="RadGrid1_ItemCommand">
                                    <MasterTableView Width="100%">
 
                                        <Columns>
 
                                            <telerik:GridButtonColumn
                                                UniqueName="clave" HeaderText="Clave" CommandName="review" DataType="System.Int32"
                                                DataTextField='idfuncion'>
                                            </telerik:GridButtonColumn>
                                        </Columns>
                                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column" Created="True"></ExpandCollapseColumn>
                                        <EditFormSettings>
                                            <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                                        </EditFormSettings>
                                        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                                    </MasterTableView>
                                    <PagerStyle Mode="NextPrevAndNumeric" CssClass="pagination"></PagerStyle>
                                    <FilterMenu EnableTheming="True">
                                        <CollapseAnimation Duration="200" Type="OutQuint"></CollapseAnimation>
                                    </FilterMenu>
                                </telerik:RadGrid>
                            </div>
                        </div>
                    </div>
 
 
                </asp:View>
                <asp:View ID="vEdit" runat="server">
                  
 
             <asp:TextBox ID="hello" runat="server"  Text="IT WORKED"/>
 
 
                </asp:View>
 
            </asp:MultiView>
        </ContentTemplate>
        <Triggers>
 
            <asp:AsyncPostBackTrigger ControlID="RadGrid1" EventName="ItemCommand" />
 
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>


Alberto
Top achievements
Rank 1
 asked on 14 Apr 2013
2 answers
130 views
Hello,

I have an Edit button located on my MasterPage and a RadGrid located in my Default.aspx page. I am trying to get the Session ID of the row selected in the Default.aspx page and pull in those values into my Edit page.
When I select a row in Default.aspx and then click Edit, the page refreshes and the row is deselected.
What am I doing wrong here?

Here is my code behind for the MasterPage Edit button:
protected void lEditItem_Click(object sender, EventArgs e)
{
    GetSelected();
    if (Session["CriteriaID"] != null)
    {
        Session["AccessMode"] = "";
        Response.Redirect("~/EditCriteria.aspx");
    }
}
 
private void GetSelected()
{
    RadGrid control = (RadGrid)PageContent.FindControl("criteriaList");
    foreach (GridDataItem item in control.MasterTableView.Items)
    {
        if (item.Selected)
        {
            String temp = item.GetDataKeyValue("ID").ToString();
            Session["CriteriaID"] = new Guid(item.GetDataKeyValue("ID").ToString());
 
        }
    }
}

The code for the RadGrid in Default.aspx is
<asp:Content ID="Content2" ContentPlaceHolderID="PageContent" runat="server">
    <div class="PageBlock">
            <div class="SecHeader">Criteria List</div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CriteriaCS %>"
         
                SelectCommand="SELECT [AssetOwner], [CriteriaName], [CriteriaDescription], [CriteriaType], [ID] FROM [Study]">
    </asp:SqlDataSource>
    <telerik:RadGrid ID="criteriaList" runat="server" CellSpacing="0" DataSourceID="SqlDataSource1"
        GridLines="None" AllowSorting="True" AutoGenerateColumns="False">
        <ClientSettings EnablePostBackOnRowClick="True">
            <Selecting AllowRowSelect="True" />
            <ClientEvents OnRowSelected="RowSelected"></ClientEvents>
        </ClientSettings>
        <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="ID">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True"
                FilterControlAltText="Filter ExpandColumn column" Created="True">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="AssetOwner" FilterControlAltText="Filter AssetOwner column"
                    HeaderText="AssetOwner" SortExpression="AssetOwner" UniqueName="AssetOwner">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CriteriaName" FilterControlAltText="Filter CriteriaName column"
                    HeaderText="CriteriaName" SortExpression="CriteriaName" UniqueName="CriteriaName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CriteriaDescription" FilterControlAltText="Filter CriteriaDescription column"
                    HeaderText="CriteriaDescription" SortExpression="CriteriaDescription" UniqueName="CriteriaDescription">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CriteriaType" FilterControlAltText="Filter CriteriaType column"
                    HeaderText="CriteriaType" SortExpression="CriteriaType" UniqueName="CriteriaType">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ID" DataType="System.Guid"
                    FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True"
                    SortExpression="ID" UniqueName="ID" Visible="False">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
            <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
        </MasterTableView>
        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>
    </div>
</asp:Content>



Thanks!!!
Pradeep
Top achievements
Rank 1
 answered on 13 Apr 2013
2 answers
247 views

Hi all,
I have used 2 RadlistBox to assign some email id in both Radlistbox.
First listbox mail id check same mailid enable false in another RadListBox how to check

My sample coding here

protected void ToEmail_ItemCheck(object sender, Telerik.Web.UI.RadListBoxItemEventArgs e)
        {
            ToName.Text = "";
            int i = 0;
            foreach (object obj in ToEmail.CheckedItems)
            {
                string ema;
                string item1 = ToEmail.CheckedItems[i].Value;
                ToName.Text += ',' + item1;
                ema = ToEmail.CheckedItems[i].Value;
                foreach (RadListBoxItem item2 in ToEmailCC.Items)
                {
                    if (ToEmailCC.Items[i].Value == ema)
                    {
                        item2.Enabled = false;
                    }
                }
                i++;
            }
        }

Thanks & Advance,
Ansari

Tamim
Top achievements
Rank 1
 answered on 13 Apr 2013
4 answers
234 views
What I want is to show/hide the Insert button by permission of user. 

Can I do that?

Thanks,
Bill
wg
Top achievements
Rank 1
 answered on 13 Apr 2013
0 answers
123 views
I have been operating on the assumption that all I had to do create a RadAlert from server side was to call RadWindowManager1.RadAlert("Message", 500, 200, "Another Message", "");

This has worked fine on several complex pages in my project.  
I've also created a bare minimal test page and it's worked perfectly there as well.
All the pages have much the same settings and controls (RadScriptManager, RadWindowManager, etc.)

I have this other page with an identical call within a Radbutton click event.  When I do it from there I get a 
Script controls may not be registered before PreRender crash.

There is nothing particularly exotic about this page. It's just another postback event.  

What could possibly be going wrong?

Sorry.  Found it.  Bad call to unrelated controls in the Prerender.
Boris
Top achievements
Rank 1
 asked on 12 Apr 2013
0 answers
91 views
Sorry. Cancel this post.  Wrong assumptions.
Boris
Top achievements
Rank 1
 asked on 12 Apr 2013
1 answer
113 views
I'm using a radGrid in a user control. The user control has a client-side API (so it can be used more than once on the same page). Due to this, I cannot specify a client-side OnGridCreated event handler declaratively, since the same function would be called for multiple occurrences of the grid. In my client-side component's initialize event the grid does not exist yet, so I cannot attach handlers there, but if I go for the pageLoad event, the grid has already been created, and the gridCreated event fired, so it's too late to attach to it. Any suggestions on how/when I can attach this event successfully?
Jeanne
Top achievements
Rank 1
 answered on 12 Apr 2013
14 answers
457 views
Why is it that the whole RadMultiPage control has to be updated on postbacks? This seems horribly inefficient to me and such a waste of resources. Why is it that a single PageView within a RadMultiPage can't be set as an updated control within a RadAjaxManager? The only way it works is if I set the entire RadMultiPage as an updated control in my RadAjaxManager settings. This seems like such a waste. I have several PageViews which contain RadComboBox controls and those RadComboBox controls contain hundreds of items each. I'd like to load them from the database once up-front and have them just persist in ViewState on the client so that the Google Suggest-like filtering (i.e. MarkFirstMatch=true) will work super fast since it's all on the client. But, since you have the whole RadMultiPage control going back and forth the wire every single time there is an AJAX postback, the postbacks are very bloated. This means that I am basically being forced into using the server-side load-on-demand mechanism and doing a database pull each and every time the user starts to type in the comboboxes and return only the relevant results to the combobox. I'm OK with this, but I'd rather load the comboboxes once up-front and only have single PageViews updated when postbacks/callbacks occur. Please explain why this is so and what all my options are. Thank you. BTW, I do love your products...I'm just frustrated by this one limitation. It just looks what you are doing is applying class="rmpHiddenView" to hide the pageviews that are not currently being viewed.
Keith
Top achievements
Rank 2
 answered on 12 Apr 2013
2 answers
113 views
Hi,
I Have a page with a RadUpload control taht is working fine.

Now I would like to add a progress bar to show about the process that I'm doing with the information loaded from the uploaded file.

I'm receiving this message when I tried to just replicate the same code from the demo on that page:
RadUpload Ajax callback error. Source url returned error: 400
Bad Request
http://localhost:19562//Telerik.RadUploadProgressHandler.ashx?RadUrid=297095f2-2e7d-4479-94c3-cf10b923cd46


The error is here: "...19562//Telerik..." If i remove the second slash and put it manually on the address bar it's working fine.

How can I fix it? Any help will be very appreciated.

thanks!
Leandro
Top achievements
Rank 1
 answered on 12 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?