Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
170 views

As the title describes I am having an issue exporting some data from a grid to CSV.  Here is our use case:

We query data from our database, the page examines the data and then displays errors for each cell where the data is improper for the external system that the data will eventually be fed into.  After the user fixes the "first stage" errors another two error checking stages are enabled.  Once these stages are also passed, the user can then click on a button that hides all of the original rows and displays the rows we have added to the grid for export.  At this point all of the data in the database for these records has been fixed.

Once they click on the Prepare Data for Export button, they will then be able to click on the Export Data button.  Both of these buttons are asp buttons, we are not using the built-in export buttons.

 

So, once the export button is pressed the file is generated and all of our data that we want to be exported is however we have a problem where the first row in the grid is not being exported.  In the export file, the first row is blank and the ID for the record does not show up in any other row.

 

Here is a scrubbed example:

https://www.dropbox.com/s/m562savvovi8fmp/GridExport_Scrubbed.csv?dl=0

 

Here is the grid definition:

<telerik:RadGrid ID="ClaimExportGrid" runat="server" AllowAutomaticUpdates="false" DataSourceID="DDDClaimDS" OnGridExporting="OnClaimExportGridExporting" AllowFilteringByColumn="true" AllowPaging="true" PageSize="50" VirtualItemCount="50" OnExcelExportCellFormatting="OnClaimExportGridExcelExportFormatting" OnItemCreated="OnClaimExportGridItemCreated" OnItemDataBound="OnClaimExportGridItemDataBound" OnUpdateCommand="OnClaimExportGridUpdateCommand" AutoGenerateColumns="false">
                    <ClientSettings EnableRowHoverStyle="true"/>
                    <ExportSettings ExportOnlyData="true" FileName="ClinicDDDExport" HideStructureColumns="True" IgnorePaging="true" OpenInNewWindow="true"/>
                    <MasterTableView EditMode="InPlace">
                        <Columns>
                            <telerik:GridCheckBoxColumn UniqueName="BlkEdtEnabled" AllowFiltering="false" Display="false" HeaderText="Bulk Edit"/>
                            <telerik:GridCheckBoxColumn UniqueName="ChgInExptEnabled" AllowFiltering="false" Display="false" HeaderText="Change In Export"/>
                            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" />
                            <telerik:GridBoundColumn DataField="LOC" UniqueName="LOC_Export" AllowFiltering="false" HeaderText="LOC" Display="false" />
                            <telerik:GridBoundColumn DataField="Contract" UniqueName="Contract_Export" AllowFiltering="false" HeaderText="Contract" Display="false" />
                            <telerik:GridBoundColumn DataField="Assist" HeaderText="Assist" Display="false" AllowFiltering="false" UniqueName="Assist_Export" />
                            <telerik:GridBoundColumn DataField="Start Date" HeaderText="Start Date" AllowFiltering="false" DataFormatString="{0:MM/dd/yyyy}" UniqueName="StartDate_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="End Date" HeaderText="End Date" AllowFiltering="false" DataFormatString="{0:MM/dd/yyyy}" UniqueName="EndDate_Export" Display="false" />
                            <telerik:GridBoundColumn DataField="CPT" HeaderText="CPT" AllowFiltering="true" Display="false" UniqueName="CPT_Export" />
                            <telerik:GridBoundColumn DataField="Nursing" HeaderText="Nursing" AllowFiltering="false" UniqueName="Nursing_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="Units Delivered" HeaderText="Delivered" AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="UnitsDelivered_Export"  Display="false"/>
                            <telerik:GridBoundColumn DataField="Units Absent" HeaderText="Absent" AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="UnitsAbsent_Export"  Display="false"/>
                            <telerik:GridBoundColumn DataField="ServiceRate" HeaderText="ServRate" AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="ServiceRate_Export"  Display="false"/>
                            <telerik:GridBoundColumn DataField="TPLID1" HeaderText="TPL1ID" AllowFiltering="false" UniqueName="TPLID1_Export"  Display="false"/>
                            <telerik:GridBoundColumn DataField="TPLReceived1" HeaderText="TPL1Rec" AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="TPLReceived1_Export"  Display="false"/>
                            <telerik:GridBoundColumn DataField="TPLCode1" UniqueName="TPL1Code_Export" AllowFiltering="false" HeaderText="TPL1Code" Display="false" />
                            <telerik:GridBoundColumn DataField="TPLID2" HeaderText="TPL2ID" AllowFiltering="false" UniqueName="TPLID2_Export"  Display="false"/>
                            <telerik:GridBoundColumn DataField="TPLReceived2" HeaderText="TPL2Rec" AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="TPLReceived2_Export"  Display="false"/>
                            <telerik:GridBoundColumn DataField="TPLCode2" UniqueName="TPL2Code_Export" AllowFiltering="false" HeaderText="TPL2Code" Display="false" />
                            <telerik:GridBoundColumn DataField="TPLID3" HeaderText="TPL3ID" AllowFiltering="false" UniqueName="TPLID3_Export"  Display="false"/>
                            <telerik:GridBoundColumn DataField="TPLReceived3" HeaderText="TPL3Rec" AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="TPLReceived3_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="TPLCode3" UniqueName="TPL3Code_Export" AllowFiltering="false" HeaderText="TPL3Code" Display="false" />
                            <telerik:GridBoundColumn DataField="DDDSubmit" HeaderText="DDDSubmit" AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="DDDSubmit_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="ProvCtrl" HeaderText="ProvCtrl" AllowFiltering="false" UniqueName="ProvCtrl_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="AHCCCSID" HeaderText="AHCCCSID" AllowFiltering="false" UniqueName="AHCCCSID_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="ClaimID" HeaderText="ClaimID" AllowFiltering="false" UniqueName="ClaimID_Export" Display="false" />
                            <telerik:GridBoundColumn DataField="NPI" HeaderText="NPI" AllowFiltering="false" UniqueName="NPI_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="PlaceOfService" HeaderText="PlaceOfService" AllowFiltering="false" UniqueName="POS_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="SupName" HeaderText="SupervisorName" AllowFiltering="false" UniqueName="SupName_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="TherapistName" HeaderText="RenderTherapistName" AllowFiltering="false" UniqueName="TherapistName_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="PatientName" HeaderText="PatientName" AllowFiltering="false" UniqueName="PatientName_Export" Display="false"/>
                            <telerik:GridBoundColumn DataField="Tier" HeaderText="Tier" AllowFiltering="false" UniqueName="Tier_Export" Display="false" />
                            <telerik:GridBoundColumn DataField="ModifiedOn" HeaderText="ModifiedOn" AllowFiltering="false" UniqueName="ModifiedOn_Export" Display="false" />
                            <telerik:GridBoundColumn DataField="ModifiedBy" HeaderText="ModifiedBy" AllowFiltering="false" UniqueName="ModifiedBy_Export" Display="false" />
                            <telerik:GridBoundColumn DataField="ClaimID" HeaderText="ClaimID" AllowFiltering="false" UniqueName="ClaimID" />
                            <telerik:GridBoundColumn DataField="PatientID" HeaderText="PatientID" AllowFiltering="false" UniqueName="PatientID" />
                            <telerik:GridBoundColumn DataField="Assist" HeaderText="Assist" AllowFiltering="false" UniqueName="Assist" />
                            <telerik:GridBoundColumn DataField="Start Date" HeaderText="Start Date" AllowFiltering="false" DataFormatString="{0:MM/dd/yyyy}" UniqueName="StartDate" />
                            <telerik:GridBoundColumn DataField="End Date" HeaderText="End Date" AllowFiltering="false" DataFormatString="{0:MM/dd/yyyy}" UniqueName="EndDate" />
                            <telerik:GridBoundColumn DataField="CPT" HeaderText="CPT" AllowFiltering="false" UniqueName="CPT" />
                            <telerik:GridBoundColumn DataField="Units Delivered" AllowFiltering="false" HeaderText="Delivered" DataFormatString="{0:F2}" UniqueName="UnitsDelivered" />
                            <telerik:GridBoundColumn DataField="Units Absent" AllowFiltering="false" HeaderText="Absent" DataFormatString="{0:F2}" UniqueName="UnitsAbsent" />
                            <telerik:GridBoundColumn DataField="ServiceRate" AllowFiltering="false" HeaderText="Serv. Rate" DataFormatString="{0:F2}" UniqueName="ServiceRate" />
                            <telerik:GridBoundColumn DataField="TPLID1" AllowFiltering="false" HeaderText="TPL1 ID" UniqueName="TPLID1" />
                            <telerik:GridBoundColumn DataField="TPLReceived1" HeaderText="TPL1 Recv." AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="TPLReceived1" />
                            <telerik:GridBoundColumn DataField="DDDSubmit" HeaderText="DDD Submit" AllowFiltering="false" DataFormatString="{0:F2}" UniqueName="DDDSubmit" />
                            <telerik:GridBoundColumn DataField="RenderingTherapistID" AllowFiltering="false" HeaderText="RenderingTherapistID" UniqueName="RenderingTherapistID" />
                            <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="SupervisorID" AllowFiltering="false" UniqueName="EmployeeID" />
                            <telerik:GridBoundColumn DataField="SupNAme" HeaderText="Supervisor Name" AllowFiltering="false" UniqueName="SupName" />
                            <telerik:GridBoundColumn DataField="AHCCCSID" HeaderText="AHCCCS ID" AllowFiltering="false" UniqueName="AHCCCSID" />
                            <telerik:GridBoundColumn DataField="NPI" HeaderText="NPI" AllowFiltering="false" UniqueName="NPI" />                           
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>

 

