Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
236 views
Hello,

I have a problem with all my customizations in the RadGrid1_ItemDataBound to the Total and Subtotal rows as well as to LinkButton.
The custom data in the columns in the rows (like custom calculations) are erased/removed when I for instance collapse a group or click on the LinkButton.

So any time there is a postback in the grid the customizations are erased....

Should I also initialize the customizations on some other event or am I missing something?

Please advise.

Thanks,
-Arek

the code below:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
     
    <div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" DataSourceID="SqlDataSource1"
            GridLines="None" EnableAJAX="true" EnableAJAXLoadingTemplate="true" LoadingTemplateTransparency="25"
            ShowGroupPanel="True" AllowPaging="True" AllowSorting="True"
            Skin="Vista" OnItemDataBound="RadGrid1_ItemDataBound" ShowFooter="true"
            OnItemCreated="RadGrid1_ItemCreated" >
            <ClientSettings AllowDragToGroup="True">
            </ClientSettings>
            <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1" ShowGroupFooter="true"
                AllowMultiColumnSorting="true">
                 
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="Market" FilterControlAltText="Filter Market column"
                        HeaderText="Market" SortExpression="Market" UniqueName="Market">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Station" FilterControlAltText="Filter Station column"
                        HeaderText="Station" SortExpression="Station" UniqueName="Station">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Spots" DataType="System.Int32" FilterControlAltText="Filter Spots column"
                        HeaderText="Spots" ReadOnly="True" SortExpression="Spots" UniqueName="Spots"
                        Aggregate="Sum" FooterText=" ">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Spend" DataType="System.Decimal" FilterControlAltText="Filter Spend column"
                        HeaderText="Spend" SortExpression="Spend" UniqueName="Spend" Aggregate="Sum"
                        FooterText=" " DataFormatString="{0:F2}">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CALL" DataType="System.Int32" FilterControlAltText="Filter CALL column"
                        HeaderText="CALL" ReadOnly="True" SortExpression="CALL" UniqueName="CALL" Aggregate="Sum"
                        FooterText=" ">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ORDR" DataType="System.Int32" FilterControlAltText="Filter ORDR column"
                        HeaderText="ORDR" ReadOnly="True" SortExpression="ORDR" UniqueName="ORDR" Aggregate="Sum"
                        FooterText=" ">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CPC" DataType="System.Decimal" FilterControlAltText="Filter CPC column"
                        HeaderText="CPC" ReadOnly="True" SortExpression="CPC" UniqueName="CPC" DataFormatString="{0:F2}">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CPM" DataType="System.Decimal" FilterControlAltText="Filter CPM column"
                        HeaderText="CPM" ReadOnly="True" SortExpression="CPM" UniqueName="CPM" DataFormatString="{0:F2}">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CPO" DataType="System.Decimal" FilterControlAltText="Filter CPO column"
                        HeaderText="CPO" ReadOnly="True" SortExpression="CPO" UniqueName="CPO" DataFormatString="{0:F2}">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CTO" DataType="System.Double" FilterControlAltText="Filter CTO column"
                        HeaderText="CTO" ReadOnly="True" SortExpression="CTO" UniqueName="CTO" DataFormatString="{0:F2}">
                    </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="Market" />
                        </GroupByFields>
                        <SelectFields>
                            <telerik:GridGroupByField FieldName="Market" HeaderText="Market" />
                        </SelectFields>
                    </telerik:GridGroupByExpression>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldName="Station" FieldAlias="Station" FormatString=""
                                HeaderText="Station"></telerik:GridGroupByField>
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="Station" FieldAlias="Station" FormatString=""
                                HeaderText=""></telerik:GridGroupByField>
                        </GroupByFields>
                    </telerik:GridGroupByExpression>
                </GroupByExpressions>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
        </telerik:RadGrid>
    </ContentTemplate>
    </asp:UpdatePanel>
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            try
            {
                if (e.Item is GridFooterItem)
                {
                    GridFooterItem footer = (GridFooterItem)e.Item;
                    footer["Market"].Controls.Add(new LiteralControl("<span>Grand Total :</span>"));
                    footer["Market"].Style.Add("Text-align", "right");
 
                    float cpc = Convert.ToSingle(footer["Spend"].Text)/Convert.ToSingle(footer["CALL"].Text);
                    string txtCpc = string.Format("<span>{0:F2}</span>", cpc);
                    footer["CPC"].Controls.Add(new LiteralControl(txtCpc));
 
                    float cpm = Convert.ToSingle(footer["CALL"].Text) / (Convert.ToSingle(footer["Spend"].Text) / 1000.00F);
                    string txtCpm = string.Format("<span>{0:F2}</span>", cpm);
                    footer["CPM"].Controls.Add(new LiteralControl(txtCpm));
 
                    float cpo = Convert.ToSingle(footer["Spend"].Text) / Convert.ToSingle(footer["ORDR"].Text);
                    string txtCpo = string.Format("<span>{0:F2}</span>", cpo);
                    footer["CPO"].Controls.Add(new LiteralControl(txtCpo));
 
                    float cto = Convert.ToSingle(footer["ORDR"].Text) / Convert.ToSingle(footer["CALL"].Text);
                    string txtCto = string.Format("<span>{0:F2}</span>", cto);
                    footer["CTO"].Controls.Add(new LiteralControl(txtCto));
                }
                else if (e.Item is GridGroupFooterItem)
                {
                    GridGroupFooterItem groupFooter = (GridGroupFooterItem)e.Item;
                    groupFooter["Market"].Controls.Add(new LiteralControl("<span>SubTotal :</span>"));
                    groupFooter["Market"].Style.Add("Text-align", "right");
 
 
                    float cpc = Convert.ToSingle(groupFooter["Spend"].Text) / Convert.ToSingle(groupFooter["CALL"].Text);
                    string txtCpc = string.Format("<span>{0:F2}</span>", cpc);
                    groupFooter["CPC"].Controls.Add(new LiteralControl(txtCpc));
 
                    float cpm = Convert.ToSingle(groupFooter["CALL"].Text) / (Convert.ToSingle(groupFooter["Spend"].Text) / 1000.00F);
                    string txtCpm = string.Format("<span>{0:F2}</span>", cpm);
                    groupFooter["CPM"].Controls.Add(new LiteralControl(txtCpm));
 
                    float cpo = Convert.ToSingle(groupFooter["Spend"].Text) / Convert.ToSingle(groupFooter["ORDR"].Text);
                    string txtCpo = string.Format("<span>{0:F2}</span>", cpo);
                    groupFooter["CPO"].Controls.Add(new LiteralControl(txtCpo));
 
                    float cto = Convert.ToSingle(groupFooter["ORDR"].Text) / Convert.ToSingle(groupFooter["CALL"].Text);
                    string txtCto = string.Format("<span>{0:F2}</span>", cto);
                    groupFooter["CTO"].Controls.Add(new LiteralControl(txtCto));
                }
                //else if (e.Item is GridDataItem2)
                //{
                //    GridDataItem item = (GridDataItem)e.Item;
                //    HyperLink hyplink = new HyperLink();
                //    hyplink.ID = "HyperLink1";
                //    hyplink.Text = item["Station"].Text;
                //    hyplink.NavigateUrl = "#";
                //    item["Station"].Controls.Add(hyplink);
                //}
                else if (e.Item is GridDataItem)
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    LinkButton lnkButton = new LinkButton();
                    lnkButton.ID = "LinkButton1";
                    lnkButton.Text = item["Station"].Text;
                    lnkButton.Click += lnkButton_Click;
                    item["Station"].Controls.Add(lnkButton);
                }
 
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(base.GetType(), "Alert", ex.Message.ToString());
            }
        }

