Jump to content

form post from excel to web page


Crazy_Robert

Recommended Posts

Na project lo Reports unayi.. report options either Html or Excel . result screens lo fields ki Hyperlinks unnayi.. avi click chesthe vere page ki navigate ayyi  details display avthayi.. ivi hard coded URLs laga kakunda form post chesthunna 

HTML tho no issues ..Excel thone badha..

Its not a web page. So form post option undadhu. maa manager emo pakka form post thone cheyyali antaru. 

Hard coded URLS tho voddhu antunnadu.

Any idea...Excel lo form post untadhaaa ? 

Web page ante values ni hidden controls lo pamputham.. mari excel ki ela pamputham values ? 

even form post chesina " No records found" error vosthundhi gaaa..

Experts ? 

 

Link to comment
Share on other sites

 If report.RecordFound = True And request.REPORT_FORMAT = "Excel" Then

                Dim gv As New GridView()

                gv.AutoGenerateColumns = False

                'Below add columns that you display in html table
                gv.Columns.Add(New BoundField() With {
                    .HeaderText = "Field 1",
                    .DataField = "Field 1",
                    .HtmlEncode = False
                })
                gv.Columns.Add(New BoundField() With {
                    .HeaderText = "Field 2",
                    .DataField = "Field 2"
                })
                gv.Columns.Add(New BoundField() With {
                    .HeaderText = "Field 3",
                    .DataField = "Field 3",
                    .HtmlEncode = False
                })
                gv.Columns.Add(New BoundField() With {
                    .HeaderText = "Field 4",
                    .DataField = "Field 4"
                })gv.Columns.Add(New BoundField() With {
                    .HeaderText = "Field 5",
                    .DataField = "Field 5"
                })
                gv.Columns.Add(New BoundField() With {
                    .HeaderText = "Field 6",
                    .DataField = "Field 6"
                })

                'add columns to data table aslo as shown below
                Dim dt As New DataTable()
                dt.Columns.Add("Field 1")
                dt.Columns.Add("Field 2")
                dt.Columns.Add("Field 3")
                dt.Columns.Add("Field 4")
                dt.Columns.Add("Field 5")
                dt.Columns.Add("Field6")

                'loop through the records received from database
                For Each record In report.recordList
                    dt.Rows.Add("<a href='" + url2 + record.Field 1+ "'>" + record.Field 1 + "</a>", record.DMV_USER_ID, "<a href='" + url1 + record.Field 2 + "'>" + record.Field 2 + "</a>", record.Field 3, record.Field 4, record.5)
                Next

                gv.DataSource = dt
                gv.DataBind()

                For i As Integer = 0 To report.recordList.Count - 1
                    gv.Rows(i).Height = 40
                Next

                'Dim resp As HttpResponse
                Response.ClearContent()
                Response.Buffer = True
                Response.AddHeader("content-disposition", "attachment; filename=Report.xls")
                Response.ContentType = "application/ms-excel"
                Response.Charset = ""
                Dim sw As New System.IO.StringWriter()
                Dim htw As New HtmlTextWriter(sw)
                gv.RenderControl(htw)
                Response.Output.Write(sw.ToString())
                Response.Flush()
                Response.End()


            End If

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...