Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
240 views
Hi, I have a master table and a detail table.  When I export to Excel I get an extra cell inserted in the first column for the detail table view records only.  If you look at the attached image you will see cells A3 and A6 are empty and appear to be associated with the detail table.

Any insights as to what I might be overlooking and how to fix this would be greatly appreciated.


Radgrid defintion...    

<
telerik:RadGrid ID="rgCourseInventoryList" runat="server" CssClass="RadGrid" GridLines="None" AllowPaging="True" PageSize="10"
    AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="true" OnDetailTableDataBind="rgCourseInventoryList_DetailTableDataBind"
    OnNeedDataSource="rgCourseInventoryList_NeedDataSource">
    <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="CourseId" AutoGenerateColumns="false" HierarchyLoadMode="ServerBind"
    HierarchyDefaultExpanded="true" ClientDataKeyNames="CourseId">
    <CommandItemTemplate>
      <asp:ImageButton runat="server" ImageUrl="../Images/Icons/addrecord.gif"  OnClientClick="return ShowInsertForm();"  ID="ibInsertSection" ToolTip="<%$ Resources:ui_labels, ibInsertSection %>"/>
      <asp:LinkButton runat="server" ID="lbAddCourse" OnClientClick="return ShowInsertForm();" Text="<%$ Resources:ui_messages, msgAddNewRecord %>"></asp:LinkButton>
      <asp:ImageButton runat="server" ImageUrl="../Images/Icons/excel.png" ID="ibExportToExcel" ToolTip="<%$ Resources:ui_labels, ibInsertSection %>"/>
      <asp:LinkButton runat="server" ID="lbExportToExcel" Text="<%$ Resources:ui_messages, msgExcel %>" CommandName="ExportToExcel"></asp:LinkButton>
    </CommandItemTemplate>
 
    <Columns>
        <telerik:GridEditCommandColumn UniqueName="gecEditCourse" EditImageUrl="../Images/Icons/edit.png"  ButtonType="ImageButton" ItemStyle-Width="10px" EditText="<%$ Resources:ui_labels, ibEditCourse %>">
        </telerik:GridEditCommandColumn>
        <telerik:GridBoundColumn UniqueName="CourseCode" HeaderText="<%$Resources:ui_labels, gbcCourseCode %>" DataField="SISCourseCode">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn UniqueName="CourseType" HeaderText="<%$Resources:ui_labels, gbcCourseType %>" DataField="SISCourseType">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn UniqueName="CourseTitle" DataField="SISCourseTitle" Visible="false">
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn UniqueName="gtcTitle" HeaderText="<%$ Resources:ui_labels, gtcTitle %>" ItemStyle-VerticalAlign="Middle">
            <ItemTemplate>
                <asp:Image ID="imgParent" runat="server" Visible="false" />
                <asp:Label ID="lblParentTitle" runat="server"></asp:Label>
                <asp:Label ID="lblCourseTitle" runat="server"></asp:Label>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn UniqueName="CourseNote" HeaderText="<%$Resources:ui_labels, gbcNote %>" DataField="SISCourseNotes">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn UniqueName="CourseExpired" DataField="SISCourseExpired" Visible="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn UniqueName="ParentId" DataField="ParentId" Visible="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn UniqueName="CourseStructure" HeaderText="<%$Resources:ui_labels, gbcCourseStructure %>" DataField="SISCourseStructure">
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn UniqueName="gtcShowDelete" ItemStyle-Width="10px">
            <ItemTemplate>
            <asp:ImageButton runat="server" ImageUrl="../config/Images/Icons/delete.png" ID="ibShowDeleteForm" ToolTip="<%$ Resources:ui_labels, ibShowDeleteForm %>"/>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
    </Columns>
    <DetailTables>
        <telerik:GridTableView runat="server" DataKeyNames="ChildCourseId" Name="CrossListView" ClientDataKeyNames="ChildCourseId">
            <Columns>
                <telerik:GridBoundColumn UniqueName="SISCourseCode" DataField="SISCourseCode">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="SISCourseTitle" DataField="SISCourseTitle">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="SISCourseExpired" DataField="SISCourseExpired" Visible="false">
                </telerik:GridBoundColumn>
            </Columns>
        </telerik:GridTableView>
    </DetailTables>
    </MasterTableView>
    <ExportSettings ExportOnlyData="true" Excel-Format="ExcelML" IgnorePaging="true" OpenInNewWindow="true" HideStructureColumns="true">
    </ExportSettings>
    <ClientSettings>
        <Selecting AllowRowSelect="true"></Selecting>
        <ClientEvents OnRowDblClick="RowDblClickEdit"></ClientEvents>
    </ClientSettings>