Here are the sections of the code where we are dealing with the grid before export:

 

OnItemDataBound event:

If ViewState("BExported") Then
                If Not bCallOnce Then
                    EnableExportCols()
                    bCallOnce = True
                End If
 
                If eItmMap.Count > 0 Then
                    Dim conStr As String = ConfigurationManager.ConnectionStrings("H2T2SQLDBCConnectionString").ConnectionString
                    Dim newNPI As String = ""
                    Dim newAhcccsID As String = ""
 
                    If eItmMap.ContainsKey(grdDataItm.Item("ClaimID").Text) Then
                        Using con As New SqlConnection(conStr)
                            Using cmd As New SqlCommand("Select @AHCSID = AHCCCSID, @NPI = NPI from TherapistCredentials where EmployeeID = @NewSupID", con)
                                cmd.Parameters.Add("@NewSupID", SqlDbType.Int).Value = eItmMap(grdDataItm.Item("ClaimID").Text).GetSupID()
                                cmd.Parameters.Add("@AHCSID", SqlDbType.VarChar, 10)
                                cmd.Parameters.Add("@NPI", SqlDbType.VarChar, 20)
                                cmd.Parameters("@AHCSID").Direction = ParameterDirection.Output
                                cmd.Parameters("@NPI").Direction = ParameterDirection.Output
 
                                con.Open()
                                cmd.ExecuteNonQuery()
                                con.Close()
 
                                newNPI = If(IsDBNull(cmd.Parameters("@NPI").Value), "", cmd.Parameters("@NPI").Value)
                                newAhcccsID = If(IsDBNull(cmd.Parameters("@AHCSID").Value), "", cmd.Parameters("@AHCSID").Value)
 
                                grdDataItm.Item("NPI_Export").Text = newNPI
                                grdDataItm.Item("AHCCCSID_Export").Text = newAhcccsID
                            End Using
                        End Using
                    End If
                End If
            Else
                ......

 

