Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
150 views
I have used radrotator in which i have bounded images from the database. The rotator works fine. But I need a functionality to change the rotator item from javascript. The control works fine. The problem is suppose i load four images from the database in the javascript it only shows the first image. The code i had used is:


The function ChangeRotatorItem is called on button click.

 function ChangeRotatorItem(id)
        {
           
         
         
    
         
          var rotator = window["<%= RadRotator1.ClientID %>"];
           
           
            rotator.StopRotator();
         
            var result=ClickHandler.GetImageInfoForPage(TemplateId,id);
            var myDataTable=result.value;
                      

            RemoveAllRotatorItem();
           
            if(typeof(rotator) != "undefined")
             {
           
                var tbl = document.getElementById(rotator.FrameContainer.id);
               
               
                if(typeof(myDataTable)=="object")
                {
                   //Populate it..
                  
                  for(var i=0; i< myDataTable.Rows.length; i++)
                    {
                       
                        //var oCell = tbl.tBodies[0].rows[0].insertCell();
                        var oCell = document.createElement("td");
                       
                       
                        oCell.id = "PortfolioMenu1_RadRotator1_frame" + i;
                        var result = ClickHandler.GetIsAdmin();
                         if(!result.value)
                            oCell.innerHTML = "<a href=\"#\" title='Hello" + i + "' onclick='ChangeClassName(this.title);'><img src='" + myDataTable.Rows[i].Path  + "' alt='" + myDataTable.Rows[i].Rel  + "'  onclick='Hello(this.alt);' /></a>"
                         else
                            oCell.innerHTML = "<a href=\"#\" title='Hello" + i + "' onclick='ChangeClassName(this.title);'><img src='" + myDataTable.Rows[i].Path  + "' alt='" + myDataTable.Rows[i].Rel  + "'/></a>"
                        tbl.tBodies[0].rows[0].appendChild(oCell);
                       
                       
                       
                    }
                   
                   
                
                  
                }
            }
           

function RemoveAllRotatorItem()
        {
             var rotator = window["<%= RadRotator1.ClientID %>"];
            
             if(typeof(rotator) != "undefined")
             {
                 var tbl = document.getElementById(rotator.FrameContainer.id);
                
                 if(tbl.tBodies[0].rows.length>0)
                 {
                    var k = tbl.tBodies[0].rows[0].cells.length;
                   for( var i=0; i< k ; i++)
                        tbl.tBodies[0].rows[0].deleteCell(0);
                   
                 }
             }
            
           
        }
         

        }
please reply as soon as possible
maha
Top achievements
Rank 1
 answered on 22 Jun 2010
1 answer
103 views
I have a RadGrid control (Q1-2010 version), that uses the FormTemplate feature to create a custom editor.  In this template I'm using a RadUpload control that is in a standard HTML table (used for control alignment).  If the grid is set to use static headers, the table markup that the upload control lives in is given a colspan of 11, which completely ruins my layout.  If I remove the upload control, the problem goes away, so it's definitely related to that control, but it only happens if I've got static headers enabled for the RadGrid.  Is there a reason it's doing this, and is there a known fix?

Thanks.
Dimo
Telerik team
 answered on 22 Jun 2010
1 answer
106 views
Hi,

I recently bought telerik control for asp.net Ajax. when i have columns more than 500 and when doing swapping its getting stuck for both ie6 and ie7 browsers. But its working great in Firefox. How to solve this issue? Is there any way to get rid of this? Most of the customers who working on my application are using ie6 or ie7. Please help me.

Thanks

