Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
274 views

I have a page with one radgrid on it.  This page contains different sets of columns depending on how the user gets to the page.  In all cases the grid offers Grouping.  Since I cannot declare the columns ahead of time and I allow the user to group by whatever he/she chooses, how can i get specific columns to show aggregates in the group footers when grouping is active?

I can get footers to contain text by doing something simple like:

    Protected Sub Radgrid_ItemDataBound(ByVal source As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
        If TypeOf e.Item Is GridGroupFooterItem Then  
            Dim footer As GridGroupFooterItem = e.Item  
            Try  
                footer("ReworkCosts").Text = "Sum of Rework Costs: $" 
            Catch ex As Exception  
            End Try  
            Try  
                footer("MaterialCosts").Text = "Sum of Material Costs: $" 
            Catch ex As Exception  
            End Try  
            Try  
                footer("ScrapCosts").Text = "Sum of Scrap Costs: $" 
            Catch ex As Exception  
            End Try  
            Try  
                footer("DefectCosts").Text = "Sum of Defect Costs: $" 
            Catch ex As Exception  
            End Try  
            Try  
                footer("QNote").Text = "Count of Qnotes: " 
            Catch ex As Exception  
            End Try  
            Try  
                footer("MRCs").Text = "Count of MRCs: " 
            Catch ex As Exception  
            End Try  
            Try  
                footer("SCARs").Text = "Count of SCARs: " 
            Catch ex As Exception  
            End Try  
        End If  
    End Sub 

...but I don't know how to access all of the items in a specific column of that group so that I can add/count them and concatenate themm to the end of my string.

Any recommendations?

I am using VB.NET, .NET 3.5

Shinu
Top achievements
Rank 2
 answered on 05 Jun 2010
1 answer
67 views
So what I'm trying to do should be very basic, but seems unnecessarily difficult with the radgrid. All I am doing is binding the grid server-side, and need to conditionally set a column to "readonly" if certain criteria is met by the item's dataitem. So my question is how do you set a single item's column to readonly in the ItemDataBound event?

protected void gridFavorites_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item.DataItem != null
        { 
            IFavorite fav = (IFavorite)e.Item.DataItem; 
            if (fav.CmsPageId == Guid.Empty) 
                // Where to go from here to set readonly=true? 
        } 
    } 

Shinu
Top achievements
Rank 2
 answered on 05 Jun 2010
4 answers
317 views
Hey all,

I want to use a radgrid without a data source, just to be able to for my customers to enter in line items for creating invoices.  I want it to be able to add rows by using ajax, and then loop through after the data entry and insert to my sql db... i cant seem to figure out how to use the grid by default to be a data entry form rather than a data display form.
Elliott
Top achievements
Rank 2
 answered on 04 Jun 2010
4 answers
153 views
Hi

Is there a way to set the display of a grid row to look as if it is selected without using set_selected()?

I have a grid which I am populating on the client.  When the user selects a row, I am populating other controls via a RadAjaxPanel (therefore a postback).  When the control finishes the postback, the row is no longer selected, so I am storing the index of the row that was selected and during the RadAjaxPanel_OnResponseEnd, I am attempting to reselect the row using set_selected.  Works great, except that that fires the event which is causing an indefinite loop of postbacks.

I was hoping that there is a way on the client to set the style of the row to look selected without using set_selected(), hopefully avoiding the problem described above.

This gets me my selectedrow (on the client)
$find("<%= grdEntityAttributes.ClientID %>").get_masterTableView().get_dataItems()[document.getElementById("selectedRow").value] 

Any ideas?
Michael Pullella
Top achievements
Rank 1
 answered on 04 Jun 2010
2 answers
210 views
Hi,

I have a RadGrid with an Hyperlink column that when clicked opens a new IExplorer window that shows a web page with information related to the row.

I want to control what the new opened IExplorer window shows. Like hide the menu bar, status bar, enable/disable resizing and the like.

I understand that the way to go is using javascript function window.open(). Now since I am using the RadGrid Hyperlink column with the property "Target= _blank",  my question is:

Where I suppoese  to inser the javascript string to call the new window set up as I want it?
or
Is there any other method or best practice to accomplish this in the context of Telerik RadGrid component?

Any advice would be appreciated.
Willy Vidable
Top achievements
Rank 1
 answered on 04 Jun 2010
5 answers
253 views

Hi There,
I've upgrade my project to Microsoft Enterprise Library 5.0 (former version was 4.1) but I got a runtime error when the Rad Grid is binding.
My code is something like below:

public static IDataReader GetAllOrders()   
{  
    SqlDatabase db = new SqlDatabase(connString);   
    return db.ExecuteReader("Orders_GetAll");   
}  
 