</telerik:RadGrid>


Code behind...

Protected Sub rgCourseInventory_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgCourseInventoryList.ItemCommand
 
    rgCourseInventoryList.MasterTableView.CommandItemSettings.ShowRefreshButton = False
 
    If (e.CommandName = RadGrid.ExportToExcelCommandName) Then
        _isExporting = True
        rgCourseInventoryList.ExportSettings.FileName = "Course list " + Date.Now.ToString("F")
        rgCourseInventoryList.ExportSettings.HideStructureColumns = True
        rgCourseInventoryList.MasterTableView.GetColumn("CourseTitle").Visible = True
        rgCourseInventoryList.MasterTableView.GetColumn("CourseTitle").HeaderText = Resources.ui_labels.gtcTitle.ToString
        rgCourseInventoryList.MasterTableView.ExportToExcel()
 
    ElseIf (e.CommandName = RadGrid.CancelCommandName) Then
        rgCourseInventoryList.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = True
        rgCourseInventoryList.MasterTableView.CommandItemSettings.AddNewRecordText = Resources.ui_messages.msgAddNewRecord
 
    ElseIf (e.CommandName = RadGrid.InitInsertCommandName) Then
        rgCourseInventoryList.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = False
        rgCourseInventoryList.MasterTableView.CommandItemSettings.AddNewRecordText = ""
 
    End If
End Sub
 
Protected Sub rgCourseInventoryList_ExcelMLExportRowCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs) Handles rgCourseInventoryList.ExcelMLExportRowCreated
 
    If e.RowType = GridExportExcelMLRowType.DataRow Then
        If Not _isExcelConfigured Then
            'Set Worksheet name
            e.Worksheet.Name = rcbAcademicUnitId.SelectedItem.Text + " " + Date.Now.ToString("MMM dd, yyyy")
 
            'Set Column widths
            For Each column As ColumnElement In e.Worksheet.Table.Columns
                If e.Worksheet.Table.Columns.IndexOf(column) = 2 Or e.Worksheet.Table.Columns.IndexOf(column) = 3 Then
                    'set width 280 for Course Title and Notes column
                    column.Width = Unit.Point(280)
                Else
                    column.Width = Unit.Point(80)
                    'set width 80 to the rest of the columns
                End If
            Next
 
            'Set Page options
            Dim pageSetup As PageSetupElement = e.Worksheet.WorksheetOptions.PageSetup
            pageSetup.PageLayoutElement.IsCenteredVertical = True
            pageSetup.PageLayoutElement.IsCenteredHorizontal = True
            pageSetup.PageMarginsElement.Left = 0.5
            pageSetup.PageMarginsElement.Top = 0.5
            pageSetup.PageMarginsElement.Right = 0.5
            pageSetup.PageMarginsElement.Bottom = 0.5
            pageSetup.PageLayoutElement.PageOrientation = PageOrientationType.Landscape
 
            'Freeze panes
            e.Worksheet.WorksheetOptions.AllowFreezePanes = True
            e.Worksheet.WorksheetOptions.LeftColumnRightPaneNumber = 1
            e.Worksheet.WorksheetOptions.TopRowBottomPaneNumber = 1
            e.Worksheet.WorksheetOptions.SplitHorizontalOffset = 1
            e.Worksheet.WorksheetOptions.SplitVerticalOffest = 1
 
            e.Worksheet.WorksheetOptions.ActivePane = 2
            _isExcelConfigured = True
        End If
 
    ElseIf e.RowType = GridExcelBuilder.GridExportExcelMLRowType.HeaderRow Then
            If e.Row.Cells.Count < 4 Then
                e.Worksheet.Table.Rows.Remove(e.Row) ' These are the detail column header record rows which insert empty cells into the spreadsheet so get rid of the whole row
            End If
    End If
 
