Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
278 views

Hello

I am trying to get RadScriptManager to work on a page in conjunction with controls from the Ajax Control Toolkit. The website runs under .NET 3.5, and I have a version of the ACT DLL that is built on a .NET 3.5 reference. 

Specifically, I have Telerik.Web.UI v2011.3.1115.35, with an AnimationExtender from ACT v3.5.40412.2.  I have all the DLLs correctly referenced, and no errors are reported, but the AnimationExtender does not appear to be working - it is not responsive to any mouse events. As I understand the issue, I need the RadScriptManager from Telerik.Web.UI to substitute for the ToolkitScriptManager from ACT. On that basis, I found the forum posting shown here:  

http://www.telerik.com/community/forums/aspnet-ajax/scriptmanager-and-stylesheetmanager/fix-radscriptmanager-compatibility-issues-with-ajax-control-toolkit.aspx

This post looks as if it might go some way to addressing my objective. However, I need to carry out the script reference customization programmatically. Hence, I managed to come up with the following code to run on Page_Load, where radsm is the declared RadScriptManager control ...

radsm.EnableScriptCombine = False
radsm.Scripts.Add(New ScriptReference( _
   "MicrosoftAjax.js", _
   "System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"))
radsm.Scripts.Add(New ScriptReference( _
   "MicrosoftAjaxWebForms.js", _
   "System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"))

The problem is this code does not seem to solve my issue. Where could I be going wrong? Is this combination of libraries and controls even possible? Can the RadScriptManager be manipulated in this way programmatically?

If you could provide me with some pointers of the right direction to work in, that would be really useful.

Thanks very much

 

Genady Sergeev
Telerik team
 answered on 10 Apr 2012
1 answer
175 views
I have looked at the examples I could find but do not find one with a masterpage and updatepanel involved.  How can I export to excel within a masterpage and updatepanel.  If I have the updatepanel out of the following code it works but when put back in it does nto work, but produces no errors either.  Originally I tried to use one update panel but switched to 2 to see if I could get it to work this way. still no deal.

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContent" Runat="Server">
    <asp:UpdatePanel ID="udp1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="lnkDisplay" />
        </Triggers>
        <ContentTemplate>
             <asp:Panel ID="pnlPick" Runat="server">
                <table width="100%">
                    <tr>
                        <td align="center" width="100%">Pick Deployment: 
                            <asp:DropDownList id="ddlDeployment" Runat="server" Width="160" AutoPostBack="True"></asp:DropDownList>     
                            Pick BN: <asp:DropDownList id="ddlBn" Runat="server" Width="120" AutoPostBack="True"></asp:DropDownList>
                                 Pick Uic: <asp:DropDownList id="ddlUic" Runat="server" Width="120" AutoPostBack="true"></asp:DropDownList>
                            <asp:Button ID="btnPanel" runat="server" style="display:none" />
                        </td>
                    </tr>
                    <tr>
                        <td align="center"><asp:LinkButton ID="lnkDisplay" Runat="server" CausesValidation="True">Display DMD</asp:LinkButton></td>
                    </tr>
                    <tr>
                        <td style="height:10px"></td>
                    </tr>
                </table>
            </asp:Panel>
       </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="udp2" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlgrid" runat="server" Visible="false">
                <table width="100%">
                    <tr>
                        <td align="center">
                             <telerik:RadGrid ID="myRadGrid" runat="server" Width="98%" BorderWidth="1px" CellPadding="6" GridLines="None" BorderColor="#404040" Skin="Web20">
                                <ExportSettings ExportOnlyData="true" FileName="DonorSlots" IgnorePaging="true" OpenInNewWindow="true"></ExportSettings>
                                <MasterTableView AutoGenerateColumns="false" Name="MasterGrid" BorderColor="#404040" Font-Size="9" Font-Names="Veranda,arial,sans-serif" 
                                HeaderStyle-HorizontalAlign="Center" GridLines="Both" BorderWidth="1px" CommandItemDisplay="Top" EditMode="EditForms">
                                <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToExcelButton="false" /><AlternatingItemStyle BackColor="#B0C4DE"  HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Center" /><HeaderStyle ForeColor="White" Font-Bold="true" BorderColor="#404040" BorderWidth="1px" />
                                    <CommandItemTemplate>
                                        <table width="100%">
                                            <tr>
                                                <td align="right"><asp:Button ID="btnExport" runat="server" CommandName="ExportToExcel" Text="Export Excel" /></td>
                                            </tr>
                                        </table>
                                    </CommandItemTemplate>
                                   <Columns>
                                    <telerik:GridBoundColumn DataField="Unit" HeaderText="Unit" />
                                    <telerik:GridBoundColumn DataField="Para\Line\Pos" HeaderText="Para\Line\Pos" />
                                    <telerik:GridBoundColumn DataField="Posn_title" HeaderText="Posn_Title" />
                                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" />
                                    <telerik:GridBoundColumn DataField="Rank" HeaderText="Rank" />
                                    <telerik:GridBoundColumn DataField="SSN" HeaderText="SSN" />
                                    <telerik:GridBoundColumn DataField="Grade" HeaderText="Grade" />
                                    <telerik:GridBoundColumn DataField="DMOS" HeaderText="Duty_Posn" />
                                    <telerik:GridBoundColumn DataField="REQCLR" HeaderText="Req Clr" />
                                    <telerik:GridBoundColumn DataField="PassPortDT" HeaderText="Pass_Port_DT" />
                                    <telerik:GridBoundColumn DataField="MobDay" HeaderText="Mob Days Cottad" />
                                    <telerik:GridBoundColumn DataField="SCTYDT" HeaderText="Scty_Dt" />
                                    <telerik:GridBoundColumn DataField="PHY_EXAM_DT" HeaderText="Phy_Exam_DT" />
                                    <telerik:GridBoundColumn DataField="MRD\ETS" HeaderText="Ets\Mrd" />
                                    <telerik:GridBoundColumn DataField="SRP_DT" HeaderText="Srp_DT" />
                                    <telerik:GridBoundColumn DataField="CLS" HeaderText="Cls Trained" />
                                    <telerik:GridBoundColumn DataField="Profile" HeaderText="P3\P4 Profile" />
                                    <telerik:GridBoundColumn DataField="Cleared" HeaderText="Mmrp|Peb|Meb Cleared" />
                                    <telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks" />
                                </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>


