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

Hello,

I am trying to implement Export To Excel functionality. The issue is it does not include template columns in exported file. I am sharing my markup and code here:

protected void imgBtn_EXP_Requests_Click(object sender, EventArgs e)
       {
           RadGrid.MasterTableView.ExportToExcel();
       }
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid" AllowSorting="True" EnableViewState="true" PageSize="35" AllowPaging="True" AllowCustomPaging="false"
                AllowAutomaticUpdates="True" AllowAutomaticInserts="True" runat="server" AutoGenerateColumns="false" GridLines="None" AllowFilteringByColumn="true"
                GroupingSettings-CaseSensitive="false" ExportSettings-FileName="Dashboard" ExportSettings-ExportOnlyData="true" ExportSettings-OpenInNewWindow="true"
                ExportSettings-IgnorePaging="true" OnItemCommand="RadGrid_ItemCommand" OnItemDataBound="RadGrid_ItemDataBound">               
                <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"></PagerStyle>
                <ClientSettings>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" FrozenColumnsCount="2" />
                </ClientSettings>
                <MasterTableView Width="100%" CommandItemDisplay="Top" EnableViewState="true" TableLayout="Fixed"
                    DataKeyNames="Id" AutoGenerateColumns="false" InsertItemPageIndexAction="ShowItemOnCurrentPage" >
                    <CommandItemSettings ShowAddNewRecordButton="false" />
                    <CommandItemSettings ShowRefreshButton="false" />                   
                    <Columns>
                        <telerik:GridBoundColumn DataField="Id" UniqueName="Id" HeaderText="Id"
                            AllowSorting="false" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" AllowFiltering="false">
                        </telerik:GridBoundColumn>                                            
                        <telerik:GridTemplateColumn HeaderText="Request Id" ShowFilterIcon="false" UniqueName="RequestId">
                            <ItemTemplate>                               
                                <asp:LinkButton ID="lnkbtnRequestId" CausesValidation="false" runat="server" Text='<%#Eval("RequestId") %>'></asp:LinkButton>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Record (Title)" ShowFilterIcon="false" UniqueName="Title">
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkbtnTitle" CausesValidation="false" runat="server" Text='<%#Eval("Title") %>'></asp:LinkButton>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>                                                
                    </Columns>
                </MasterTableView>               
            </telerik:RadGrid>
Kod
Top achievements
Rank 1
 answered on 31 Oct 2017
1 answer
205 views

Hello,

I have RadHtmlChart Pie and I need to display a tooltip when user hovers mouse over it's legend item. I placed RadToolTip on my page, put some content into it and now I need to position it over legend items.

    <telerik:RadToolTip ID="ToolTip" runat="server" RelativeTo="BrowserWindow" Position="Center" Width="150" Height="100">
        <table>
            <tr>
                <td><span style="font-weight: bold" id="TooltipGroupName"></span></td>
            </tr>
            <tr>
                <td><span id="TooltipAmount"></span></td>
            </tr>
            <tr>
                <td>Transactions:&nbsp;<span id="TooltipNumTransaction"></span></td>
            </tr>
        </table>
    </telerik:RadToolTip>

Here is the legend hover event handler:

function OnLegendItemHover(e)
{
                var DataItem = e.series.data[e.pointIndex];

                var GroupName = DataItem.GroupName;
                $("#TooltipGroupName").html(GroupName);

                var Amount = kendo.format("{0:C2}", DataItem.AbsAmount * DataItem.AmountSign);
                $("#TooltipAmount").html(Amount);

                var NumTransaction = DataItem.NumTransaction;
                $("#TooltipNumTransaction").html(NumTransaction);

                var ToolTip = $find("<% =ToolTip.ClientID %>");
                ToolTip.OffsetX = e.element.getBoundingClientRect()["left"] + " px";
                ToolTip.OffsetY = e.element.getBoundingClientRect()["top"] + " px";
                ToolTip.show();
            }

 