End Sub
 
Protected Sub rgCourseInventoryList_ExcelMLExportStylesCreated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLStyleCreatedArgs) Handles rgCourseInventoryList.ExcelMLExportStylesCreated
 
    For Each style As StyleElement In e.Styles
        If style.Id = "headerStyle" Then
            style.InteriorStyle.Pattern = InteriorPatternType.Solid
            style.InteriorStyle.Color = System.Drawing.Color.Gray
        End If
        If style.Id = "alternatingItemStyle" Then
            style.InteriorStyle.Pattern = InteriorPatternType.Solid
            style.InteriorStyle.Color = System.Drawing.Color.LightGray
        End If
        If style.Id.Contains("itemStyle") Then
            style.InteriorStyle.Pattern = InteriorPatternType.Solid
            style.InteriorStyle.Color = System.Drawing.Color.White
        End If
    Next
End Sub




Dan
Top achievements
Rank 1
 answered on 11 Feb 2013
2 answers
167 views

Here's my RadGrid...

<telerik:RadGrid ID="grdAssets"
    AllowPaging="True" runat="server" AllowSorting="True" AllowFilteringByColumn="true">
    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
    <MasterTableView TableLayout="Fixed" ShowHeader="false" EditMode="PopUp"
            ClientDataKeyNames="AssetKey" DataKeyNames="AssetKey" >
 
        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditColumn">
            <HeaderStyle Width="70px" />
            <ItemStyle Width="70px" />
            </telerik:GridEditCommandColumn>
 
            <telerik:GridNumericColumn DataField="AssetKey" HeaderText="AssetKey"
                UniqueName="AssetKey" DataType="System.Int32" Visible="False" ReadOnly="True">
            </telerik:GridNumericColumn>
 
        </Columns>
 
        <ItemTemplate>
 
            <div>
 
                <telerik:RadComboBox ID="cbConditionID" runat="server" OnClientSelectedIndexChanged="onSelectedIndexChanged" Text='<%# Bind("ConditionID") %>'>
                    <Items>
                        <telerik:RadComboBoxItem Text="Excellent" Value="E" />
                        <telerik:RadComboBoxItem Text="Good" Value="G" />
                        <telerik:RadComboBoxItem Text="Fair" Value="F" />
                    </Items>
                </telerik:RadComboBox>
 
                <br />
 
                <span style="font-weight: bold; font-family: Arial Black;">AssetKey:</span>
                <%# Eval("AssetKey")%>
                <br/>
 
                <span style="font-weight: bold; font-family: Arial Black;">Description:</span>
                <%# Eval("AssetDescription")%>
                <br/>
                <span style="font-weight: bold;">Total Cost:</span>
                <%# Eval("TotalCost", "{0:C2}")%>
                <br/>
                <span style="font-weight: bold;">Quantity:</span>
                <%#Eval("Quantity") & " available"%>
                <br/>
            </div>
            <br/>
        </ItemTemplate>
 
        <EditFormSettings EditFormType="Template" CaptionFormatString="Edit Detail">
        <EditColumn UniqueName="EditCommandColumn1">
        </EditColumn>
 
        <FormTemplate>
            <br />
            <div style="margin-left:10px">
            <table border="0" cellpadding="2" cellspacing="2">
                <tr>
                    <td style="width:110px">
                        Asset Description
                    </td>
                    <td style="width:180px">
                        <telerik:RadTextBox ID="txtAssetDescription" runat="server" TabIndex="103" MaxLength="36"
                            Text='<%# Bind("AssetDescription") %>' Width="180px">
                        </telerik:RadTextBox>
                    </td>
                    <td style="width:40px">
                    </td>
                    <td style="width:110px">
                        Unit Cost
                    </td>
                    <td style="width:100px">
                        <telerik:RadNumericTextBox ID="txtUnitCost" runat="server" TabIndex="107" MaxLength="14"
                            NumberFormat-DecimalDigits="4" Culture="English (United States)"
                            DbValue='<%# Bind("UnitCost") %>' Width="100px">
                        </telerik:RadNumericTextBox>
                    </td>
                </tr>
 
 
                <tr style="height:25px">
                    <td colspan="5">
                    </td>
                </tr>
                <tr>
                    <td colspan="5">
                        <asp:ImageButton ID="imgSave" runat="server" TabIndex="120" AlternateText="OK"
                            ImageUrl="~/images/icons/save-24.jpg" ToolTip="OK"
                            CommandName='<%# IIf (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'
                            OnClientClick='return EditForm_Saved(this)' />
                             
                        <asp:ImageButton ID="imgCancel" runat="server" TabIndex="121" AlternateText="Cancel"
                            ImageUrl="~/images/icons/undo-24.jpg" ToolTip="Cancel" CommandName="Cancel" />
                    </td>
                </tr>
                <tr style="height:25px">
                    <td colspan="5">
                        <asp:Literal ID="litFormEditError" runat="server"></asp:Literal>
                    </td>
                </tr>
 
 
            </table>
            </div>
 
        </FormTemplate>
        <PopUpSettings Modal="True" Width="620px" Height="300px" />
        </EditFormSettings>
 
    </MasterTableView>
    <ClientSettings>
        <Scrolling AllowScroll="true" UseStaticHeaders="true">
        </Scrolling>
        <Selecting AllowRowSelect="false" />
    </ClientSettings>
