|
Hello,
I have a datagrid populating about 60,000 rows from a view. I have set the paging to show only 10 rows at a time. This data ia being filtered before it shows these 60,000 values. It is very slow and sometimes the grid timesout. I did increase the server.scripttimeout to 300 seconds. and this has helped a bit but not a lot.
any ideas suggestions would be helpful.
thank you.
|
|
|
|
|
Sounds like you are filtering the data on the client side with the Grid. Not a good idea. Filter as much data as you can on the server so you are not sending 60,000 records to the client machine. This will avoid the grid timing out.
|
|
|
|
|
I've recently been given a task to take information out of a SQL database and display it on a site. I didn't create the database or the application that stores information on the database, but there are images stored in the database that I must display on my site. The images stored are of different sizes which I'm sure of until I pull them out using a Generic HTTP handler on my site. I've got to show thumbnails of these images so I was was wondering if I could use something that could do this dynamically in code.
The following is the handler I am using:
<%@ WebHandler Language="VB" Class="ShowImage" %>
Imports System
Imports System.Configuration
Imports System.Web
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports util
Public Class ShowImage : Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim staffID As Integer
If Not context.Request.QueryString("id") Is Nothing Then
staffID = CInt(context.Request.QueryString("id"))
Else
Throw New ArgumentException("No parameter specified")
End If
context.Response.ContentType = "image/jpeg"
Dim strm As Stream = ShowSTARImage(staffID)
Dim buffer As Byte() = New Byte(4095) {}
Dim byteSeq As Integer = strm.Read(buffer, 0, 4096)
Do While byteSeq > 0
context.Response.OutputStream.Write(buffer, 0, byteSeq)
byteSeq = strm.Read(buffer, 0, 4096)
Loop
End Sub
Public Function ShowSTARImage(ByVal staff As Integer) As Stream
Dim strConnection As String = ConfigurationManager.ConnectionStrings("Star").ToString
Dim conn As SqlConnection = New SqlConnection(strConnection)
Dim sql As String = "Select picture from contactPage where userID = " & staff
Dim cmd As SqlCommand = New SqlCommand(sql, conn)
conn.Open()
Dim img As Object = cmd.ExecuteScalar ()
Try
Return New MemoryStream(CType(img, Byte()))
Catch ex As Exception
Return Nothing
Finally
conn.Close()
conn.Dispose()
End Try
End Function
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
Right now I am displaying the image on my site with an image control which calls the handler like so:
imgContactPage.ImageUrl = "~/ShowImage.ashx?id=" & Session("selectedUser").ToString
Using this, I can have some very large images that look bad on the page as it breaks all of my other design elements.
|
|
|
|
|
Add two query string parameters to the request string so it becomes something like "~/ShowImage.ashx?id=1234&width=320&height=200". Then resize the image to that size. You can use System.Drawing.Image.FromStream to load the image from a memory stream that you create from the byte array. You can then use the GetThumbnailImage function, as is done here.
|
|
|
|
|
Guess I don't understand where to put this. Is it after the
Do While byteSeq > 0
context.Response.OutputStream.Write(buffer, 0, byteSeq)
byteSeq = strm.Read(buffer, 0, 4096)
Loop
or before?
|
|
|
|
|
Rather than answer that, I'll explain the steps and I trust you can figure it out:
- First, you'll load the image file data from the database.
- That image file data will be loaded into an in-memory image.
- That in-memory image will be resized.
- The resized image will be saved as image file data.
- That file data of the resized image will be returned in the HTTP response.
Just to clarify, there are several ways to represent an image. One of those ways is as file data. So when I say "image file data", I mean the image as it would be represented in a file (e.g., the file "AngelinaJolie.jpg" is 300KB of image file data, though that data need not necessarily be stored on the file system itself). In particular, you will typically be working with image file data in byte arrays and memory streams.
|
|
|
|
|
I program ASP.NET only occasionally and need a timer control for some trivial tasks. After some searchs, I get an impression that I have to use AJAX Extensions.
I am using ASP.NET 2.0 with VS2005. Why can't WebForm support a simple timer like WinForm? What are other options here? Thanks!
Best,
Jun
|
|
|
|
|
Yes, you have to download AJAX Toolkit for ASP.NET 2.0
AJAX for ASP.NET 2[^]
Then you can use Timer control on your asp.net page.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
Depending on your needs, you can just use JavaScript's setInterval function. The setTimeout function works similarly.
|
|
|
|
|
iam created sending emails that is working fine but i need delivery report and view report so how to write write code for that in asp.net
|
|
|
|
|
Don't cross-post[^] please.
As said there, it is not possible for you to control.
|
|
|
|
|
Any one know how to remove items from checkedlistbox using javascript...
|
|
|
|
|
Just a simple search can get you answer. see HERE[^]
Regards,
Hiren.
-"I don't know, I don't care, and it doesn't make any difference".
|
|
|
|
|
function removeAllOptions(obj)
{
if(obj!= null)
{ for(var i=0; i < obj.options.length; i++)
{ obj.remove(i);
}
}
}
That should do it.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
OK here is the deal. I have a gridview and I have some items in it. I have checkboxes on the extreme left (the first column) which enables the user to make selection. Now the thing is that I have achieved a way to get the row on which it is selected and I turn the row to a different color lets say orange. Now I want to make sure that the when the user selects another checkbox, the rest of the checkboxes should automatically be deselected. Now I know you will suggest me to use a radio button instead however I wish to do it with checkbox itself... Any kind of help will be appreciated...
OK I agree this is a strange question but strange things are the best way to learn something. And this is not a homework question. I am banging my head to get this solved...
Always Keep Smiling.
Yours Pankaj Nikam
|
|
|
|
|
While you are looping items on GridView make unselect for each row except selected row.
Or put your code here to see what you did so far.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
My English is little. Please understand.
I was used delphi since five year ago.
But my new company want web page used ASP.net.
I want to put link text on picture.
If use link text on picture, Must I use java script?
Please let me know example or method.
I am waiting your reply.
Thanks you
|
|
|
|
|
You can use LinkButton control in asp.net. Have a look here
Another example : Using LinkButton Server Controls
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Thanks for your reply
Regarding the link button, I knew to use its.
Can it put on picture?
I can't put link button on picture(Image).
|
|
|
|
|
Will ImageButton Control resolve your issue?
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Thanks for your cooperation.
I want to use link text on picture.
example)
Please see main menu bar in this web page.
Link text(home, Articles....help!) is on green image.
|
|
|
|
|
The image will be the link.
If you are trying to place a hyperlink over top an image? If so then you need to use CSS to position the elements.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I am making board by using gridview.
Until now, i made similar board but i want to other fuction which not only page navigator also FIRST, LAST, Prev, Next page navigator. and button bottom of gridview.
Is it possible?
I want to attach picture but i don't know how can i upload file.
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
|
Mark Nischalke wrote: A picture may be worth a thousand words ...
wouldn't it be nice if MSDN pages, like the ones you linked to, would show us some pictures so we can see what we could get from those classes, methods, and properties? I never understood why they are so reluctant to use some more graphics and images...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|