mcmcom
March 19th, 2006, 05:12 PM
hi all.
i have the following data list and inside it are image buttons that are thumbnails. When clicked they assign another image a value and thats it. It works only once though, then subsequent clicks on the images do nothing, they don't even trigger the event? Whats wrong with this?
thanks!
here is how the data list looks:
<tr>
<td><asp:DataList ID="dlThumbs" Runat="server" RepeatDirection="Horizontal">
<ItemTemplate>
<asp:ImageButton ID="gallery" OnCommand="ImageButton_Command" CommandName="<%# Container.DataItem %>"
CommandArgument="show" ImageUrl="<%# Container.DataItem %>" Runat="server" />
</ItemTemplate>
</asp:DataList>
</td>
</tr>
and here is the event
public void ImageButton_Command(object sender, CommandEventArgs e)
{
string tmpFile = e.CommandName.Substring(0,e.CommandName.Length - 10) + e.CommandName.Substring(e.CommandName.Length - 4);
this.imgLarge.ImageUrl = tmpFile;
this.imgLarge.Visible = true;
this.dlThumbs.SelectedIndex = 0;
}
i have the following data list and inside it are image buttons that are thumbnails. When clicked they assign another image a value and thats it. It works only once though, then subsequent clicks on the images do nothing, they don't even trigger the event? Whats wrong with this?
thanks!
here is how the data list looks:
<tr>
<td><asp:DataList ID="dlThumbs" Runat="server" RepeatDirection="Horizontal">
<ItemTemplate>
<asp:ImageButton ID="gallery" OnCommand="ImageButton_Command" CommandName="<%# Container.DataItem %>"
CommandArgument="show" ImageUrl="<%# Container.DataItem %>" Runat="server" />
</ItemTemplate>
</asp:DataList>
</td>
</tr>
and here is the event
public void ImageButton_Command(object sender, CommandEventArgs e)
{
string tmpFile = e.CommandName.Substring(0,e.CommandName.Length - 10) + e.CommandName.Substring(e.CommandName.Length - 4);
this.imgLarge.ImageUrl = tmpFile;
this.imgLarge.Visible = true;
this.dlThumbs.SelectedIndex = 0;
}