PDA

View Full Version : مشکلات ساخت GridView سفارشی



Developer Programmer
چهارشنبه 20 بهمن 1389, 22:24 عصر
مدتیه میخوام یه GridView بسازم که بتونم بی دغدغه و با استفاده از نام Column، به مقدار موجود در Cell دسترسی پیدا کنم.
یه همپین کلاسی رو پیاده سازی کردم


<ToolboxData("<{0}:CustomGridView runat=server></{0}:CustomGridView>")>
Public Class CustomGridView
Inherits GridView

Public Property Item(ByVal RowIndex As Integer, ByVal HeaderText As String) As TableCell
Get
Return FindCell(RowIndex, HeaderText)
End Get
Set(ByVal value As TableCell)
'
End Set
End Property

Private Function FindCell(ByVal RowIndex As Integer, ByVal HeaderText As String) As TableCell
Dim Col As Integer = 0
Try
For Col = 0 To Me.Columns.Count - 1
If Me.Columns(Col).HeaderText.Trim = HeaderText.Trim Then
Return Me.Rows(RowIndex).Cells(Col)
End If
Next
Catch e As Exception
Throw e
End Try
Return Nothing
End Function

End Class

دنبال یه ایده می گردم که بتونم قسمت Set در پراپرتی رو کامل کنم اما چیزی به ذهنم نمی رسه.... کسی میتونه کمک کنه؟