السلام عليكم ورحمة الله وبركاته ..
سؤالي كيف أغير في شكل Grid Veiw ؟
بدل ما يكون على شكل جدول يصير يعرض في السطر أكثر من حقل (كما في معرض الصور) ..
كما في هذا المعرض :
السلام عليكم ورحمة الله وبركاته ..
سؤالي كيف أغير في شكل Grid Veiw ؟
بدل ما يكون على شكل جدول يصير يعرض في السطر أكثر من حقل (كما في معرض الصور) ..
كما في هذا المعرض :
الـgridView لا يمكنها فعل ذاك. يمكنك استخدام الـDataList أو الـRepeater لفعل شئ مشابه. و حسب ما اذكر أن صاحب هذا الموقع موجود في المنتدى، لِم لا تسأله كيف فعلها؟
لقد سألته :
ورد بأنه عملها بال gridview .
وسألته مرة أخرى كيف الطريقة ،، فلم يرد حتى الآن .
-------------
عزيزي system down : ممكن شرح الطريقة بالـ DataList أو الـRepeater ؟؟
تم تعديل هذه المشاركة بواسطة ubd17 في 9 يونيو 2008 في 11:15
اخي الكريم
ممكن ان تستخدم gridview والـRepeater و الـDataList و الـtabel جميعها تصلح
سوف اضع لك مثال بأقرب وقت ان شاء الله
تم تعديل هذه المشاركة بواسطة محمد سماقية في 9 يونيو 2008 في 21:55
-----------------------------------------------------------------------------------------------------------------------------
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Mohammad Sonaiea
هذا مثال بسيط أرجو ان يفيدك
Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <table cellspacing="4" cellpadding="0" border="1" width="100%" bgcolor="ffffff"> <tr> <td colspan="5"> <asp:Label ID="top" runat="server" /> </td> </tr> <tr> <td colspan="5"> <asp:DataList runat="server" ID="dlPictures" RepeatColumns="5" Font-Name="Verdana" Font-Size="8pt" CellSpacing="5" Item-BorderWidth="1" Item-BorderColor="#c0c0c0" BorderStyle="None" ItemStyle-Width="125" CellPadding="0" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Bottom" GridLines="Both" ItemStyle-BorderStyle="Solid"> <ItemTemplate> <table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%" bgcolor="ffffff"> <tr> <td align="center"> <br> <%# Container.DataItem %> </td> </tr> </table> </ItemTemplate> </asp:DataList> </td> </tr> <tr> <asp:Label ID="bottom" runat="server" /> </tr> </table> </div> </form> </body> </html>
Imports System.IO
Imports System.Drawing.Imaging
Partial Class _Default
Inherits System.Web.UI.Page
Dim PathVar As String = Server.MapPath(".") + "\images\"
Const maxWidth As Integer = 125
Const maxHeight As Integer = 93
Dim homedir As String
Function ThumbnailCallback() As Boolean
Return False
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim images As Array
Dim pics As ArrayList = New ArrayList()
Dim imgHeight, imgWidth As Integer
Dim inSubpage As String = Request.QueryString("subpage")
Dim inSubpageSlash As String = ""
images = BuildImagesArray()
Dim index As Integer
For index = 0 To images.Length - 1
Dim s As String = images(index)
pics.Add(AddImage(s, imgHeight, imgWidth))
Next
dlPictures.DataSource = pics
dlPictures.DataBind()
End Sub
Public Function BuildImagesArray() As Array
Dim images As Array
Dim files As String() = Directory.GetFiles(PathVar, "*.jpg")
images = Array.CreateInstance(GetType(String), files.Length)
If files.length <> 0 Then
files.CopyTo(images, 0)
Else
Response.Write("No Content to Generate. Make sure you have images ")
End If
Return images
End Function
Public Function AddImage(ByVal s As String, ByVal imgHeight As Integer, ByVal imgWidth As Integer) As String
Dim currentImage As System.Drawing.Image
Try
currentImage = System.Drawing.Image.FromFile(s)
Catch exp As OutOfMemoryException
Return "There was an error loading file information for " & _
Path.GetFileName(s)
End Try
Dim fs As FileStream = New FileStream(s, _
FileMode.Open, FileAccess.Read, FileShare.Read)
ScaleFactorCalculations(imgHeight, imgWidth, currentImage)
Dim filename = Path.GetFileNameWithoutExtension(s)
If filename.length > 20 Then
filename = filename.substring(0, 17) & "..."
End If
Dim size As New Integer
size = fs.Length / 1024
Return "<a href=""java script:alert('" + filename + "')"">" & _
"<img src=""thu.aspx?img=" & Path.GetFileName(s.Replace(" ", "%20")) & "&w=" & _
imgWidth & "&h=" & imgHeight & "&path=" & (PathVar.Replace(" ", "%20")) & """ border=0></a><br>" & _
"<div align=center><span style=""font size:'8pt'; font-family:'Verdana';"">" & filename & "<br>" & _
currentImage.Width & "x" & currentImage.Height & "<br>" & _
size & " KB<br></span></div>"
End Function
Sub ScaleFactorCalculations(ByRef imgHeight As Integer, ByRef imgWidth As Integer, ByVal currentImage As System.Drawing.Image)
imgHeight = currentImage.Height
imgWidth = currentImage.Width
Dim scaleFactor As Double
If imgWidth > maxWidth Or imgHeight > maxHeight Then
If (maxHeight / imgHeight) > (maxWidth / imgWidth) Then
scaleFactor = maxHeight / imgHeight
Else
scaleFactor = maxWidth / imgWidth
End If
End If
If imgWidth > maxWidth Then
scaleFactor = maxWidth / imgWidth
imgWidth *= scaleFactor
imgHeight *= scaleFactor
End If
If imgHeight > maxHeight Then
imgWidth /= scaleFactor
imgHeight /= scaleFactor
scaleFactor = maxHeight / imgHeight
imgWidth *= scaleFactor
imgHeight *= scaleFactor
End If
End Sub
End Classthu.aspx هذه الصفحة من اجل توليد المصغرات
Imports System.IO
Imports System.Drawing.Imaging
Partial Class thu
Inherits System.Web.UI.Page
Dim homedir As String
Function ThumbnailCallback() As Boolean
Return False
End Function
Protected Sub Page_Load1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
homedir += Request.QueryString("path")
Dim imageUrl As String = Request.QueryString("img")
Dim imageHeight As Integer = Request.QueryString("h")
Dim imageWidth As Integer = Request.QueryString("w")
If imageUrl.IndexOf("/") >= 0 Or imageUrl.IndexOf("\") >= 0 Then
Response.End()
End If
imageUrl = homedir & imageUrl
Dim fullSizeImg As System.Drawing.Image
fullSizeImg = System.Drawing.Image.FromFile(imageUrl)
Response.ContentType = "image/jpeg"
If imageHeight > 0 And imageWidth > 0 Then
Dim dummyCallBack As System.Drawing.Image.GetThumbnailImageAbort
dummyCallBack = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)
Dim thumbNailImg As System.Drawing.Image
thumbNailImg = fullSizeImg.GetThumbnailImage(imageWidth, imageHeight, dummyCallBack, IntPtr.Zero)
thumbNailImg.Save(Response.OutputStream, ImageFormat.Jpeg)
Else
fullSizeImg.Save(Response.OutputStream, ImageFormat.Jpeg)
End If
End Sub
End Classتم تعديل هذه المشاركة بواسطة محمد سماقية في 10 يونيو 2008 في 16:29
-----------------------------------------------------------------------------------------------------------------------------
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Mohammad Sonaiea
عزيزي : محمد ،،
السلام عليكم وحرمة الله وبركاته ،،
أحسنت وماقصرت ،،
جدا رائع ،،
كفيت ووفيت ،،
يسلموا ،،
موفق لكل خير ..
لو كنت تستخدم asp.net 3.5 بإمكانك ان تجرب الأداة ListView فهي اداة مرنة بها وظائف حلوة ,,, يمكنك ان تضيف معها DataPager control لتسهيل التنقل بين الصفحات
The World Must Be Crazy