Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
61 views
:)
Magnus
Top achievements
Rank 2
 answered on 18 May 2011
6 answers
486 views
I receive a "Invalid group by expression: Group By clause missing" when grouping a GridTemplateColumn. However, if I set that same column as a GridBoundColumn, grouping works correctly. Also, if I set the GridTemplateColumn to be grouped by default the GroupByExpressions collection, it is grouped properly, but then if I remove the grouping and drag the column to be grouped again, it fails with the same error.

If I remove the GroupByExpression from the GridTemplateColumn definition and try to group by dragging, I get a "Telerik.Web.UI.GridGroupByException: Expression cannot be null or empty" error.

GridBoundColumn definition that works:

<

 

 

telerik:GridBoundColumn

 

 

 

UniqueName="School1"

 

 

 

SortExpression="School"

 

 

 

DataField="School"

 

 

 

HeaderText="School"

 

 

 

AllowFiltering="true"

 

 

 

Groupable="true"

 

 

 

HeaderStyle-Width="75"

 

 

 

ItemStyle-Width="75"

 

 

 

FooterStyle-Width="75"/>

 


GridTemplateColumn defination that fails (with GroupByExpression="School" I get "Invalid group by expression: Group By clause missing" and without it I get "Telerik.Web.UI.GridGroupByException: Expression cannot be null or empty":

<

 

 

telerik:GridTemplateColumn

 

 

 

UniqueName="School2"

 

 

 

SortExpression="School"

 

 

 

DataField="School"

 

 

 

HeaderText="School"

 

 

 

AllowFiltering="true"

 

 

 

Groupable="true"

 

 

 

HeaderStyle-Width="75"

 

 

 

ItemStyle-Width="75"

 

 

 

FooterStyle-Width="75">

 

 

 

<ItemTemplate>

 

<%

 

# Eval("School") %>

 

 

 

</ItemTemplate>
</telerik:GridTemplateColumn>

 


Dave
Top achievements
Rank 1
 answered on 18 May 2011
2 answers
130 views
I have a RadGrid with serveral columns.  The columns that are not GridBoundColumns group fine.  However, my GridTemplateColumns are throwing errors when a user tries to group by them.

I am using Telerick Web.UI version 2008.3.1105.35

Sample code which is breaking
<telerik:GridTemplateColumn DataField="STATUS" HeaderText="Status" 
                        ItemStyle-HorizontalAlign="center" SortExpression="STATUS">  
    <ItemTemplate> 
        <asp:Label ID="LabelStatus" runat="server" /> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 

I have two rows to test and neither column has empty data but it still throws this alert.

JS Error:
Sys.WebForms.PageRequestManagerServerErrorException: Expression cannot be null or empty

.NET Error:
cannot be null or empty at Telerik.Web.UI.GridGroupByExpression.SetExpression(String expression) at Telerik.Web.UI.GridGroupByExpression..ctor(GridColumn column) at Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.status_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Dave
Top achievements
Rank 1
 answered on 18 May 2011
0 answers
107 views
We  are trying to upload a file from a RadEditPopup which is opened from a Radgrid control. However, we could not get the file name from the RadUpload control. The RadUpload control returns a null value for the file name (it works properly when the control sits on a stand-alone page as in your web-demo for this control).  For your reference, I have  pasted code below which demonstrates the problem we are experiencing. Your prompt attention to this issue would be greatly appreciated. Thank you for your time, and we look forward to hearing from Telerik Support very soon.

ASPX Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI, Version=2009.3.1103.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<head>
 
    <script language="javascript">  
    </script>
 
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadGrid ID="RadFormsLibrary" runat="server" AutoGenerateColumns="false"
            Skin="Vista" EnableLinqExpressions="false" Width="100%"
            OnNeedDataSource="RadFormsLibrary_NeedDataSource"
            onupdatecommand="RadFormsLibrary_UpdateCommand">
            <MasterTableView TableLayout="Fixed" Name="Forms" GroupLoadMode="Client" EditMode="PopUp"
                AllowSorting="true" AllowMultiColumnSorting="True">
                <HeaderStyle CssClass="HeaderStyle" />
                <ItemStyle CssClass="ItemStyle" />
                <AlternatingItemStyle CssClass="AlternatingItemStyle" />
                <NoRecordsTemplate>
                    <div style="background-color: Silver; height: 20px; color: Red; text-align: center;
                        font-size: 10pt; font-family: Verdana; font-weight: bold;">
                        <i>No forms defined for this application.</i>
                    </div>
                </NoRecordsTemplate>
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="Options" AllowFiltering="false" Reorderable="false"
                        Groupable="false" UniqueName="Options" HeaderStyle-Width="6%">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkEdit" CommandName="Edit" Text="Edit" runat="server"></asp:LinkButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="EID" DataField="EID" UniqueName="EID" HeaderStyle-Width="7%">
                        <ItemTemplate>
                            <asp:Label ID="lblJuris" ToolTip='<%# Eval("EID") %>' runat="server"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <EditFormSettings EditFormType="Template">
                    <PopUpSettings ScrollBars="Auto" Modal="true" />
                    <FormTemplate>
                        <telerik:RadUpload ID="RUPhoto" runat="server" ControlObjectsVisibility="None" AllowedFileExtensions=".jpg,.jpeg"
                            Skin="Office2007">
                        </telerik:RadUpload>
                         <asp:Button ID="btnUpdate" runat="server" Text="Submit" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />
                    </FormTemplate>
                </EditFormSettings>
            </MasterTableView>
        </telerik:RadGrid>      
    </div>
    </form>
</body>
</html>


Code Behind 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 Telerik.Web.UI;
 
public partial class Default4 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void Button1_Click(object sender, EventArgs e)
    {
        string fileName = RUPhoto.UploadedFiles[0].FileName;
        Response.Write(fileName);
    }
 
 
    public DataTable GetData()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("EID");
 
        for(int i=0;i<=5;i++)
        {
            DataRow dr = dt.NewRow();
            dr[0]=i;
            dt.Rows.Add(dr);
        }
        return dt;
    }
    protected void RadFormsLibrary_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        DataTable dt=GetData();
        RadFormsLibrary.DataSource = dt;
    }
    protected void RadFormsLibrary_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        RadUpload rdFileName = e.Item.FindControl("dlFileName") as RadUpload;
        string fileName = rdFileName.UploadedFiles[0].FileName;
    }
}
    