I actually wasted two days trying different ways to position RadToolTip but I could not do it. Do RelativeTo options actually work ? RelativeTo="Mouse" would be easiest for me I guess. So I could simply call ToolTip.show() in my handler.

 

Slava
Top achievements
Rank 1
 answered on 31 Oct 2017
2 answers
129 views

When I look at my page using RadGrid with one of the built in Skins (WebBlue) on localhost everything appears correct, but as soon as I upload to server and view the page the Skin images do not display, I just see an empty button.  This holds for the filter drop-down arrow, the sort arrow, the pager buttons and all the export command buttons.  I then looked at the online demo's and i see the same issue.  Works fine with Chrome and Firefox, just not IE11 (11.0.9600.18816). 

Any ideas?

 

 

John
Top achievements
Rank 1
 answered on 31 Oct 2017
0 answers
75 views

Is there any way of knowing whether the control that triggered a OnPageSizeChanged event was the pager for a master table or a detail table? e has absolutely nothing useful in it :(

 

We are saving grid page sizes in a DB in order to retain page sizes across postbacks and session etc, but want to ignore detail table page size changes. I have tried everything I can think to try and identify which control (and therefore which table) triggered the event but cannot work it out.

 

Any advice would be appreciated.

Marcus
Top achievements
Rank 1
 asked on 31 Oct 2017
1 answer
213 views

Hi Guys

In VS 2015 I am getting a wavy blue line under a file which pops up a box saying " 'oncopy' is not a valid attribute of element radtextbox' ", plus the same for uncut and onpaste, although the functions themselves do what they are supposed to in the form. 

How can I get rid of this warning?

I copied the website code from one machine to another so maybe there is a clue there.

I am using 2016.2 controls

Thanks for your help!

Clive

 

Rumen
Telerik team
 answered on 31 Oct 2017
2 answers
257 views

Hi,

I have a PivotGrid table with huge value. How do I customize the appearance of the value in the table using my sample javascript below?

function FormatNumber(value) {
    if (value === 0) { return 0 }
    if (value <= 999) { return value }
    if (value >= 1000 && value <= 999999) { return parseFloat(value / 1000).toFixed(1) + 'K' }
    if (value >= 1000000 && value <= 999999999) { return parseFloat(value / 1000000).toFixed(1) + 'M' }
    if (value >= 1000000000 && value <= 999999999999) { return parseFloat(value / 1000000000).toFixed(1) + 'B' }
    if (value >= 1000000000000 && value <= 999999999999999) { return parseFloat(value / 1000000000000).toFixed(1) + 'T' }
    if (value >= 1000000000000000 && value <= 999999999999999999) { return parseFloat(value / 1000000000000000).toFixed(1) + 'Q }
    return value
}

 

Thanks.

Eyup
Telerik team
 answered on 31 Oct 2017
1 answer
123 views

I've got a grid that I need to sort by a column that refers to a related entity. I need to figure out the syntax to do this.

 

Details:

<telerik:GridTemplateColumn UniqueName="AGNUM" DataField="AGNUM" HeaderText="Agent" AllowSorting="True" SortExpression="PAgents.AGNAME">
    <EditItemTemplate>
        <telerik:RadComboBox ID="rcb_Agent_Edit" DataSourceID="Entity_Agents_Active"
            AppendDataBoundItems="true" DropDownWidth="400px"
            SelectedValue='<%# Bind("AGNUM") %>' runat="server" DataValueField="AGNUM" DataTextField="AGNAME">
            <Items>
                <telerik:RadComboBoxItem Text="" Value="99999" />
            </Items>
        </telerik:RadComboBox>
    </EditItemTemplate>
    <ItemTemplate>
        <%# DataBinder.Eval(Container.DataItem, "PAgents.AGNAME") %> <-- Same string works fine here, though.
    </ItemTemplate>
</telerik:GridTemplateColumn>

The above throws an argument exception: Input string was not in a correct format.Couldn't store in PAgents.AGNAME Column. Expected type is Int32.

The grid is bound to an entity data source (defined below)

The two relevant data sources:

<asp:EntityDataSource ID="Entity_AgLicensing" runat="server" ConnectionString="name=dev_SuretyDBEntities" ContextTypeName="BSGSuretyRewrite.Entities.DataAccess.LinqToEntities.dev_SuretyDBEntities"
    DefaultContainerName="dev_SuretyDBEntities" EnableFlattening="false" EntitySetName="AgLicense" Include="AgLicenseStatus,PAgents" EnableDelete="true" EnableInsert="true" EnableUpdate="true"
    Where="it.[PNUMBER]=@PNUMBER && it.[AGNUM] IS NOT NULL"
    OnInserting="Entity_AgLicensing_Inserting" OnDeleted="Entity_AgLicensing_Deleted" OnUpdating="Entity_AgLicensing_Updating">
    <WhereParameters>
        <asp:ControlParameter ControlID="hfPnumber" Name="PNUMBER" PropertyName="Value" DbType="Int32" />
    </WhereParameters>
</asp:EntityDataSource>
<asp:EntityDataSource ID="Entity_AgLicensing_Agency" runat="server" ConnectionString="name=dev_SuretyDBEntities" ContextTypeName="BSGSuretyRewrite.Entities.DataAccess.LinqToEntities.dev_SuretyDBEntities"
    DefaultContainerName="dev_SuretyDBEntities" EnableFlattening="false" EntitySetName="AgLicense" Include="AgLicenseStatus" EnableDelete="true" EnableInsert="true" EnableUpdate="true"
    Where="it.[PNUMBER]=@PNUMBER && it.[AGNUM] IS NULL" OnInserting="Entity_AgLicensing_Agency_Inserting" OnDeleted="Entity_AgLicensing_Agency_Deleted">
    <WhereParameters>
        <asp:ControlParameter ControlID="hfPnumber" Name="PNUMBER" PropertyName="Value" DbType="Int32" />
    </WhereParameters>
</asp:EntityDataSource>

 

 

 

Eyup
Telerik team
 answered on 31 Oct 2017
3 answers
154 views

I am having a problem with grouping on a grid. I have two select fields, one which shows the current group, and one which shows a count of rows.

The header text works fine on the first group, but all subsequent groups, it looks like it is just showing a template of the text.

The attached image shows the way it is coming out. I collapsed the first group so all the group headers could be seen together.

You can see that the first group shows up fine showing "Pass: ; Fields: 73". This is correct, as that first group, all of the rows have the value for the PASS field empty.

But then the subsequent two groups are wrong. Taking the second group as example, it SHOULD show "Pass: 6; Fields 1", but instead it shows "  Fields: {0}".

The below is the code for the groupbyexpressions for the grid in question.

01.<groupbyexpressions>
02.    <telerik:gridgroupbyexpression>
03.        <groupbyfields>
04.            <telerik:gridgroupbyfield fieldname="PASSNUMBER" />
05.        </groupbyfields>
06.        <selectfields>
07.            <telerik:gridgroupbyfield fieldname="PASSNUMBER" headertext="Pass" fieldalias="PASS" />
08.            <telerik:gridgroupbyfield fieldname="ROWID" headertext="Fields" fieldalias="FIELDS" aggregate="Count" />
09.        </selectfields>
10.    </telerik:gridgroupbyexpression>
11.</groupbyexpressions>
Eyup
Telerik team
 answered on 31 Oct 2017
4 answers
311 views
I'm having problems finding a control in my grid.  I've been stuck on this for a couple of days and have searched the forums, following examples and links to documentation, with no luck.  Here's a snippet from the aspx page.

 <telerik:GridTemplateColumn UniqueName="ddHeader" HeaderText="Header"> 
   <EditItemTemplate> 
     <asp:DropDownList ID="HeaderDropDown" runat="server" /> 
   </EditItemTemplate> 
 </telerik:GridTemplateColumn> 

And here's a snippet from code behind.
private void Grid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditableItem) 
        { 
            GridEditableItem item = e.Item as GridEditableItem; 
            Dictionary<string, string> dict = new Dictionary<string, string>(); 
            dict = ReadHeader(); 
            DropDownList list =item.FindControl("HeaderDropDown") as DropDownList; 
            list.DataSource = dict; 
            list.DataBind(); 
        } 
    } 