Tsvetina
Telerik team
 answered on 11 May 2011
3 answers
55 views
I am getting a Java Script error   ' Message: Expected ':' '   in RadDatePicker

Here is the code I’m using

 

<td><asp:Label ID="lblDOB" runat="server" Text="DOB:" Font-Bold="True" /></td>

<td>

<telerik:RadDatePicker ID="rdDOB" runat="server"></telerik:RadDatePicker>

</td>

Maria Ilieva
Telerik team
 answered on 11 May 2011
3 answers
956 views
Hi All,
I have a Telerik grid ,in which I am using a check box inside a template column to select a row.

I want to get the count of selected items in grid through javascript.

I am using check box to select a row .

Please help me.
Princy
Top achievements
Rank 2
 answered on 11 May 2011
3 answers
233 views
Hi,

I am currently building an application that uses the RadGrid to display data and the grid appears to be dropping its styling.  The scenario is as follows.

Master Page -> Page -> UserControl -> RadGrid

An AjaxPanel is wrapped around the UserControl level and this is where the partial postback happens. There are a few UserControls at that level which are shown or hidden depending on the context of the postback. When the UserControl containing the RadGrid first loads everything is fine (it is the first UserControl to load). When the postback occurs it hides the UserControl containing the RadGrid and shows a different UserControl. When there is a further postback the UserControl containing the RadGrid is reshown and at this point it has no styles applied.