John John
Top achievements
Rank 1
 asked on 18 May 2011
2 answers
88 views
Possibly.

When I started work on my current project, there were some nasty bits of code. One of them was a banner used on the page. It was decided to replace it with something more in keeping with style of the RadControls and something that was, ideally, skinnable.

I decided to have a bit of a go at cheating. I liked the layout of the title bar of the RadWindow and it fitted our requirements very nicely. So, I recreated the RadWindow title bar from the rendered HTML and came up with my PageBanner control. Clipboard1.gif shows what it looks like (using the Hay skin).

The code looks like this ...

<asp:Panel ID="Panel1"
           runat="server" CssClass="RadWindow">
  <asp:Table ID="Table1"
             runat="server"
             Width="100%"
             CellPadding="0"
             CellSpacing="0">
    <asp:TableRow runat="server"
                  CssClass="rwTitleRow">
      <asp:TableCell runat="server"
                     ID="Cell1"
                     CssClass="rwTitlebar"
                     Width="10px">
          
      </asp:TableCell>
      <asp:TableCell runat="server"
                     ID="Cell2"
                     CssClass="rwTitlebar">
        <asp:Panel ID="Panel2"
                   runat="server"
                   CssClass="rwTopResize">
        </asp:Panel>
        <asp:Table ID="Table2"
                   runat="server"
                   CssClass="rwTitlebarControls"
                   CellPadding="0"
                   CellSpacing="0"
                   HorizontalAlign="Left">
          <asp:TableRow runat="server"
                        ID="InnerRow1">
            <asp:TableCell runat="server"
                           ID="InnerCell1"
                           Width="16px"
                           Style="vertical-align: top !important;">
              <asp:HyperLink ID="HyperLink1"
                             runat="server"
                             CssClass="rwIcon"></asp:HyperLink>
            </asp:TableCell>
            <asp:TableCell runat="server" VerticalAlign="Bottom">
              <asp:Label ID="UEAPLBannerTitleText"
                         runat="server"></asp:Label>
            </asp:TableCell>
            <asp:TableCell runat="server"
                           ID="SkinPickerContainer"
                           Style="width: 40px;">
              
            </asp:TableCell>
            <asp:TableCell Style="width: 100px;">
   
                <telerik:RadSkinManager ID="RadSkinManager1" runat="server"
                                        OnPreRender="RadSkinManager1_PreRender">
                </telerik:RadSkinManager>
   
            </asp:TableCell>
            <asp:TableCell runat="server"
                           ID="InnerCell3">
              <ul class="rwControlButtons"></ul>
            </asp:TableCell>
          </asp:TableRow>
        </asp:Table>
      </asp:TableCell>
      <asp:TableCell runat="server"
                     ID="TableCell1"
                     CssClass="rwTitlebar"
                     Width="10px">
          
      </asp:TableCell>
    </asp:TableRow>
  </asp:Table>
