Hi Gregory,
I tried to fix this but after many hours I am having the same problem
or getting new problems. I will post my complete code. Could you,
please, take a look and tell me what am I doing wrong? I added "******"
to the code lines which I think interfer with the QueryString.
The GridView is all defined at runtime.
Private Sub gvRSSChannels_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles gvRSSChannels.Init
' Define gvRSSChannels properties
With gvRSSChannels
.AutoGenerateColumns = False
.BorderStyle = BorderStyle.None
.DataSource = gvRSSChannels_DataSource()
.GridLines = GridLines.Horizontal
.ShowFooter = False
.ShowHeader = False
End With
' Create, define and add icon template field
Dim tfIcon As New TemplateField
tfIcon.ItemTemplate = New gvRSSChannelsTemplate(Me,
ListItemType.Item)
gvRSSChannels.Columns.Add(tfIcon)
' Create, define and add name bound field
Dim bfName As New BoundField
With bfName
.DataField = "Channel"
End With
gvRSSChannels.Columns.Add(bfName)
' Create, define and add url hyperlink field
Dim hfUrl As New HyperLinkField
With hfUrl
.DataTextFormatString =
"Me.GetLocalResourceObject(""String.{0}"").ToString()"
.DataNavigateUrlFormatString = "~\RSS.ashx?Channel={0}&Culture="
& System.Threading.Thread.CurrentThread.CurrentCulture.ToString()
End With
gvRSSChannels.Columns.Add(hfUrl)
End Sub
Private Sub gvRSSChannels_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles gvRSSChannels.Load
' Bind GridView to its data source
If Not IsPostBack Then
gvRSSChannels.DataBind()
End If
End Sub
----- Template CLASS ----
' rRSSChannelsTemplate
Public Class gvRSSChannelsTemplate
Implements ITemplate
' Define parent page
Private parent As RSS
' Define template type
Private type As ListItemType
' Create new template
Sub New(ByVal parentPage As RSS, ByVal templateType As
ListItemType)
' Define parent page
parent = parentPage
' Define template type
type = templateType
End Sub
' Define template
Sub InstantiateIn(ByVal container As Control) Implements
ITemplate.InstantiateIn
' Select template type
Select Case type
Case ListItemType.Header ' Header template
Case ListItemType.Item ' Item template
' Create item template controls
Dim rtrhlIcon As New RssToolkit.RssHyperLink
' Add item template controls handlers
AddHandler rtrhlIcon.DataBinding, AddressOf
rtrhlIcon_DataBinding
' Add item template controls to gvRSSChannels
container.Controls.Add(rtrhlIcon)
Case ListItemType.EditItem ' Edit Item
template
Case ListItemType.Footer ' Footer template
End Select
End Sub
' rtrhlIcon data binding and properties
Private Sub rtrhlIcon_DataBinding(ByVal sender As Object, ByVal e
As System.EventArgs)
' Define rtrhlIcon
Dim rtrhlIcon As RssToolkit.RssHyperLink
rtrhlIcon = CType(sender, RssToolkit.RssHyperLink)
' Define rtrhlIcon container
Dim container As GridViewRow
container = CType(rtrhlIcon.NamingContainer, GridViewRow)
' Define rtrhlIcon properties
With rtrhlIcon
.ChannelName = Me.parent.GetLocalResourceObject("String." &
DataBinder.Eval(container.DataItem, "Channel")).ToString()
.ImageUrl =
Me.parent.GetLocalResourceObject("rtrhlIcon.ImageUrl").ToString()
.IncludeUserName = "False"
.NavigateUrl = "~/RSS.ashx?Channel=" &
DataBinder.Eval(container.DataItem, "Channel") & _
"&Culture=" &
System.Threading.Thread.CurrentThread.CurrentCulture.ToString())
.ToolTip = Me.parent.GetLocalResourceObject("String." &
DataBinder.Eval(container.DataItem, "Channel")).ToString()
End With
End Sub
End Class
Thank You Very Much,
Miguel