Here is My grid code.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Trackers.aspx.cs" Inherits="Trackers" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
    <link href="CSS/Forest.css" rel="stylesheet" type="text/css" /> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <style type="text/css"> 
        .rgPageFirst, .rgPagePrev, .rgPageNext, .rgPageLast 
        { 
            display: none !important; 
        } 
    </style> 
    <style type="text/css"> 
        div.RemoveBorders .rgHeader, div.RemoveBorders th.rgResizeCol, div.RemoveBorders .rgFilterRow td 
        { 
            border-width: 0 0 1px 0; /*top right bottom left*/ 
        } 
        div.RemoveBorders .rgRow td, div.RemoveBorders .rgAltRow td, div.RemoveBorders .rgEditRow td, div.RemoveBorders .rgFooter td 
        { 
            border-width: 0; 
            padding-left: 7px; /*needed for row hovering and selection*/ 
        } 
        div.RemoveBorders .rgGroupHeader td, div.RemoveBorders .rgFooter td 
        { 
            padding-left: 7px; 
        } 
    </style> 
 
    <script type="text/javascript"> 
        function onRequestStart(sender, args) { 
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 || 
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 || 
                    args.get_eventTarget().indexOf("ExportToPdfButton") >= 0 || 
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) { 
 
                args.set_enableAjax(false); 
            } 
        } 
    </script> 
 
    <div style="padding: 10px"> 
        <telerik:RadScriptManager ID="sm" runat="server"> 
        </telerik:RadScriptManager> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> 
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="gvTrackers"> 
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="gvTrackers" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"> 
        </telerik:RadAjaxLoadingPanel> 
        <telerik:RadGrid ID="gvTrackers" Skin="Forest" EnableEmbeddedSkins="true" Height="600px" 
            runat="server" AllowPaging="true" AllowSorting="True" GridLines="None" AutoGenerateColumns="true" 
            EnableHeaderContextMenu="true" EnableHeaderContextFilterMenu="true" AllowMultiRowSelection="true" 
            AllowFilteringByColumn="True" OnNeedDataSource="gvTrackers_NeedDataSource" OnItemCreated="gvTrackers_ItemCreated" 
            OnItemCommand="gvTrackers_ItemCommand" OnColumnCreated="gvTrackers_ColumnCreated"> 
            <HeaderStyle Height="25px" Width="100px" Font-Size="8pt" Font-Bold="True" ForeColor="White" 
                HorizontalAlign="Center" BorderColor="white" BorderWidth="1px" /> 
            <ExportSettings IgnorePaging="true" ExportOnlyData="true"> 
                <Pdf AllowModify="false" AllowPrinting="true" PageWidth="16in" /> 
            </ExportSettings> 
            <MasterTableView AllowMultiColumnSorting="true" CommandItemDisplay="Top"> 
                <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true" 
                    ShowExportToCsvButton="true" ShowExportToPdfButton="true" ShowAddNewRecordButton="false" /> 
            </MasterTableView> 
            <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True"> 
                <Scrolling AllowScroll="true" EnableVirtualScrollPaging="false" UseStaticHeaders="true" /> 
                <Selecting AllowRowSelect="True"></Selecting> 
                <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True" 
                    ResizeGridOnColumnResize="False"></Resizing> 
            </ClientSettings> 
            <GroupingSettings ShowUnGroupButton="true" /> 
            <PagerStyle Mode="NextPrevAndNumeric" HorizontalAlign="Right" Font-Bold="true" AlwaysVisible="true" /> 
        </telerik:RadGrid> 
    </div> 
    </form> 
</body> 
</html> 
 

.CS code

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Data; 
using System.IO; 
using Telerik.Web.UI; 
public partial class Trackers : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        try 
        { 
            if (!IsPostBack) 
            { 
                bindGrid(); 
            } 
        } 
        catch (Exception ex) 
        { 
            throw ex; 
 
        } 
    } 
 
    protected void gvTrackers_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    { 
        bindGrid(); 
    } 
 
    private void bindGrid() 
    { 
       if (Request.QueryString.Count > 0) 
           { 
               DBLayer clsObj = new DBLayer(); 
               DataTable dt = new DataTable(); 
               DataSet dsRes = new DataSet(); 
               string strQry = Request.QueryString[0].ToString(); 
               if(strQry=="1") 
                   dsRes = clsObj.ExecuteDatasetSql("usp_CarrierTracker"); 
               else if (strQry == "2") 
                   dsRes = clsObj.ExecuteDatasetSql("usp_RejectRescheduleHistory"); 
               else if (strQry == "3") 
                   dsRes = clsObj.ExecuteDatasetSql("usp_ActualPlanTestDate"); 
               else if (strQry == "4") 
                   dsRes = clsObj.ExecuteDatasetSql("usp_billing_ckt_report"); 
               else if (strQry == "5") 
                   dsRes = clsObj.ExecuteDatasetSql("usp_ReadyandCompeletetask"); 
               else if (strQry == "6") 
                   dsRes = clsObj.ExecuteDatasetSql("usp_TTUNotes"); 
 
               gvTrackers.DataSource = dsRes; 
               //gvTrackers.DataBind(); 
           } 
    } 
 
    protected void gvTrackers_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridPagerItem) 
        { 
            RadComboBox combo = (e.Item as GridPagerItem).FindControl("PageSizeComboBox") as RadComboBox; 
 
            // The number of items shown when all is selected  
            int allRowsCount = int.MaxValue; 
 
            // Remove duplicates  
            RadComboBoxItem duplicate = combo.Items.FindItemByValue(allRowsCount.ToString()); 
            if (duplicate != null) 
            { 
                duplicate.Remove(); 
            } 
 
            // Create a new item for showing all  
            RadComboBoxItem item = new RadComboBoxItem("All", allRowsCount.ToString()); 
            item.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID); 
            combo.Items.Add(item); 
 
            // Set the current pagesize as the selected value  
            combo.Items.FindItemByValue(gvTrackers.PageSize.ToString()).Selected = true; 
        } 
    } 
 
    protected void gvTrackers_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) 
    { 
        //if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName || 
        //    e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName || 
        //    e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName || 
        //    e.CommandName == Telerik.Web.UI.RadGrid.ExportToPdfCommandName) 
        //{ 
        //    ConfigureExport(); 
        //} 
    } 
 
    protected void gvTrackers_ColumnCreated(object sender, GridColumnCreatedEventArgs e) 
    { 
        e.Column.Groupable = false; 
 
    } 
} 
 