</telerik:RadGrid>



As you can see, within the ItemTemplate, I have a RadComboBox that fires OnClientSelectedIndexChanged. Here's my function...

function onSelectedIndexChanged(sender, eventArgs) {
    // How can I access the row index where RadComboBox is located?
}

It fires, but within it, how can I determine the grid row index where the RadComboBox resides? Also, in general, is there anything wrong with how I have my RadGrid setup? Thanks.
Jeremy Yoder
Top achievements
Rank 1
 answered on 11 Feb 2013
8 answers
1.0K+ views
I have a RadComboBox thats populated via a method as follows:
private void GetFileList(string filter, string mode, RadComboBox rc)
    {
        List<RadComboBoxItem> list = new List<RadComboBoxItem>();
        DirectoryInfo di = new DirectoryInfo(tpbStaticVariables.TestQryFolder);

        FileInfo[] xqFiles = di.GetFiles(filter);
        String href, filename, url;
        foreach (FileInfo xq in xqFiles)
        {
            filename = Path.GetFileNameWithoutExtension(xq.Name);
            href = String.Format("Transform.aspx?q={0}&mode={1}&ras=false", filename, mode);
            url = "<br><a href=" + href + ">" + xq.Name + "</a>";
            RadComboBoxItem rcbi = new RadComboBoxItem(filename, href);
            list.Add(rcbi); 
        }
        rc.DataTextField = "Text";
        rc.DataValueField = "Value";
        rc.DataSource = list;
        rc.DataBind();
        Response.Write(tpbStaticVariables.TestQryFolder);
    }

The items appear in the dropdown correctly, but when I attach a method to the selectedindexchanged event, the selectedindex is always 0.  Obviously what I want is to get the item that's been selected, and the Value property in particular.

What am I doing wrong? Thanks for any help.

Paul
Top achievements
Rank 1
 answered on 11 Feb 2013
4 answers
186 views
Can I change splitter orientation in client side?

Thanks,
MTs
Vessy
Telerik team
 answered on 11 Feb 2013
1 answer
521 views
I have a chart with a datatable and I need to be able to have an empty value for one of the values.  When I add the value as Nothing, the value is set to the next value in the series (6,100 in the attached image) and will show up as 6,100 in the datatable.  I was able to make the point mark not show on the chart by setting the empty property to true, but I need to be able to set the value in the datatable to either a blank field or N/A.  Is this possible?
Petar Kirov
Telerik team
 answered on 11 Feb 2013
