>> Ok I have a web control which is used to input search terms. It works
>> really well on one page.
[quoted text clipped - 38 lines]
>
> Lloyd Sheen
>>> Ok I have a web control which is used to input search terms. It works
>>> really well on one page.
[quoted text clipped - 47 lines]
>
> Lloyd Sheen
Ok I have taken out all Ajax (toolkit) code and I now have a button which
when clicked will only work once.
Here is full code:
ASPX:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ShowSongs.aspx.vb"
Inherits="ShowSongs" %>
<!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>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<table width="100%">
<tr>
<td >
<table>
<tr>
<td id="ArtistTD" >
<asp:Label ID="Label2" runat="server"
CssClass="SearchTitles" Text="Artist :"></asp:Label>
<asp:TextBox ID="ArtistSearchText" runat="server"
BackColor="#C0FFFF"></asp:TextBox>
<asp:ImageButton ID="SearchByArtist" runat="server"
ImageAlign="Middle"
ImageUrl="~/Images/find.ico"
OnClick="SearchByArtist_Click"
Width="32px" />
</td>
</tr>
</table>
</td>
<td style="width: 100px">
</td>
</tr>
<tr>
<td colspan="2">
<asp:Repeater ID="Repeater3" runat="server">
<HeaderTemplate>
<asp:Label ID="ArtistLabel" runat="server"
Text="Label"></asp:Label>
<br />
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" Height="24px"
Width="24px"
runat="server" />
<asp:Label ID="CDTitle" runat="server"
Text="Label"></asp:Label>
<br />
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
.VB codebehind
Option Strict On
Option Explicit On
Imports System.IO
Imports MusicSiteControls
Imports System.Collections.Generic
Partial Class ShowSongs
Inherits System.Web.UI.Page
Protected Sub SearchByArtist_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs)
Dim d As New DAL
Dim artistName As String
artistName = ArtistSearchText.Text
Me.Repeater3.DataSourceID = Nothing
Me.Repeater3.DataSource = d.GetAlbumList(artistName)
Me.Repeater3.DataBind()
End Sub
Protected Sub Repeater3_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
Repeater3.ItemCreated
Dim ArtistLabel As Label
Dim CDTit As Label
Dim ib As ImageButton
Dim ds As CD
Select Case e.Item.ItemType
Case ListItemType.Header
ArtistLabel = CType(e.Item.FindControl("ArtistLabel"),
Label)
ArtistLabel.Text = ArtistSearchText.Text
Case ListItemType.AlternatingItem, ListItemType.Item
ds = CType(e.Item.DataItem, CD)
ib = DirectCast(e.Item.FindControl("ImageButton1"),
ImageButton)
CDTit = CType(e.Item.FindControl("CDTitle"), Label)
CDTit.Text = ds.Name
Dim url As String
url = "~\DynamicImage.aspx?ImageFolder=" +
ds.FolderNumber.ToString + "&ImageText=" + "1"
ib.ImageUrl = url
End Select
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim i As Integer = 1
End Sub
End Class
HELP PLEASE!
This is just a page with a button and a repeater. How can this possibly go
so wrong??
Lloyd Sheen
John Kotuby - 28 Mar 2008 22:01 GMT
Hi Lloyd,
I'm assuming you found an answer to your problem already and just didn't
bother to post the solution, which I would be very interested in seeing.
My first thought on reading your posts was that the problems were deriving
from the use of an UpdatePanel. I've had some strange things happen with
UpdatePanels when the templates weren't defined such that they each contain
an entire Table (instead of just rows within a table).
Also the Page_Load should Not fire after the inital load of the page,
because the actual page persists in the browser during an asynch callback.
Also I was wondering if you were including the Button (actually an
ImageButton) as a child control in the update panel or at least defining it
as a Trigger for the panel.
But all those ideas went south when you said that you removed the "AJAX"
stuff.
I'm guessing you eventually re-wrote the page from scratch and got it to
finally work.
Cheers...
>>>> Ok I have a web control which is used to input search terms. It works
>>>> really well on one page.
[quoted text clipped - 176 lines]
>
> Lloyd Sheen
Lloyd Sheen - 29 Mar 2008 00:54 GMT
> Hi Lloyd,
> I'm assuming you found an answer to your problem already and just didn't
[quoted text clipped - 201 lines]
>>
>> Lloyd Sheen
I did post it. But what was wrong ended up being that I was handling the
ItemCreated rather than the ItemDataBound. I was creating the page by copy
pasting code but creating the events with IDE.
Still a very strange happening when something was wrong.
LS