Help with button in a repeater

M

Maziar Aflatoun

Hi,

I have a repeater that contains data and I like the ablility to delete each
row once the delete button is clicked. I have placed a delete button in each
row which fires up an event which in return gives me a row id. Now I like
to hide the 'FileName' in my <asp:Button> as well too so I can grab it after
I click the delete button of that row. Right now it works. However, it
return the e.ItemIndex. Is it possible to hide the FileName value in my
<asp:Button> or in the row of that button?

<%# DataBinder.Eval(Container.DataItem,"DeleteFileName")%>
<ItemTemplate>
<tr>
<td><asp:Button Text='' CommandName="Delete" Runat=server
ID="ButtonDelete">
</asp:Button></td>
<td><%# DataBinder.Eval(Container.DataItem, "FileName")
%></td>
<td><%# DataBinder.Eval(Container.DataItem, "FileSize")
%></td>
</tr>
</ItemTemplate>

and
private void RepeaterAttachments_ItemCommand(object source,
System.Web.UI.WebControls.RepeaterCommandEventArgs e)
{
int DeleteItem = e.Item.ItemIndex;
if (e.CommandName.CompareTo("Delete") == 0)
{
Response.Write("DeleteItem:" + DeleteItem + "<br>");
}
}

Thank you
Maziar A.
 
P

Pat

I am assuming that you are using a datatable for this..............if not,
let me know. Are you using paging? I might be able to help :);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top