protected void Page_Load(object sender, EventArgs e)   
{  
    shopGrid.DataSource = DataProvider.GetAllShopOrders();   
    shopGrid.DataBind();  
}  
 

 

 

 

 

End I get this error:
Data source is an invalid type.  It must be either an IListSource, IEnumerable, or IDataSource.

I didn't have this problem with Microsoft Enterprise Library 4.1 or lower.

 

 

 

 

marcelo perez
Top achievements
Rank 1
 answered on 04 Jun 2010
0 answers
62 views
this little piece of code is make in jQuery, for put a default text in filter column, when filter got focus, the text empty.
$(document).ready( function() 
        { 
            var filtros = $("input[class='rgFilterBox']"); 
             
            if(filtros.length > 0) 
            { 
                var textoFiltro = document.getElementById("<%= hdFiltro.ClientID %>").value; // Text show
                for(var i=0; i<filtros.length; i++) 
                { 
                    if(filtros[i].value == ""
                    { 
                        filtros[i].value = textoFiltro; 
                        filtros[i].style.color = "#d6d6d6"
                    } 
                     
                    filtros[i].onfocus = function() { 
                        if(this.value==textoFiltro)  
                        { 
                            this.value = ""
                            this.style.color = "black"
                        } 
                    } 
                 
                    filtros[i].onblur = function() { 
                        if(this.value == ""
                        { 
                            this.value = textoFiltro; 
                            this.style.color = "#d6d6d6"
                        } 
                    } 
                } 
            } 
         }); 
Sorry, my english is poor,

Happy coding.

GDEx
Francisco Gonzalez
Top achievements
Rank 1
 asked on 04 Jun 2010
6 answers
258 views
Hi.

I have a user control which has a repeater. Each row of the repeater has three columns containing a control each

1st column - ASP label control
2nd column - Rad Combo Box
3rd column - Rad Text Box

This user control has a public property that accepts the data to be bound to the repeater control.

I want to achieve the following.

On the main web page, on a click of button, using a web service i want to get the HTML content of the above user control.

In web service, I create an instance of Page, dynamically load the above user control, add it to the page, get the HTML of page
and send that HTML as a string to the requesting web page.

The above thing works if I don't have Rad Controls in the user control. If I use generic HTML controls or asp controls (that don't require scriptmanager) it works perfectly fine. But there are Rad Controls, when I try to get the HTML of the page by calling RenderControl I get an error saying 'ScriptManager' needs to be present.

Is there an alternate way to circumvent the problem?

Thanks.
Abhay Jain
Top achievements
Rank 1
 answered on 04 Jun 2010
1 answer
329 views

Hi,

I am creating windows dynamically based on the settings I retrieve from database. Need to add some custom properties to the RadWindows so that I can use them while rendering to make decissions, like whether to show it in the minimized mode after its visible(because I've many rad windows popping up on the screen). Attributes which will drive the minimum width and height of the windows, which I'll use in the resize event of the RadWindows.

I've a code sample here, kindly help me understand how I can do this.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
 
<!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>  
    <script type="text/javascript">  
        function WindowCreatedAndShowed(sender, args) {  
            if (sender.isMinimized == "True") {  
                sender.hide();  
            }  
        }  
    </script> 
</head> 
<body> 
    <form id="form1" runat="server">      
    <telerik:RadWindowManager ShowOnTopWhenMaximized="false" Width="100%" Height="100%" 
        OnClientActivate="OnClientActivate" OnClientClose="OnClientClose" Behaviors="Close,Maximize,Minimize,Move,Reload,Resize" 
        OnClientCommand="OnClientCommand" ID="DBRadWindowManager" RestrictionZoneID="RestrictionZone" 
        runat="server" Skin="Telerik" OnClientPageLoad="WindowCreatedAndShowed" OnClientResize="OnClientResize">          
    </telerik:RadWindowManager> 
    </form> 
</body> 
</html> 
 

Code Behind:

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using Telerik.Web.UI;  
 
namespace WebApplication2  
{  
    public partial class _Default : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!Page.IsPostBack)  
            {  
                try 
                {  
                    //Get the currently logged in user's Tab-Widgets collection  
                    List<Tab> objTabsCollection = GetUserTabsWidgetsCollection(); //Gets the data  
 
                    if (objTabsCollection != null && objTabsCollection.Count > 0)  
                    {  
                        int tabCounter = 1;  
                        //Loop through all the Tabs the user is authorized to view, add the Tabs to the MainTabStrip,  
                        //Add PageView to each of the Main tab, Add TabStrip to each of the PageView (Widget level Tabstrip),  
                        //Add Widgets to the WindowManager collection to add the association with the widget tabstrip  
                        foreach (Tab objEntityMainTab in objTabsCollection)  
                        {  
                            //If it is the first tab, then make widgets visible, set the tab to the selected tab and  
                            //set the PageView of the tab to selected.  
                            if (tabCounter++ == 1)  
                            {  
                                //Add widgets associated with the Main tab  
                                AddWidgetsForEachMainTab(objEntityMainTab, true);  
                            }  
                            else 
                            {  
                                AddWidgetsForEachMainTab(objEntityMainTab, false);  
                            }  
                        }  
                    }  
                    else 
                    {  
                        Server.Transfer(string.Format("{0}Item=You are not authorized to view any pages in this application.", UnauthorizedPagePath));  
                    }  
                }                  
                catch (Exception ex)  
                {  
                    //Exception Handling  
                }  
            }  
        }  
 
        /// <summary>  
        /// Adds the Widgets associated with given Main tab  
        /// </summary>  
        /// <param name="objUIMainTab">Main tab for which the associated widgets need to be added</param>  
        /// <param name="objEntityMainTab">Entity Tab object that consists of the Widgets information for the Main tab</param>  
        /// <param name="isWidgetVisible">Tells if the widgets needs to be visible on initial page load</param>  
        private void AddWidgetsForEachMainTab(Tab objEntityMainTab, bool isWidgetVisible)  
        {  
            short tabIndex = 1;  
            //Create Tab & associated RadWindows for each of the sub tab in the Main tab  
            foreach (Widget objWidget in objEntityMainTab.Widgets)  
            {  
                //Create RadWindow for the Tab  
                RadWindow objTabWindow = new RadWindow();  
 
                objTabWindow.ID = objWidget.Widget_Name.ToUpper() + "_WINDOW";  
                objTabWindow.VisibleOnPageLoad = true;  
                objTabWindow.TabIndex = tabIndex++;  
                objTabWindow.BorderStyle = BorderStyle.None;  
                objTabWindow.Behaviors = WindowBehaviors.Default;  
                objTabWindow.Height = Unit.Pixel(objWidget.Initial_Height);  
                objTabWindow.InitialBehaviors = WindowBehaviors.None;  
                objTabWindow.Left = Unit.Pixel(objWidget.Widget_Left);  
                objTabWindow.ReloadOnShow = true;  
                objTabWindow.Skin = "Telerik";  
                objTabWindow.Title = objWidget.Widget_Name;  
                objTabWindow.Top = Unit.Pixel(objWidget.Widget_Top);  
                objTabWindow.Width = Unit.Pixel(objWidget.Initial_Width);  
                objTabWindow.IconUrl = "~/images/bg-header-widget.gif";  
                objTabWindow.NavigateUrl = objWidget.Widget_NavigateURL;  
                objTabWindow.Behaviors = WindowBehaviors.Minimize | WindowBehaviors.Maximize | WindowBehaviors.Move | WindowBehaviors.Reload | WindowBehaviors.Resize;  
                objTabWindow.KeepInScreenBounds = true;  
                objTabWindow.VisibleOnPageLoad = isWidgetVisible;  
                objTabWindow.Visible = true;  
                objTabWindow.VisibleStatusbar = false;  
                //Attributes for the Minimum Height and Width for each of the widgets   
                //along with the value if the widgets needs to be in minimized state while loading  
                objTabWindow.Attributes.Add("isMinimized", objWidget.IsMinimized ? Boolean.FalseString : Boolean.TrueString);  
                objTabWindow.Attributes.Add("MinimunHeight", Convert.ToString(objWidget.Minimum_Height));  
                objTabWindow.Attributes.Add("MinimunWidth", Convert.ToString(objWidget.Minimum_Width));  
                //Add the newly created RadWindow to the RadWindowManager  
                DBRadWindowManager.Windows.Add(objTabWindow);  
            }  
        }  
    }  
 
    //Tab & Widget classes definition  
    public class Tab  
    {  
        public int Tab_Id { getset; }  
        public string TabName { getset; }  
        public string CreateID { getset; }          
 
        public List<Widget> Widgets { getset; }  
    }  
 
    public class Widget  
    {  
        public int Widget_Id {get;set;}  
 
        public string Widget_Name {get;set;}  
 
        public string Widget_NavigateURL {get;set;}  
 
        public bool IsMinimized {get;set;}  
 
        public int Widget_Left {get;set;}  
 
        public int Widget_Top {get;set;}  
 
        public int Initial_Height {get;set;}  
 
        public int Initial_Width {get;set;}  
 
        public int Minimum_Width {get;set;}  
 
        public int Minimum_Height {get;set;}  
    }  
}  
 
Petio Petkov
Telerik team
 answered on 04 Jun 2010
1 answer
44 views
It only supports document linking.

Kindly include image link where in the dialog, you can select the image file to link.

Other editors have this functionality, but RadEditor lacks.

Thank you.
Rumen
Telerik team
 answered on 04 Jun 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?