I am using the default style which is fetched using the HttpHandler. This is the only style being used.

I hope you can provide me with some assistance.

Regards,

Andy.
Tsvetoslav
Telerik team
 answered on 11 May 2011
3 answers
125 views
I am using the RadAsync upload which is working for most users however I have 2 users (out of 5) that is getting an error Error #2038.
I am running the 2010.1109 version of the control and will be updating to the SP2 version tomorrow.

What does this error mean?
Genady Sergeev
Telerik team
 answered on 11 May 2011
1 answer
48 views
Hi,

We have a WCM scenario in SharePoint 2007 with own page layouts and masterpage.

The HTML-fields are set to use RAD Editor 5.8.7. We add a couple of Reusable Contents to a HTML-field via IE 8.

When we set the property ContentFilters in ConfigFile.xml (to anything) and try to add for example a new web part in a web part zone (so that the page reloads), the first thing that happens is that the Reusable Contents changes to "a" links (as it should) and then when the page have loaded again, they do not change back to the corresponding Reusable Contents (the "a" links are still visible in the field).
<property name="ContentFilters">FixUlBoldItalic,IECleanAnchors,MozEmStrong,ConvertFontToSpan,IndentHTMLContent</property>

If we comment the property setting in ConfigFile.xml it works perfect.
<!--property name="ContentFilters">FixUlBoldItalic,IECleanAnchors,MozEmStrong,ConvertFontToSpan,IndentHTMLContent</property-->
Rumen
Telerik team
 answered on 11 May 2011
1 answer
116 views
It seems that the ASP.net report viewer requires session state enabled. This is a major limitation with the integration with SP2010 given that session state is disabled by default.

In order to be able to use Telerik Reporting on a SP2010 site it seems that we need to enable session state in the entire web application (instead of just enabling it on the page with the report viewer), which in my opinion, is not an acceptable solution. Do you have any plans to remove the need to use session state in future releases?

It would also be a good idea if you clearly state this limitation in your literature so people are aware of it before making a purchase decision. You have a page that describes how to integrate the report viewer with SharePoint but you do not mention anything about the session state limitation which I think can by very misleading.

Best Regards,
Hugo Esperanca
Peter
Telerik team
 answered on 11 May 2011
1 answer
98 views

Hi

Is there a way to automatically switch the up and down option when the search has reached the top or the bottom of the content?

Currently, if the cursor is at the bottom of the content the user must know where it is and either move the cursor to the top of the content, or change the Find/Find & Replace parameter to search "Up" rather than search "down".  Users expect it to work like MS Word where once it reaches the end of the content it automatically starts searching again at the top of the document.

Thanks in advance

Rumen
Telerik team
 answered on 11 May 2011
1 answer
121 views

I use RadSkinManager :

 <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Default" EnableViewState="false" ShowChooser="false" />

I tried to reduce my pages' size so I am disabling ViewState on controls. I tried disabling RadSkinManager viewstate but it does not work

Here are viewstate size stats:

Control Id    Type    ViewState Size