EnableExportCols Function:

Private Sub EnableExportCols()
        For Each col As GridColumn In ClaimExportGrid.MasterTableView.Columns
            If TypeOf col Is GridBoundColumn Then
                Dim bCol As GridBoundColumn = CType(col, GridBoundColumn)
 
                If bCol.UniqueName.Contains("Export") Then
                    bCol.Visible = True
                    bCol.Display = True
                Else
                    bCol.Visible = False
                    bCol.Display = False
                End If
            End If
        Next
    End Sub

 

 

As you can see in the attached csv file, the first row is missing and the ID CL 733083 is not present in the file.  How can we resolve this?

 

Thanks.

Attila Antal
Telerik team
 answered on 10 Apr 2019
1 answer
309 views

I have an programmatically built Ajaxified RadGrid that is being built when the RadToolTipManager is called and TheRadToolTipManager_AjaxUpdate event is triggered. The tool tip and grid works and shows all the data I am looking for, and I would like to be able to export the data. I am using the built-in export button that the RadGrid has available, but when I click the export button it disappears and no export file is created. I have read the Export from Ajaxified Grid page and understand that the built-in button already performs the post backs, so I am stuck. 

 

Programmatically built RadGrid:

private void UpdateToolTip(string elementID, UpdatePanel panel)
{
      RadGrid toolTipGrid= new RadGrid();
      toolTipGrid.ID = "ToolTipGridID";
      toolTipGrid.AutoGenerateColumns = false;
      toolTipGrid.EnableViewState = false;
      toolTipGrid.MasterTableView.ExpandCollapseColumn.Visible = false;
                 
      GridBoundColumn boundColumn = new GridBoundColumn();
      boundColumn.DataField = "Data1";
      boundColumn.HeaderText = "Data1";
      boundColumn.DataType = typeof(string);
      boundColumn.UniqueName = "Data1";
      boundColumn.Exportable = true;
      toolTipGrid.MasterTableView.Columns.Add(boundColumn);
 
      boundColumn = new GridBoundColumn();
      boundColumn.DataField = "Data2";
      boundColumn.HeaderText = "Data2";
      boundColumn.DataType = typeof(int);
      boundColumn.UniqueName = "Data2";
      boundColumn.Exportable = true;
      toolTipGrid.MasterTableView.Columns.Add(boundColumn);
 
      // Export stuff
      toolTipGrid.MasterTableView.CommandItemSettings.ShowExportToExcelButton = true;
      toolTipGrid.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
      toolTipGrid.MasterTableView.CommandItemSettings.ShowRefreshButton = false;
      toolTipGrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Bottom;
 
      toolTipGrid.ItemCommand += toolTipGrid_ItemCommand;                      
 
      toolTipGrid.AllowPaging = true;
      toolTipGrid.PageSize = 20;
      toolTipGrid.PagerStyle.Mode = GridPagerMode.NextPrev;
      toolTipGrid.NeedDataSource += CargoMileageInfo_NeedDataSource;
                 
      toolTipGrid.DataSource = DataForToolTip;
      toolTipGrid.DataBind();
 
      panel.ContentTemplateContainer.Controls.Add(toolTipGrid);       
}

 