Maria Ilieva
Telerik team
 answered on 10 Apr 2012
1 answer
84 views
Hey guys,

I'm trying to use the Telerik Chart Control after purchasing the ASP.NET Ajax control yesterday from yourselves, but i can't seem to get the bar chart to be stacked...

Here is my code: (ASP.NET)

<telerik:RadChart ID="RadChart1" runat="server" DefaultType="StackedBar">
            <PlotArea>
                <YAxis MaxValue="300" Step="10" AutoScale="True"  AxisMode="Extended">
                </YAxis>
             
            </PlotArea>
            <Series>
                 
            </Series>
        </telerik:RadChart>

and my c#:

string sql = string.Format("...");
DataTable openLeads = db.FillTable(sql);
 
 
if (openLeads.Rows.Count > 0)
{
    RadChart1.DataSource = openLeads;
 
    foreach (DataRow row in openLeads.Rows)
    {
        ChartSeries chrtSeries = new ChartSeries {Name = row["Description"].ToString()};
        chrtSeries.Type = ChartSeriesType.StackedBar;
        RadChart1.SeriesOrientation = ChartSeriesOrientation.Vertical;
        RadChart1.Series.Add(chrtSeries);
 
    }
    RadChart1.PlotArea.XAxis.DataLabelsColumn = "UserName";
    RadChart1.DataBind();
}

my sql query produces these results:


Description                                                    Count              Username
Passed back to sales - query log                 1                      TAtest
Rejected                                                       2                     TAtest
Telesales Assigned TA                                 1                     TAtest

I want the y-axis to be 10-300 in steps of 10.. min of 10
I want the x-axis to be the username
and the count of each Description to be each bar stacked per username..

Please see attachment of what i'm currently getting..

Thanks for any help,

Regards,

Michael

Petar Marchev
Telerik team
 answered on 10 Apr 2012
1 answer
212 views
Ive added a file download fucntion to my grid, its works perfectly well on my local development machine, but when i upload it to a hosted server, it wont work !  nothing seems to happen.  In development I get the file dialoge box open in the browser, yet on the live server I dont get that, just the spinning ajax icon

heres the column in my grid

<telerik:GridAttachmentColumn
                       MaxFileSize="1048576"
                       EditFormHeaderTextFormat="Download File:"
                       HeaderText="Download"
                       
                       AttachmentKeyFields="AudioID"
                       FileNameTextField="AudioPath"
                       DataTextField="SongTitle"
                       UniqueName="AttachmentColumn">
                   </telerik:GridAttachmentColumn>

I have this in client settings

<ClientSettings>
                        <ClientEvents OnCommand="gridCommand" />
                    </ClientSettings>
  and this javascript on the page


function gridCommand(sender, args) {
               if (args.get_commandName() == "DownloadAttachment") {
                   var manager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
                   manager.set_enableAJAX(false);
 
                   setTimeout(function () {
                       manager.set_enableAJAX(true);
                   }, 0);
               }
           }
  and finally, this is the server side code