Dimo
Telerik team
 answered on 22 Jun 2010
3 answers
126 views
Hi Telerik,
Is there anyway to block certain days in the future, so that the user can't select them. A small code snip set or small demons project would be much appreciated
Thank you
Shinu
Top achievements
Rank 2
 answered on 22 Jun 2010
1 answer
108 views
I have 2 RadComboBox on my page. I would like to populate the second RadComboBox based on the selected item of the first RadComboBox. and based on the second RadComboBox's selection, i would then like to populate a radgrid with the results from a query that utilizes the value of the second radcombobox as a parameter.

Thanks for any help provided.
Shinu
Top achievements
Rank 2
 answered on 22 Jun 2010
8 answers
479 views
Hi

I would like to place my Export-to-Excel button within the toolbar.

This button should be defined as a synchronous postback trigger for my update panel.
The button is placed within CommandItemTemplate tags.

My problem is that the concept that has worked with other asp.net controls does not seem to work with RadGrid.

<asp:PostBackTrigger ControlID="myRadGrid$btnExport" />
In this type of declaration the error message I receive is the following:

A control with ID 'myRadGrid$btnExport' could not be found for the trigger in UpdatePanel 'UpdatePanel1'.


Can you please give me some suggestion?
Daniel
Telerik team
 answered on 21 Jun 2010
3 answers
163 views
Hi

I'm trying to get the rotator to automatically advance after a postback to the viewport items where the item was clicked.  For the most part, it's working well, but I'm trying to set the scroll duration to zero, so it jumps to the correct viewport, then back to 500 milliseconds so that it scrolls normally.  I've set the OnItemShown event, and my javascript is:

    // Set up the scroll position  
    var currentIndex = <%= this.CurrentIndex %>;   
    var isFirstLoad = true;   
    function OnItemShown(sender, arg) {     
        if (isFirstLoad == true) { // First loading     
            isFirstLoad = false;  
            sender.set_scrollDuration(0);  
            // now scroll until currentIndex is reached  
            for (var i = 0; i < currentIndex; i++)  
            {  
                sender.showNext(Telerik.Web.UI.RotatorScrollDirection.Up);  
            }  
            sender.set_scrollDuration(500);  
        }     
    }      
 

What happens is the rotator jumps to the correct location, but if sender.showNext is called (e.g. I've jumped one or more sets of items), the scrolling animation goes away.  When I inspect the scrollDuration property, it's still set to 500 milliseconds, but scrolling is instantaneous, not animated.

Any ideas?

Thanks!
Mike
Mike Sharp
Top achievements
Rank 1
 answered on 21 Jun 2010
2 answers
629 views

I have a checkbox in my RadGrid.  If that checkbox is checked, then I change the background color for that row in RadGrid1_ItemDataBound:

Protected Sub RadGrid1_ItemDataBound(ByVal sender As System.Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        'Change the color of inactive rows
        If TypeOf e.Item Is GridDataItem Then
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            Dim chk_Status As CheckBox = DirectCast(item.FindControl("chk_Status"), CheckBox)
            If chk_Status.Checked = False Then
                e.Item.BackColor = Drawing.Color.RoyalBlue
            End If
        End If

End Sub

But if I click on any header column to sort that column, the cells in the alternating rows that are highlighted are not highlighted in the background color I specified. 

Richard M
Top achievements
Rank 1
 answered on 21 Jun 2010
3 answers
280 views
I am trying to use a GridDropDownColumn in my RadGrid, using InPlace editing. I have a GridDropDownColumn, which is linked to a User Table via business objects. I can view existing records, and update existing records. However, when I try to insert a new record, I get the catch-all 500 javascript error. I suspect it is missing the bindings when it tries to create the insert form.

I replaced the drop down with a bound column, using the user id (int) as the value, and the insert (and update) works, so I have isolated the issue to the drop down.

I have tried to code a Template column, but I am not good with binding data, so I am not getting the right data to display in the item template label or binding the correct user in the EditItemTemplate value. Also, on the update/insert step the user id is dropped from the values so i can't get that field when it returns to the InsertCommand (or UpdateCommand) method. I have tried populating the drop down in the ItemCreated method, and the ItemDataBound method.

I can post some code, but I was just wondering if someone had an example of a situation like this they can point me to. I have also used user edit forms, and I can come up with that solution also.

Thanks in advance for any insight.
Jay Anderson
Top achievements
Rank 1
 answered on 21 Jun 2010
2 answers
56 views
Hello,

We have a project that uses a conditional IE7 stylesheet that contains a few styles for compatability.    We are also using RadGrid with automatic updates.  The problem we've encountered is that the IE7 stylesheet is being applied when we "Edit" a record in IE8.  We are using 2010 Q1 (2010.1.415.35).   Has anyone encountered this?

Thanks,
Larry
Larry
Top achievements
Rank 1
 answered on 21 Jun 2010
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?