The button triggers the toolTipGrid_ItemCommand

private void toolTipGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
    RadGrid toolTipGrid= (RadGrid)sender;
 
    if (e.CommandName == RadGrid.ExportToExcelCommandName)
    {
        toolTipGrid.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
        toolTipGrid.ExportSettings.IgnorePaging = true;
        toolTipGrid.ExportSettings.ExportOnlyData = true;
        toolTipGrid.ExportSettings.OpenInNewWindow = true;
    }
}

 

Advance DataBind:

private void toolTipGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    RadGrid toolTipGrid= (RadGrid)sender;
 
    toolTipGrid.DataSource = DataForToolTip;
}

 

 

 

This may be related, but I have debugged and stepped through my code to see where it breaks when the button is clicked, and I get this error, "JavaScript runtime error: Unable to get property 'Cols' of undefined or null reference occurred."

Attila Antal
Telerik team
 answered on 10 Apr 2019
7 answers
139 views
Does the context menu support multi-column?  I'm following this http://demos.telerik.com/aspnet-ajax/menu/examples/multicolumnmenu/defaultcs.aspx but it seems to have no bearing on context menus.
Rumen
Telerik team
 answered on 10 Apr 2019
3 answers
191 views

Hi Team,

We are trying to do copy the images along with Text content from RadEditor to Word File,

We are geting the text content only images are not geting in word file. 

please can you help me.

 

 

Thanks and Regards,

Narenderreddy

Rumen
Telerik team
 answered on 10 Apr 2019
1 answer
207 views

Do you have an example similar to your Server-Side Data Binding example that, instead of creating markers, creates the shapes (similar to the earthquake example) from the Server Side?

I have all my geo locations and condition data stored in SQL and need to dynamically build a layer to show the shapes, sized and colored, based on the condition data queried from SQL.

any direction would be appreciated.

Rumen
Telerik team
 answered on 10 Apr 2019
3 answers
175 views
Hi,

I have a page running a generated Crystal Report which is producing a PDF file.  I then display this using the following code:

Using client As System.Net.WebClient = New System.Net.WebClient()
    HttpContext.Current.Response.ContentType = "application/pdf"
    HttpContext.Current.Response.WriteFile(FileName)
    HttpContext.Current.Response.Flush()
    HttpContext.Current.Response.Close()
    HttpContext.Current.Response.End()
End Using

This works fine when the page does not use Ajax, but as soon as I add Ajax to it an error gets thrown.  I would like to Ajaxify the page so I can show a progress spinner as the report is generated, rather than leave a few seconds when it looks like nothing is happening.

If I remove Ajax from the page thie code works fine.

Add Ajax and it stop working.

Is there an alternative, or better method of showing the PDF (I also show a Word or Excel document, depending on the selection the user has made)

Dave Penny
Peter Milchev
Telerik team
 answered on 10 Apr 2019
3 answers
174 views

Dear all,

