Richa,
Thank you for the reply and the example. I have tried the example you provided using the C1GridView with no success.
The following is the aspx markup…
<%@ Page Title=“” Language=“vb” AutoEventWireup=“false” MasterPageFile=“~/DCI.Web.Core.Master” CodeBehind=“CRD0210.aspx.vb” Inherits=“DCI.Web.Core.CRD0210” %>
<%@ Register Assembly=“C1.Web.UI.Controls.3” Namespace=“C1.Web.UI.Controls.C1GridView” TagPrefix=“C1gv” %>
<asp:Content ID=“fpContent” ContentPlaceHolderID=“cphMisc” runat=“server”>
</asp:Content>
<asp:Content ID=“Content1” ContentPlaceHolderID=“ContentPlaceHolder1” runat=“server”>
<asp:UpdatePanel ID=“UpdateContent” runat=“server”>
…(I’ve remove a large unrelated portion)…
<act:CollapsiblePanelExtender ID="cpeDepartment" runat="server" Enabled="True" TargetControlID="pnlDepartment"
Collapsed="false" CollapsedImage="<%$ Image: CollapseBottom %>" ExpandedImage="<%$ Image: CollapseTop %>"
CollapseControlID="imgDepartmentPanel" ExpandControlID="imgDepartmentPanel" ImageControlID="imgDepartmentPanel"
SuppressPostBack="True">
</act:CollapsiblePanelExtender>
<table width="100%" style="border-collapse: collapse;">
<tr>
<td class="SubHeaderSection" valign="bottom">
EXCEL
</td>
<td align="right" class="SubHeaderSection" valign="bottom">
<asp:ImageButton ID="imgDepartmentPanel" runat="server" CausesValidation="False"
ImageUrl="<%$ Image: CollapseTop %>" ToolTip="Show/Hide Department panel" />
</td>
</tr>
</table>
<asp:Panel ID="pnlDepartment" runat="server">
<table width="100%">
<tr>
<td>
<C1gv:C1GridView ID="gvDepartments" runat="server" Height="250px" Width="750px"
ScrollSettings-ScrollMode="ScrollBar" ScrollSettings-ScrollOrientation="Both"></C1gv:C1GridView>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
The following is the VB code behind…
this is in a button function…
gvDepartments.DataSource = GetDataTable()
gvDepartments.DataBind()
Public Function GetDataTable() As DataTable
Try
xlBook = LoadSpreadSheet(Server.MapPath("Book1.xlsx"))
XLSheet = xlBook.Sheets(0)
dtSheet = New DataTable(XLSheet.Name)
Dim intColumn As Integer = 0
For i As Integer = 0 To XLSheet.Columns.Count - 1
'The fourth row contains the column titles...
If XLSheet(3, i).Value IsNot Nothing Then
If XLSheet(3, i).Value.ToString.Trim.Length > 0 Then
dtSheet.Columns.Add(XLSheet(3, i).Value.ToString)
Else
intColumn += 1
dtSheet.Columns.Add("Column " + intColumn.ToString)
End If
End If
Next
For i As Integer = 0 To XLSheet.Rows.Count - 1
Dim drSheet As DataRow = dtSheet.NewRow
For c As Integer = 0 To dtSheet.Columns.Count - 1
If xlSheet.GetCell(i, c) IsNot Nothing AndAlso _
xlSheet.GetCell(i, c).Value IsNot Nothing AndAlso _
xlSheet.GetCell(i, c).Value.ToString.Trim.Length > 0 Then
drSheet(c) = xlSheet.GetCell(i, c).Value.ToString
Else
drSheet(c) = String.Empty
End If
Next
dtSheet.Rows.Add(drSheet)
Next
Catch ex As Exception
GlobalException.ThrowException(Me.ToString, System.Reflection.MethodBase.GetCurrentMethod.Name, Nothing, ex)
End Try
End Function
Public Function LoadSpreadSheet(ByVal strPath As String) As C1XLBook
Try
xlBook = New C1XLBook
xlBook.Load(strPath, FileFormat.OpenXml, True)
Catch ex As Exception
GlobalException.ThrowException(Me.ToString, System.Reflection.MethodBase.GetCurrentMethod.Name, Nothing, ex)
End Try
Return xlBook
End Function
Follows is a Firebug representation after the page is rendered…
I’ve also attached the spreadsheet I’m trying to load.
As you can see, the column group is empty.
What could I be doing incorrectly?
Thank you, again, for you time and effort,
Rodney
2011/11/Book1.xlsx