DropDownList list =item.FindControl("HeaderDropDown") as DropDownList;  always returns null.

What am I not getting here?

Thanks,







JazzBox
Top achievements
Rank 1
 answered on 30 Oct 2017
0 answers
212 views

I've seen a ton of questions on this, however no simple explanations why this is occurring or what the solution to the problem is.

We've got a Batch Edit Update Grid that I originally had a RadComboBox in that was working fine until I found that keyboard navigation was screwing up the keyboard flow and saw that it was recommended to switch to a RadDropDown control, so I did, which is in a GridTemplateColumn similar to this:

<telerik:RadGrid ID="RadGrdActionInputs" runat="server" Width="900px"  OnNeedDataSource="RadGrdActionGroupInputs_NeedDataSource"
AutoGenerateColumns="False" RenderMode="Lightweight" AllowSorting="True"
OnItemDataBound="RadGrdActionInputs_ItemDataBound"
oninsertcommand="RadGrdActionInputs_InsertCommand"
onupdatecommand="RadGrdActionInputs_UpdateCommand"
ondeletecommand="RadGrdActionInputs_DeleteCommand"
oneditcommand="RadGrdActionInputs_EditCommand"
AutoGenerateEditColumn="True" >
<GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
 
<MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ID" EditMode="Batch">
<BatchEditingSettings EditType="Row" />
<CommandItemSettings ShowCancelChangesButton="true" ShowRefreshButton="false" />
 
