Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...re:error ."Cannot use a leading .. to exit above the top directory". re:error ."Cannot use a leading .. to exit above the top directory".
Previous
 
Next
New Post
4/21/2008 2:54 AM
 

Hi All,

Now i have changed the datagrid to display only text name of competencie.Heres the code below for datagrid.


<asp:datagrid id="lstexport" AutoGenerateColumns="false" width="600px" DataKeyField="CompetencyId"AllowSorting="false" CellPadding="4" GridLines="none" cssclass="DataGrid_Container" runat="server" AllowPaging="false">
<columns>
<asp:TemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
 <itemtemplate>
    <asp:label ID="Label11" runat="server" text='<%# DataBinder.Eval(Container.DataItem,"CompetencyName") %>' Height="20" ></asp:label>
</ItemTemplate>
</asp:TemplateColumn>
</columns>
</ASP:DATAGRID>

And the back end file function is as follows i mean the vb code.On clicking on the menu item it will display a panel which contains the above grid

Sub displayexport()
Dim Competencylist As List(Of CompetencyInfo)
Competencylist = CompetencyController.sampleexport()
If Competencylist.Count > 0 Then
lstexport.DataSource = Competencylist
lstexport.DataBind()
pnlexport.Visible = True
Else
pnlCompetencies.Visible = False
End If
End Sub

And in the grid theres a link export to excel at the bottom which has the following function


Protected Sub lnkexport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkexport.Click' Set the content type to Excel

Response.Clear()
Response.AddHeader(Response.Charset = "content-disposition", "attachment;filename=myexcelfile.xls")
Response.Cache.SetCacheability(HttpCacheability.Public)
Response.ContentType = "application/vnd.xls"
htmlWrite.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Html)
Dim StringWriter As New StringWriterDim htmlWrite As New HtmlTextWriter(StringWriter)True
lstexport.GridLines = GridLines.Both
lstexport.AllowPaging = False
lstexport.AllowSorting = False
Render(htmlWrite)
lstexport.RenderControl(htmlWrite)
htmlWrite.RenderEndTag()
Response.Write(StringWriter)
Response.End()
End Sub


Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)If Not (Page Is Nothing) Then
Page.VerifyRenderingInServerForm(lstexport)
MyBase.Render(writer)
End Sub
End If

So when i remove this render control function and execute i get the following error in a javascript popup and nothing happens.All my function goes through fine when i debug the code and after that i get this popup with the error
 

Sys.WebForms.PageRequestManagerParserErrorException Message recieved from the server could not be parsed.Common causes for this error are when a response is modfied by calls to Response.Write(),Response filters,Http Modules or server trace is enabled.etc...

and when i uncomment the render function i get the following error near the line Page.VerifyRenderingInServerForm(lstexport) in the render function

Control 'dnn_ctr386_Competency_lstexport' of type 'DataGrid' must be placed inside a form tag with runat=server.

Please can somebody help regarding this.I am really out of clues now.and need it urgently

Thanks,

Sandeep

 

 
New Post
4/21/2008 9:13 AM
 

okay lets look at this another way do you really need this as a html grid to get it into excel? 
What about a CSV file the following will provide a csv output from a data grid with an excel datatype and extention

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;filename=ExcelReport.xls;")
Response.Charset = String.Empty
Me.EnableViewState = False
'Pass output stream to the StreamWriter
Dim objStreamWriter As New IO.StreamWriter(Response.OutputStream)
'Write text
Dim str As String
Dim i As Integer
Dim j As Integer
Dim headertext As String = "Product Id, Name, Sell Price, Quantity"

objStreamWriter.WriteLine(headertext)
For i = 0 To (Me.GridView1.Rows.Count - 1)
  For j = 1 To (Me.GridView1.Columns.Count - 1)
    str = (Me.GridView1.Rows(i).Cells(j).Text.ToString() & ",")
    objStreamWriter.Write(str)
  Next
  objStreamWriter.WriteLine()
Next

'Close the stream
objStreamWriter.Close()

 

Hope that helps

John


John Nicholson
 
New Post
4/21/2008 10:47 AM
 

Hi john,

         Thanks for your reply.My client needs it for excel.tHIS IS NOT MY MODULE.iI am developing it for my client.He will upload an excel file itself and i have written the import/export of data into db also for excel.please see you can help me

Thanks a lot,

Sandeep.M

 
New Post
4/22/2008 1:06 AM
 

Hi John and All Again,

              I have found a small clue.When i turn off the "supports partial rendering" option i can get the excel file only for text column.But here i need ajax functionality since for paging etc i dont want my page to be refreshed.And also My datagrid contains image buttons which are displayed through the url from the database and also link buttons which redirect to another control for editing for each item in the grid.please check with this and someone please help.Meanwhile i will also try to find a solution.

Thanks,

Sandeep.M

 
New Post
4/22/2008 4:32 AM
 

OKay I think I'm just about out of ideas only one I can think of is why not create an office xml file using the xls extention... I'm really not sure if it would work for you import but might be worth a try, you could simply adjust the function used for creating a csv file. Here's an example excel xml:

<?xml version="1.0"?>
<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
    <ss:Styles>
        <ss:Style ss:ID="1">
            <ss:Font ss:Bold="1"/>
        </ss:Style>
    </ss:Styles>
    <ss:Worksheet ss:Name="Sheet1">
        <ss:Table>
            <ss:Column ss:Width="80"/>
            <ss:Column ss:Width="80"/>
            <ss:Column ss:Width="80"/>
            <ss:Row ss:StyleID="1">
                <ss:Cell>
                    <ss:Data ss:Type="String">First Name</ss:Data>
                </ss:Cell>
                <ss:Cell>
                    <ss:Data ss:Type="String">Last Name</ss:Data>
                </ss:Cell>
                <ss:Cell>
                    <ss:Data ss:Type="String">Phone Number</ss:Data>
                </ss:Cell>
            </ss:Row>
            <ss:Row>
                <ss:Cell>
                    <ss:Data ss:Type="String">Brian</ss:Data>
                </ss:Cell>
                <ss:Cell>
                    <ss:Data ss:Type="String">Jones</ss:Data>
                </ss:Cell>
                <ss:Cell>
                    <ss:Data ss:Type="String">(425) 123-4567</ss:Data>
                </ss:Cell>
            </ss:Row>
          </ss:Table>
    </ss:Worksheet>
</ss:Workbook>


John Nicholson
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...re:error ."Cannot use a leading .. to exit above the top directory". re:error ."Cannot use a leading .. to exit above the top directory".


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out