Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > GridView Item Template

Reply
Thread Tools

GridView Item Template

 
 
shapper
Guest
Posts: n/a
 
      07-03-2007
Hello,

I am trying to create a GridView at runtime but my GridView has 4 rows
but only the last one is filled. Why?

Here is my code:

' tfPost
Private Class tfPost
Implements ITemplate

Protected WithEvents lPost As New Label

Private Type As ListItemType

' lPost_DataBinding
Private Sub lPost_DataBinding(ByVal sender As Object, ByVal e As
System.EventArgs) Handles lPost.DataBinding

' Create lPost
Dim lPost As Label = CType(sender, Label)

' Create container
Dim gvrContainer As GridViewRow = CType(lPost.NamingContainer,
GridViewRow)

' Bind lPost
lPost.Text = DataBinder.Eval(gvrContainer.DataItem,
"PostTitle") & "<br />" & _
DataBinder.Eval(gvrContainer.DataItem,
"PostBody")

End Sub ' lPost_DataBinding

' New
Public Sub New(ByVal type As ListItemType)

' Define template type
Me.Type = type

End Sub ' New

' InstantiateIn
Public Sub InstantiateIn(ByVal container As Control) Implements
ITemplate.InstantiateIn

' Select template type
Select Case Me.Type

Case ListItemType.Header ' Header
template

Case ListItemType.Item ' Item template

container.Controls.Add(lPost)

Case ListItemType.Footer ' Footer template

End Select

End Sub ' InstantiateIn

End Class ' tfPost

End Class

Thanks,

Miguel

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 2.0 GridView Item Template CheckBox Radio Button ABHIJIT B ASP .Net 2 02-05-2008 07:00 PM
Textbox Blur event in gridview item template rajkm42@googlemail.com ASP .Net 2 10-01-2007 05:03 PM
DataBind code equivalent of Text='<%# Bind("MyColumn") %>' of Item Template in GridView Desmond Cassidy ASP .Net Web Controls 0 04-07-2007 12:38 PM
GridView add multiple controls to edit item template =?Utf-8?B?SmVyb2QgSGF0bGV5?= ASP .Net 2 10-08-2006 03:04 PM
Re: A Newbie Question about template template template Chris Theis C++ 2 07-24-2003 09:42 AM



Advertisments