....
 
<telerik:GridTemplateColumn HeaderText="Data Point" DataField="DataPointID" HeaderStyle-Width="500px">
    <ItemTemplate>
        <telerik:RadTextBox ID="RadTextBox1" runat="server" Width="150px"></telerik:RadTextBox>
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadDropDownList RenderMode="Lightweight" ID="ddDataPointList" runat="server" Width="300px">
        </telerik:RadDropDownList>
    </EditItemTemplate>
    <HeaderStyle Width="500px"></HeaderStyle>
</telerik:GridTemplateColumn>

 

In the examples and the problems/posts that I have seen, they all recommend checking the e.item type in the ItemDataBound event.  If the e.item is a GridDataItem then bind a label, else if it's a GridEditableItem bind the dropdown, IE:

protected void RadGrdActionInputs_ItemDataBound(object sender, GridItemEventArgs e)
{
    //get combobox data for drop down.
    DataPointsModel dataPointsModel = ConfigurationController.GetAllDataPoints();
     
    try {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
 
            RadLabel lblActionGroupType = item.FindControl("lblDataPoint") as RadLabel;
 
            //get value for ActionGroupTypeID
            string val = DataBinder.Eval(item.DataItem, "DataPointID").ToString();
 
            
        }
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            RadDropDownList rddl = item.FindControl("ddDataPointList2") as RadDropDownList;
            BindRadDropDownDataList("I", rddl, "Name", "ID");
        }
    }
    catch {}
}

 

Problem is, this code never gets called:

if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            RadDropDownList rddl = item.FindControl("ddDataPointList2") as RadDropDownList;
            BindRadDropDownDataList("I", rddl, "Name", "ID");
        }

 

I'm pulling my hair out on this one..

 

 

JazzBox
Top achievements
Rank 1
 asked on 30 Oct 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?