protected void RadGridAudio_ItemCommand(object source, GridCommandEventArgs e)
        {
                         
            if (e.CommandName == RadGrid.DownloadAttachmentCommandName)
            {
                e.Canceled = true;
 
                GridDownloadAttachmentCommandEventArgs args = e as GridDownloadAttachmentCommandEventArgs;
                string fileName = args.FileName;
                long attachmentId = (int)args.AttachmentKeyValues["AudioID"];
                 
                BusinessLayer.RegistrationAudio audio = new RegistrationAudio();
                audio = registrationManager.GetRegistrationAudio(attachmentId);
                string filePath = audio.AudioPath.Substring(0, audio.AudioPath.LastIndexOf(@"\"));
                string _DownloadableProductFileName = audio.FileName;
 
                if (audio.AudioPath != null && audio.FileName != null)
                {
                    System.IO.FileInfo FileName = new System.IO.FileInfo(filePath + "\\" + _DownloadableProductFileName);
                    FileStream myFile = new FileStream(filePath + "\\" + _DownloadableProductFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
 
                    try
                    {
                        if (FileName.Exists)
                        {
                            HttpContext.Current.Response.Clear();
                            HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;attachment; filename=\"" + FileName.Name + "\"");
                            HttpContext.Current.Response.AddHeader("Content-Length", FileName.Length.ToString());
                            HttpContext.Current.Response.ContentType = "application/octet-stream";
                            HttpContext.Current.Response.TransmitFile(FileName.FullName);
                            HttpContext.Current.Response.Flush();
                        }
                        else
                        {
                            throw new Exception("File not found");
                        }
                    }
                    catch (Exception ex)
                    {
                        HttpContext.Current.Response.ContentType = "text/plain";
                        HttpContext.Current.Response.Write(ex.Message);
                    }
                    finally
                    {
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                    }
                }
 
            }
        }
  can anyone see where im going wrong ?
Andrey
Telerik team
 answered on 10 Apr 2012
1 answer
116 views
Hi!

I have developed asp.net with telerik components for about 1,5 years now.

I have found out that if I create radgrid on aspx that meets the following requirements, the clientSelectColumn starts to misbehave:
 * allow paging = false
 * allow scrolling on grids clientSettings
 * add some columns, including telerik:GridClientSelectColumn
 * on client side: window.onresize = resize();  <- resize the grid to fit the page on "onload" and "onresize".
f.ex:
function resize() {
    if (grid) {
        var w = document.documentElement.clientWidth;
        var h = document.documentElement.clientHeight -100;
        grid.get_element().style.height = h + "px";
        grid.repaint();
     }
}


 * on "OnNeedDataSource" event, load so much data that you have to scroll the page to reach bottom.

 * scroll down and select a line by clicking on clientselectcolumn checkbox.
 -> with every click the pages contains are moving upwards and off from the web browsers window.

I got the same results with IE 9 and Firefox 11 (not so much offset, but it jumped a few times though).
If i set the grids height to be a static value this problem doesn't show up.
Andrey
Telerik team
 answered on 10 Apr 2012
7 answers
245 views
Hi,

I'd like to create a simple grid with one column not from a database.
And, I'd like to add rows to this grid each time a button is clicked, with the value of a combobox.
I can't do that, it doesnt works.
I'm a beginner, could you please tell me how to make that?

Thanks
Caro
Top achievements
Rank 1
 answered on 10 Apr 2012
4 answers
341 views
Is it possible to have an image upload control in the insert / update templates? I have a grid i am using to edit / insert sections of a site that includes images and text.

Thanks.
Antonio Stoilkov
Telerik team
 answered on 10 Apr 2012
1 answer
737 views
I want to change the text displayed on a rad grid based on the current text it had
here is the code-behind in C#
EXAMPLE A
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
 
                //Edits the text value of the column "Flow"
                if (dataItem["Flow"].Text == "1")
                {
                    dataItem["Flow"].Text = "Outcome";
                }
                if (dataItem["Flow"].Text == "2")
                {
                    dataItem["Flow"].Text = "Income";
                }
            }
        }

An awkward workaround I found is to use a hidden column replica like this
EXAMPLE B
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
 
                //Edits the text value of the column "Flow"
                if (dataItem["FlowReplica"].Text == "1")
                {
                    dataItem["Flow"].Text = "Outcome";
                }
                if (dataItem["FlowReplica"].Text == "2")
                {
                    dataItem["Flow"].Text = "Income";
                }
            }
        }

This works nice, but not so nice when you are working with over 10 columns
that would make 10 more hidden replicas
Is there another way to make it work as I desired in the EXAMPLE A
thanks in advance
Princy
Top achievements
Rank 2
 answered on 10 Apr 2012
1 answer
77 views
I have clicked edit button of an item(Radgrid).

Now the particular row is in edit mode.

When i click the submit button.It should prompt me to save the edited row.

How can i achieve it.
Princy
Top achievements
Rank 2
 answered on 10 Apr 2012
3 answers
136 views
Hi, I need to personalizate the view for each element to show on the grid.

how can i make it?

I can insert code in the ItemTemplate ?
I need to do something like this:

if (eval(something).ToString() != "")
{
    <span style="font-weight: bold;">Something:</span><%# Eval("something") + "%>
}

I need it, because every row could have some empty column on it and I should not show the information about that column.

Shinu
Top achievements
Rank 2
 answered on 10 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?