I need your help for my Web application. The problem is the incorrect display of the menu.
The application works correctly through VisualStudio and also by publishing to the local IIS of the computer where I installed the development software (image1). When publishing on the remote server (IIS10, Windows Server 2016) The menu appears as (Image2).

I attached also the application pool and the web.config of the server.
Can Someone help me?

Best Regards

Andrea Novelli

Rumen
Telerik team
 answered on 09 Apr 2019
1 answer
119 views

Hi,

I have a grid with template columns. In the grid, the rows are merged when the data are same. Since the number of columns in the grid are exceeding the grid's view, it is set to be scrollable. The problem is, when the grid is scrolled, there control in the column went missing.

This is the code that I use to merge the row

Protected Sub gvMain_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles gvMain.PreRender
        For Each dataItem As GridDataItem In gvMain.MasterTableView.Items
 
            If (dataItem.OwnerTableView.Name = "gvMain") Then
                Dim gtv As GridTableView = CType(dataItem.OwnerTableView, GridTableView)
                For rowIndex As Integer = gtv.Items.Count - 2 To 0 Step -1
                    Dim row As GridDataItem = gtv.Items(rowIndex)
                    Dim previousRow As GridDataItem = gtv.Items(rowIndex + 1)
 
                    If row("Name").Text = previousRow("Name").Text Then
                        For col As Integer = gtv.Columns.Count - 1 To 0 Step -1
                            Dim gbcCol As String = CType(gvMain.MasterTableView.Columns(col).UniqueName, String)
 
                            If Not (gbcCol.Equals("inclTrx") Or gbcCol.Equals("inclKYC") Or _
                                gbcCol.Equals("ShareholdingID") Or gbcCol.Equals("Shareholding") Or gbcCol.Equals("Remark")) Then
                                row(gbcCol).RowSpan = If(previousRow(gbcCol).RowSpan < 2, 2, previousRow(gbcCol).RowSpan + 1)
                                previousRow(gbcCol).Visible = False
                                previousRow(gbcCol).Text = " "
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

 

Any thoughts?

Eyup
Telerik team
 answered on 09 Apr 2019
7 answers
686 views

hi all again, i asked you about muptiple line series  in radchart in this post: https://www.telerik.com/forums/multiple-line-series-radhtmlchart

I created RadHtmlChart with the same parameters as previous post and using SqlDataSource. And this is my ASPX code:

    <telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" DataSourceID="dsJournal"><br>        <PlotArea><br>            <YAxis MaxValue="100" MinValue="-100"><br>            </YAxis><br>            <Series><br>                <telerik:LineSeries DataFieldY="param_d" Name="LineSeries1"><br>                </telerik:LineSeries><br>                <br>            </Series><br>            <XAxis DataLabelsField="sensor_type"><br>                <LabelsAppearance RotationAngle="-90" Visible="false"></LabelsAppearance><br>            </XAxis><br>            <CommonTooltipsAppearance Visible="true" Shared="true" /><br>            <YAxis Step="10000"></YAxis><br>        </PlotArea><br>        <br>    </telerik:RadHtmlChart>

 

This is my C# code with setting RadHtmlChart:

        protected void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)<br>        {<br>            e.SeriesItem.Name = (string) DataBinder.Eval(e.DataItem, "sensor_type");<br>        }

Bellow i will attach two picture: 

1. what i have right now in RadHtmlChart with one LineSeries

2. the same structure table from database, where i need only a column "sensor_type" for multiple LineSeries in RadHtmlChart.

 

Thank you for your attention, i hope you will help me, and sorry for two similar post

Marin Bratanov
Telerik team
 answered on 09 Apr 2019
0 answers
121 views
I have to provide the estimate to one our client for the migration of Telerik UI component upgrade from 2014.1.403 to latest.
When application is upgrade with 2019.1.215(trail) and tried to Build the application its raise the build errors for RadSearchBox.

Error
CS1061
'RadSearchBox' does not contain a definition for 'OnClientValueChanged' and no extension method 'OnClientValueChanged' accepting a first argument of type 'RadSearchBox' could be found (are you missing a using directive or an assembly reference?)

Error
CS1061
'RadSearchBox' does not contain a definition for 'OnClientDataRequested' and no extension method 'OnClientDataRequested' accepting a first argument of type 'RadSearchBox' could be found (are you missing a using directive or an assembly reference?)


Now, These methods mention above are no more exists with SearchBox then “What is the alternate approach/method we have for these method?”
Hemant
Top achievements
Rank 1
 asked on 09 Apr 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?