</asp:Panel>
public partial class PageBannerBanner : System.Web.UI.UserControl
{
    /// <summary>
    ///    
    /// </summary>
    /// <remarks></remarks>
    string iconUrl;
    /// <summary>
    ///    
    /// </summary>
    /// <remarks></remarks>
    string message;
    /// <summary>
    ///    
    /// </summary>
    /// <remarks></remarks>
    string skin;
    /// <summary>
    ///    
    /// </summary>
    /// <remarks></remarks>
    string title;
    /// <summary>
    ///    
    /// </summary>
    /// <remarks></remarks>
    Unit width;
 
    /// <summary>
    /// Gets or sets the icon URL. 
    /// </summary>
    /// <value>The icon URL.</value>
    /// <remarks></remarks>
    public string IconUrl
    {
        get
        {
            return iconUrl;
        }
        set
        {
            iconUrl = value;
            HyperLink1.Style.Add(HtmlTextWriterStyle.BackgroundImage, Page.ResolveClientUrl(value));
            HyperLink1.Style.Add("background-position", "0px 0px");
        }
    }
 
    /// <summary>
    /// Gets or sets the message.  
    /// </summary>
    /// <value>The message.</value>
    /// <remarks></remarks>
    public string Message
    {
        get
        {
            return message;
        }
        set
        {
            message = value;
        }
    }
 
    /// <summary>
    /// Gets or sets the skin. 
    /// </summary>
    /// <value>The skin.</value>
    /// <remarks></remarks>
    public string Skin
    {
        get
        {
            return skin;
        }
        set
        {
            skin = value;
            Panel1.CssClass = String.Format("RadWindow RadWindow_{0} rwNormalWindow rwTransparentWindow", value);
        }
    }
 
    public RadSkinManager SkinManager
    {
        get
        {
            return RadSkinManager1;
        }
    }
 
    /// <summary>
    /// Gets or sets the title.
    /// </summary>
    /// <value>The title.</value>
    /// <remarks></remarks>
    public string Title
    {
        get
        {
            return title;
        }
        set
        {
            title = value;
        }
    }
 
    /// <summary>
    /// Gets or sets the width.
    /// </summary>
    /// <value>The width.</value>
    /// <remarks></remarks>
    public Unit Width
    {
        get
        {
            return width;
        }
        set
        {
            width = value;
            Panel1.Width = value;
        }
    }
 
    bool allowDefaultSkinOverride
    {
        get
        {
            object o = ViewState[GlobalConstants.ViewState.ALLOWDEFAULTSKINUSEROVERRIDE];
            if (o == null)
            {
                string s = System.Configuration.ConfigurationManager.AppSettings[GlobalConstants.Controls.SkinManger.WEBCONFIGKEY];
                if (String.IsNullOrEmpty(s))
                {
                    o = false;
                }
                else
                {
                    o = s.ToLower().StartsWith("t");
                }
                ViewState[GlobalConstants.ViewState.ALLOWDEFAULTSKINUSEROVERRIDE] = o;
            }
            return (bool)o;
        }
    }
 
    /// <summary>
    /// Raises the <see cref="E:Load" /> event.
    /// </summary>
    /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
    /// <remarks></remarks>
    protected override void OnLoad(EventArgs e)
    {
        if (!allowDefaultSkinOverride)
        {
            RadSkinManager1.Skin = GlobalFunctions.GetDefaultSkin();
        }
        SetSkinChooser(allowDefaultSkinOverride);
        base.OnLoad(e);
    }
 
    /// <summary>
    /// Raises the <see cref="E:PreRender" /> event.   
    /// </summary>
    /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
    /// <remarks></remarks>
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        PageBannerTitleText.Text = String.Format("<em>{0} {1}<em>", title, message);
 
