Showing posts with label column. Show all posts
Showing posts with label column. Show all posts

Wednesday, March 28, 2012

View PDF in ATLAS?

In my existing 1.1 app, I have a datagrid with a column that, when clicked, displays a pdf file. In trying to convert it to 2.0 with Atlas, the pdf will not display, no error, but no display either. The data for the pdf is stored in SQL as binary data. I have listed the code below. If anyone could shed some light onto the issue, I'd greatly appreciate it.

If dr.Read Then
Dim byData(dr.GetBytes(0, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte
dr.GetBytes(0, 0, byData, 0, byData.Length)
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = True
Response.AddHeader("Content-Disposition", "inline;filename=" & strFileName)
Response.AddHeader("Accept-Header", byData.Length)
Response.ContentType = strContentType
Response.BinaryWrite(byData)
Response.Flush()
Response.Close()
End If

Again, any feedback would be appreciated.

Thanks.

I ended up diong the postback in a different page.

What you will need to do is have a link in your datagrid to another page (ie viewattachment.aspx?filename=filename) and then create a non ajax windows form page called viewattachment.aspx

In the viewattachment.aspx page_load method you can then place your response code as you mentioned above

I have written an example of thishere.
Clinton

Saturday, March 24, 2012

want to pass datatable (.net) to javascript function

hello,

i have a datatable stored at page level (in aspx). i am binding this datatable to gridview object which has a checkbox column for row selection.this table may contain about 500 to 1000 records. when ever i check/uncheck this checkbox, i want to update this bound datatable without posting back to server.is it possible through ajax/javascript ?

pl. provide solution for this asap...

Jayesh Shah

You will have to post back to the server if you want to update the DataTable as that is a server side object. However, you could use a UpdatePanel around the GridView to hide the fact that a full postback is occurring.