11 answers
367 views
I have used RadAjaxPanel in my page

 <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnResponseEnd="OnAjaxRequestEnd"
                                            LoadingPanelID="LoadingPanel1">
</telerik:RadAjaxPanel>

---------------------------

function OnAjaxRequestEnd(sender,eventArgs) {
          Alert('Request called');
        }

In this I have used, OnAjaxRequestEnd method,  in my script I have written this function but while executing it is giving me prompt OnAjaxRequestEnd method not found.
Please give solution for this. I am not getting where I have made mistake.
Andrey
Telerik team
 answered on 11 Feb 2013
1 answer
73 views

please can you let me know how can I bind  a business class to the Scheduler (RadScheduler)), without using sqldatasource since I have seen all the insert/upate/delete statements are listed on  it I would like to have control over this .

please can you reply ASAP or point me to a sample code that does this .

 

many thanks ,

Rohan

Plamen
Telerik team
 answered on 11 Feb 2013
5 answers
302 views
Hi,
if I write a search word in the combo, I can give the possibility that the item chosen is selected and confirmed with the tab on the keyboard? Because now I can only really select it with a click. Example I load in a combo record with its id. If I select the record in the combo only with the tab when I go to save the database I see that the id of the record in the combo is selected. however, if I click on the record of the combo everything works. I would like to speed up the management of the data that the user can select the record in the combo even just by pressing the Tad keyboard.

Then I load the data in this combo with the webservice. Is there a way that when you scroll the data to display multiple records you see the message waiting?

Then you can that when I select a record and I want to reopen the combo to select a new record, you will see the list of records from the selected one? Currently I have to delete the selected record to resume viewing records.

the code of radcombo is:

<telerik:RadComboBox ID="Comune" Runat="server" DropDownWidth="270px"
    EmptyMessage="Seleziona la tua città" EnableLoadOnDemand="True"
    Filter="StartsWith" Height="175px" MaxHeight="175px" EnableVirtualScrolling="True"
    LoadingMessage="Caricamento..." ShowMoreResultsBox="True"
    Skin="Sunset" Width="287px">
    <WebServiceSettings Method="GetCityNames" Path="WebService.asmx" />
</telerik:RadComboBox>
Hristo Valyavicharski
Telerik team
 answered on 11 Feb 2013
3 answers
156 views
I want to use a simple solution as suggested in
http://www.telerik.com/community/forums/aspnet-ajax/rotator/radrotator-resizing-issue.aspx

window.onresize=function()
  {  
     var rotatorElement = $get("<%= Rttr.ClientID %>");    
      rotatorElement.style.width = "225px";
      rotatorElement.style.height= "285px";  
   }

But why it is not working?  I used alert to check the style.width and it was set correctly. But the rotator was not refreshed.

I tried using the Ajax request (asp.net mvc4). But when I resize the browser, I have this error popup:

Unhandled exception at line 15, column 16485 in http://localhost:53858/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:c9cbdec3-c810-4e87-846c-fb25a7c08002:ea597d4b:b25378d2;Telerik.Web.UI,+Version=2012.3.1308.45,+Culture=neutral,+PublicKeyToken=121fae78165ba3d4:en-US:48dafc6d-3931-4c62-bfce-67d8969e45df:16e4e7cd:f7645509:24ee1bba:7165f74:ed16cbdc:19620875:3f6e8f3f

0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Details: Error parsing near '

 

<!DOCTYPE html>
'.

Slav
Telerik team
 answered on 11 Feb 2013
2 answers
451 views
hello
i have two tables and the grid is use them in hirarchi.
iwant to be able  to calculate both tables details on the footer. 
so far i managed to create the master table footer but it fails on calculating detail table. it claims it cant match cell to column header 
any ideas why?
Maor
Top achievements
Rank 1
 answered on 11 Feb 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?