        LoadLocalSkinStylesheets(RadSkinManager1.Skin);
        Panel1.CssClass = String.Format("RadWindow RadWindow_{0}", RadSkinManager1.Skin);
    }
 
    protected void RadSkinManager1_PreRender(object sender, EventArgs e)
    {
        if (RadSkinManager1.ShowChooser)
        {
            RadComboBox skinChooser = RadSkinManager1.FindControl("SkinChooser") as RadComboBox;
            AvailableSkinCollection skins = GlobalFunctions.GetSkins();
            int i = 0;
            while (i < skinChooser.Items.Count)
            {
                if (!skins.Contains(skinChooser.Items[i].Text))
                {
                    skinChooser.Items.Remove(skinChooser.Items[i]);
                }
                i++;
            }
            foreach (AvailableSkin skin in skins.Where(s => !s.IsEmbedded))
            {
                skinChooser.Items.Add(new RadComboBoxItem(skin.Name));
            }
        }
    }
 
    void LoadLocalSkinStylesheets(string SkinName)
    {
        string cssFileName = String.Format("~/StyleSheets/Local/Local_{0}.css", SkinName);
        HtmlLink css = new HtmlLink();
        css.Href = Page.ResolveUrl(cssFileName);
        css.Attributes["rel"] = "stylesheet";
        css.Attributes["type"] = "text/css";
        css.Attributes["media"] = "all";
        Page.Header.Controls.Add(css);
    }
 
    void SetSkinChooser(bool Value)
    {
        SkinPickerContainer.Text = String.Format("<em>{0}<em>", "Style:");
        SkinPickerContainer.Visible = Value;
        RadSkinManager1.ShowChooser = Value;
        RadSkinManager1.PersistenceMode = RadSkinManager1.ShowChooser ? RadSkinManagerPersistenceMode.Cookie : RadSkinManagerPersistenceMode.Session;
    }
}

I have to say that I'm rather pleased with it in all but one regard; It looks pants in IE7 and IE8 Compatibility Mode. Clipboard2.gif shows it using the same skin in IE8 Compatibility Mode.

Clearly there is something different about how IE7 works and I've tried to figure out what exactly is going on, but to no avail. I did think that there might be an IE7 hack in the CSS but if there is, I can't find it.

Can anyone offer any suggestions?

-- 
Stuart
Stuart Hemming
Top achievements
Rank 2
 answered on 18 May 2011
5 answers
507 views
Hi, i have a RadGrid with checkbox like this
<telerik:GridTemplateColumn UniqueName="Assigned" >
                            <ItemTemplate>
                                
                                <telerik:RadButton ID="checkAssigned" runat="server" ToggleType="CheckBox" ButtonType="ToggleButton" AutoPostBack="false" Skin="Forest" EnableEmbeddedSkins="true" EnableEmbeddedBaseStylesheet="true" >
                                    <ToggleStates>
                                        <telerik:RadButtonToggleState PrimaryIconCssClass="rbToggleCheckboxChecked" Selected="true" />
                                        <telerik:RadButtonToggleState PrimaryIconCssClass="rbToggleCheckbox" />
                                    </ToggleStates>
                                </telerik:RadButton>
                            </ItemTemplate>
                            <ItemStyle Width="50px" />
                        </telerik:GridTemplateColumn>
I need a javascript function to select/deselect all the checkboxes in the grid. How can I do this?
Thanks
Martin
Top achievements
Rank 1
 answered on 18 May 2011
1 answer
42 views
Hi,

I am using Tab Strip in splitter. in Tab strip there is on demand load tab. in all tabs there are user controls. in user control clicking on any control gives JS error, Null or undefined.

Looking forward to your response
Helen
Telerik team
 answered on 18 May 2011
5 answers
142 views
I have an instance of a RadGrid on my page with hierarchical data.  Exporting to Excel or Word works wonderfully.  However, exporting to CSV results in only the MasterTableView data being exported.  Any clues?

If anyone is thinking of suggesting I expand all of my MasterTableView items by default, please don't.  As I said, it works for Excel and Word, so this is not the problem.

Thank you in advance!
Phil
Top achievements
Rank 2
 answered on 18 May 2011
5 answers
189 views
Hi
I have my grids set to numericpages and i am hiding the pagesize drop-down etc.

On the left is the pages.. 1,2,3...
and on the far right is "Page 1 of 2, items 1 to 200 of 202"

I'm sure this is a simple question, but... How do i align the "Page 1 of 2,..." after the pages, on the left ?
Also, is it possible to change the word "items" ?

Many Thanks
Mark
Pavlina
Telerik team
 answered on 18 May 2011
5 answers
151 views
We are Building a Simple Widget
The widget has a designer. The designer has a RadAsyncUpload control. The upload control has a handler for the OnClientFileUploaded event. The event fires when the files selection is complete. The files doesn't upload until I click a button on the designer. The file is only uploaded after the pages is refreshed(posted back). 

Of course the button doesn't post back asynchronously.

Peter Filipov
Telerik team
 answered on 18 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?