ctl00$ctl00$ContentPlaceHolder1$RadSkinManager1 Telerik.Web.UI.RadSkinManager 0
ctl00$ctl00$ContentPlaceHolder1$SkinChooser Telerik.Web.UI.RadComboBox 912
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$Header Telerik.Web.UI.RadComboBoxHeaderFooterControl 48
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$Footer Telerik.Web.UI.RadComboBoxHeaderFooterControl 48
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i0 Telerik.Web.UI.RadComboBoxItem 60
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i1 Telerik.Web.UI.RadComboBoxItem 64
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i2 Telerik.Web.UI.RadComboBoxItem 64
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i3 Telerik.Web.UI.RadComboBoxItem 56
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i4 Telerik.Web.UI.RadComboBoxItem 72
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i5 Telerik.Web.UI.RadComboBoxItem 64
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i6 Telerik.Web.UI.RadComboBoxItem 64
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i7 Telerik.Web.UI.RadComboBoxItem 72
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i8 Telerik.Web.UI.RadComboBoxItem 64
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i9 Telerik.Web.UI.RadComboBoxItem 64
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i10 Telerik.Web.UI.RadComboBoxItem 60
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i11 Telerik.Web.UI.RadComboBoxItem 60
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i12 Telerik.Web.UI.RadComboBoxItem 64
ctl00$ctl00$ContentPlaceHolder1$SkinChooser$i13 Telerik.Web.UI.RadComboBoxItem 68

You see that   RadSkinManager viewstate is 0 but  some SkinChooser comboboxes. Why is that?

Tsvetoslav
Telerik team
 answered on 11 May 2011
1 answer
275 views
Hello,

I am following the my portal demo. I have created app with similar functionality.

I have combobox with treeview embeded in it. On clicking tree nodes I add the Docks to the raddockzone.

Now I want to add "AsyncPostBackTrigger " to the treeview  which is inside the combobox so that when I hit "NodeClick" event then rest of the docks should not load again. Oly newly added dock should get impacted.

If I try to add the AsyncPostBackTrigger to Node click then I get the following error.

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: A control with ID 'RadTreeViewCustSupportReports' could not be found for the trigger in UpdatePanel 'UpdatePanel1'.


Treeview inside the combobox:
<telerik:RadComboBox ID="RadComboReports" runat="server" AllowCustomText="true" EmptyMessage="-- Select Report --"
                           Height="300px" ShowToggleImage="True" Skin="Default" Width="275px">
                           <ItemTemplate>
                               <div id="div1">
                                   <telerik:RadTreeView ID="RadTreeViewCustSupportReports" runat="server" OnNodeClick="RadTreeViewCustSupportReports_NodeClick"
                                       Skin="Vista" Width="100%">
                                       <Nodes>
                                           <telerik:RadTreeNode runat="server" ImageUrl="~/Images/chart_pie.png" Text="Avg Response Time"
                                               Value="~/Internal/Dashboard/Reports/CSMD_Average_Response_Time.ascx">
                                           </telerik:RadTreeNode>
                                           <telerik:RadTreeNode runat="server" ImageUrl="~/Images/chart_pie.png" Text="Avg Resolution Time Frontline"
                                               Value="~/Internal/Dashboard/Reports/CSMD_Average_Resolution_Time_FL.ascx">

Update panel where raddoclayout is placed:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
    <ContentTemplate>
        <Martinbeeby:RadDockLayoutNew ID="RadDockLayout1" runat="server" OnLoadDockLayout="RadDockLayout1_LoadDockLayout"
            OnSaveDockLayout="RadDockLayout1_SaveDockLayout">
            <table style="width: 100%; padding-top: 4px;" cellpadding="0" cellspacing="0" border="0">
                <tr align="left" style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px;
                    padding-right: 0px;">
                    <td style="vertical-align: top; width: 267px; padding-left: 0px; padding-right: 0px;">
                        <Martinbeeby:RadDockZoneNew ID="RadDockZone1" runat="server" MinHeight="500px" Width="267px"
                            BorderStyle="None">

AsyncPostBackTrigger:

</Martinbeeby:RadDockLayoutNew>
            </ContentTemplate>
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="RadTreeViewCustSupportReports" EventName="NodeClick" />
            </Triggers>
        </asp:UpdatePanel>


How to add this trigger ?

Dobromir
Telerik team
 answered on 11 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?