|
I tested your div tag, shortened to 100 px to force a vertical scroll bar, with a DataGrid loaded with data in VS2008. It worked just fine in IE8 and Mozilla 5. There has to be more to the story (code), to 'break' it, as the earlier commenter said.
<div style="height: 100px; overflow: auto;">
<asp:DataGrid runat="server" DataSourceID="LinqDataSource1"></asp:DataGrid>
</div>
Regards,
Gary
modified on Monday, July 13, 2009 9:31 PM
|
|
|
|
|
Have you added anything else to the page, try the page with just the div and datagrid. If that works try adding the other controls one at a time, it could be one of the controls above the div not terminated.
|
|
|
|
|
I have written the following code to display PDF is ASP.NET.
Dim strFilePath As String = Server.MapPath(".") & "\CollegeWriteUps\Vision.pdf"
Dim client As New WebClient
Dim buffer() As Byte = client.DownloadData(strFilePath)
Response.Clear()
If strFilePath.EndsWith(".pdf") Then
Response.ContentType = "application/pdf"
Response.AddHeader("content-length", buffer.Length.ToString())
Response.Flush()
Response.BinaryWrite(buffer)
End If
In Firefox, the web-page on which to show the PDF shows up blank, that too in new window/tab. Worst thing, the PDF shows up in Acrobat reader.
In IE, it simply shows up the dialog box asking for Open or Save the file.
How do I show the PDF in the same window/tab (in the browser)?
Thanks in advance.
|
|
|
|
|
Kumar Kush wrote: Worst thing, the PDF shows up in Acrobat reader.
Of course it does. The ONLY way a browser can show a PDF, is if Acrobat is installed, and then it runs in your browser.
Kumar Kush wrote: Dim client As New WebClient
Dim buffer() As Byte = client.DownloadData(strFilePath)
I have no idea what this is, but Response.WriteFile is the best way to write out a file, because you don't create a copy in memory.
Kumar Kush wrote: If strFilePath.EndsWith(".pdf") Then
Given that your path is hard coded, this seems superfluous.
Overall, what you're doing should work. I don't know why IE is not opening it with Acrobat, I would have expected it to, unless Acrobat is not installed for IE, for some strange reason. you could also try adding a Response.End at the end of all that, and see if it makes any difference, but I doubt it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Place an iframe on your page and set the path of PDF to its src. If the client machine has Acrobat, it will open in the iframe.
|
|
|
|
|
Hi friends,
Im trying to show some images from the database into a Gridview.
I bounded the Gridview to the datasource:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" Height="152px" Width="216px">
<Columns>
<asp:ImageField DataImageUrlField="pic">
</asp:ImageField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:studentConnectionString %>"
SelectCommand="SELECT [pic] FROM [pics]"></asp:SqlDataSource>
</form>
The problem is that i don't see the pics, bud only a image with a cross(X).
What is the reason for that?
Thanks.
|
|
|
|
|
|
Hi Abhijit,
Thanks for reseponse. I saw your article and i checked the path, im sure that the path is okay:
C:\Documents and Settings\HA\Mijn documenten\Visual Studio 2008\WebSites\student\\images\100_4567.jpg
Bud still the same problem
|
|
|
|
|
Priya Prk wrote: WebSites\student\\images\100_4567.jpg
This path is not ok, it has a double slash in it
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You are right, that path was not valid. i removed one slash, bud it still did'nt worked.
To test is better i placed a image(image1.jpg) in C dir.
The path is : C:\image1.jpg
Bud it is still not working. i m confused
|
|
|
|
|
One thing - your path needs to be below the root of your website, you can't load images or other files from the file system as a whole, your web root is the root of your virtual file system. Other than that, I would look at the source to see what path is being passed in, to make sure it's valid in the browser.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi all,
Im having a problem where if i run a ajax based website on my developement machine using the Visual studio intergrated websever my ajax control works as expected all the ajax callback work.
If i publish the website to my live server(settings below) all the other controls work but ajax functionality gives a error message
"There was an error in callback" then what looks like a long string of random chars probably a hash.
Has anyone had anything similar? is there anything specifice i need to do to my IIS setup to get AJAX working propertly? Or would this be an error in my code, although if it where i dont see how it would work from Visual studio.
IIS Server Setup
On the ASP.NET tab of the site properties the site is set to, version 2.0.50727 and the website has its own application Pool.
Server is setup using Windows 2003 version 5.2.3790 SP2 Build 3790 and has .NET Framework 3.5 SP1
installed.
Thanks in advance
Phil
|
|
|
|
|
I think the server side function which ajax trying to execute is throwing an exception. Have you done any error handling functionality? Check your error logs.
|
|
|
|
|
Cheers ill check the logs tomorrow, when im in work again and update.
Phil
|
|
|
|
|
I think i am getting an exception but the code i wont to write into the event log isnt working.
Its a permission thing, i've created an event source in the registry but it still isnt writing too it. Im going to try to track down the users ASP is running under on my server and then all that user write permissions.
Thanks for the help, its always nice to go back to basics
|
|
|
|
|
Why on earth does every form I create run the Form_Load event when I click a button on the form? Is there something I am missing in the switch from Windows Forms to Web Forms? I feel like a right n00b on this but it is driving me mad to find that everytime it clears the form before trying to run the code.
A bit of further explanation...
I have a web-form application that dynamically sets itself up depending on who is looking at it. If an item in a list is selected and then a button clicked that should take you to another form, instead we are taken back through the form setup, which of course reloads the data back into the lists and therefore removes the selectedItem references.
So if anyone can help me stop my app doing this inane activity I will be grateful.
|
|
|
|
|
You need to understand that the way Windows executes program is completely different from the way you will see in your Web(ASP.Net) application.
The first thing one should write on the wall before starting any web application is that Web is stateless[^](or Google for a better answer).
Here [^]is a very good explanation regarding the order of events in ASP.Net page life.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
By the sounds of it you need to check the isPostBack property of the Page object. This is used to tell if its the first time the page is loaded or its a postback.
If its the first time you would want to do things like your dynamic setup of the form i.e. fill in items in a dropdown box or create dynamic controls but you wouldnt want to do this everytime the page loads, otherwise you end up added the same information twice to the page.
Look at the Asp.net Page Life Cycle from that you will find that the page load event will run when before the onclick event of the button.
See here http://msdn.microsoft.com/en-us/library/ms178472.aspx[^]
If you want the button to redirect to another page then you can use
Response.redirect("Somepage.aspx")
or
Server.Transfer("Somepage.asx")
Each has its own merits i would depend on what you are trying to achive.
Hope that helps
Phil
|
|
|
|
|
hi all i try to make slid show and i use it in a usercontrol
it works well but i want to get the image array from cs file
here is the code
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="JavaHomePhotoAlbum.ascx.cs" Inherits="taboukproject.UserControls.JavaHomePhotoAlbum" %>
<script type="text/javascript" src="../Scripts/dropinslideshow2.js">
</script>
<div style="width: 205px; height: 180px;" align="right">
<script type="text/javascript">
//Define Image Array. Syntax: ["image_path", "url_destination", "url_target"]
var myimages=new Array();
myimages[0]=["../Images/TabukImages/castle1.jpg", "", ""]
myimages[1]=["../Images/TabukImages/castle2.jpg", "http://www.dynamicdrive.com", ""]
myimages[2]=["../Images/TabukImages/castle4.jpg", "http://www.javascriptkit.com", "_new"]
//Create new drop-in slideshow
//Syntax: new dropinslideshow(image_array, slideshow_width, slideshow_height, delay_before_rotation)
new dropinslideshow(myimages, 200, 160, 3000)
</script>
</div>
please i want to know how can i atchive it
i try this code but not working
var myimages=new Array(<%ImagesArray(); %>);
the method ImageArray returns arraylist but i can't see it inside the script
even i set the method to public
MD_NADA
|
|
|
|
|
You need to user ScriptManager.RegisterArrayDeclaration
Have a look here[^]
only two letters away from being an asset
|
|
|
|
|
Hello friends,
I waana a promotion message box when i click on close button which is at the top of the browser.How can i do it? It may be a javascript code.
Thanks in advance.
Cheers,
MAHESH
|
|
|
|
|
Use onclose event and use window.alert for the message.
Books are as useful to a stupid person as a mirror is useful to a blind person. - Chanakya
|
|
|
|
|
Greetings,
I have loaded checkboxes in asp table control at form load evevt; from database.
Now I want to get all checked values in 1 array.
I used for each loop & stored control in 1 checkbox object & if that is checked then add value in array.
my code is as follows
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
fillControls()
End If
End Sub
in fillControls(), I took datatable for Id & name. & added checkboxes as
Dim objTr As New TableRow
For intCnt = 0 To objDataTable.Rows.Count - 1
If intCnt Mod 4 = 0 Then
objTr = New TableRow
table1.Rows.Add(objTr)
End If
Dim objTd As New TableCell
Dim objChk As New CheckBox
objTr.Cells.Add(objTd)
objTd.Controls.Add(objChk)
objChk.Attributes.Add("runat", "server")
objChk.ID = objDataTable.Rows(intCnt).Item(0)
objChk.Text =objDataTable.Rows(intCnt).Item(1)
Next
And when user submit the form< I want to get all id's of checkboxes in 1 array
for that I wrote,
Dim arrSubMnu() As Integer = New Integer() {}
For Each ctl As Control In table1.Controls
If TypeOf ctl Is CheckBox Then
If CType(ctl, CheckBox).Checked = True Then
ReDim Preserve arrIds(arrIds.Length)
arrIds(arrIds.Length) = ctl.ID
End If
End If
Next ctl
I couldn't find out where is error.I am not getting anything in array
Please Help Me to solve this problem
|
|
|
|
|
What is the definition for table1 variable? Is it public? as from the code it looks like it could be used as a local variable.
You could set a break point on the line starting "For Each ctl As Control In table1.Controls" and see if it says that the table contains any controls
If it does then then next line to look at would be the runtime values of the "If CType(ctl, CheckBox).Checked = True Then" line does it say the value is checked? how does that corrospone to the database values?
Any chance you could post the code as a code block? the entire page and behind code?
Phil
|
|
|
|
|
Controls created at runtime will lost at the time of post back. One solution is to call fillControl function outside the If Not IsPostBack checking.
|
|
|
|