D
Dirk Vervecken
Hi, i'm having a bit af trouble with a datarepeater of mine.
It shows the data that I want, but i've also implemented an
Imagebutton
that, when clicked, needs to retrieve the information
from the line I clicked so it can be altered.
This is the HTML code of the repeater:
<asp:Repeater id=repArticles runat="server">
<HeaderTemplate>
<TR>
<TD> </TD>
<TD class="pinktablecell">Artikel</TD>
<TD class="pinktablecell">Naam</TD>
</TR>
</HeaderTemplate>
<ItemTemplate>
<TR>
<TD class="unvisible"><%# DataBinder.Eval(Container.DataItem,
"Article") %></TD>
<TD class="Plain"><%# DataBinder.Eval(Container.DataItem,
"ArticleValue") %></TD>
<TD class="Plain"><%# DataBinder.Eval(Container.DataItem, "Name")
%></TD>
<TD>
<asp:ImageButton ID="ibtEditNote" Runat="server"
ImageUrl="Images/Animated/insertrule.gif"
CommandName="EditNote"></asp:ImageButton>
<asp:ImageButton ID="ibtViewComment" Runat="server"
ImageUrl="Images/arrowDown.gif"
CommandName="showComment"></asp:ImageButton>
</TD>
</TR>
<aspanel ID="pnlRepeater" Runat="server" Visible="False">
<tr>
<td>
</td>
<td class="Plain" colspan="3"><%#
DataBinder.Eval(Container.DataItem, "ExplanatoryNote") %>
</td>
</tr>
</aspanel>
</ItemTemplate>
</asp:Repeater>
The first imagebutton is the one that retrieves the info
the second button simply makes the panel visible and invisible.
private void repArticles_ItemCommand(object source,
System.Web.UI.WebControls.RepeaterCommandEventArgs e)
{
if((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem))
{
if(e.CommandName == "EditNote")
{
this.pnlEditNote.Visible = true;
rtbEditNote.Text = ((DataBoundLiteralControl)e.Item.Controls[0]).Text.ToString();
}
}
}
I tried retrieving through the DataboundLiteralControl, but that does
not work.
If I call the first control this way i get both Article and
ArticleValue (the first two columns of the repeater). I tried other
methods as well, but nothing seems to work.
Kind Regards
Dirk Vervecken
It shows the data that I want, but i've also implemented an
Imagebutton
that, when clicked, needs to retrieve the information
from the line I clicked so it can be altered.
This is the HTML code of the repeater:
<asp:Repeater id=repArticles runat="server">
<HeaderTemplate>
<TR>
<TD> </TD>
<TD class="pinktablecell">Artikel</TD>
<TD class="pinktablecell">Naam</TD>
</TR>
</HeaderTemplate>
<ItemTemplate>
<TR>
<TD class="unvisible"><%# DataBinder.Eval(Container.DataItem,
"Article") %></TD>
<TD class="Plain"><%# DataBinder.Eval(Container.DataItem,
"ArticleValue") %></TD>
<TD class="Plain"><%# DataBinder.Eval(Container.DataItem, "Name")
%></TD>
<TD>
<asp:ImageButton ID="ibtEditNote" Runat="server"
ImageUrl="Images/Animated/insertrule.gif"
CommandName="EditNote"></asp:ImageButton>
<asp:ImageButton ID="ibtViewComment" Runat="server"
ImageUrl="Images/arrowDown.gif"
CommandName="showComment"></asp:ImageButton>
</TD>
</TR>
<aspanel ID="pnlRepeater" Runat="server" Visible="False">
<tr>
<td>
</td>
<td class="Plain" colspan="3"><%#
DataBinder.Eval(Container.DataItem, "ExplanatoryNote") %>
</td>
</tr>
</aspanel>
</ItemTemplate>
</asp:Repeater>
The first imagebutton is the one that retrieves the info
the second button simply makes the panel visible and invisible.
private void repArticles_ItemCommand(object source,
System.Web.UI.WebControls.RepeaterCommandEventArgs e)
{
if((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem))
{
if(e.CommandName == "EditNote")
{
this.pnlEditNote.Visible = true;
rtbEditNote.Text = ((DataBoundLiteralControl)e.Item.Controls[0]).Text.ToString();
}
}
}
I tried retrieving through the DataboundLiteralControl, but that does
not work.
If I call the first control this way i get both Article and
ArticleValue (the first two columns of the repeater). I tried other
methods as well, but nothing seems to work.
Kind Regards
Dirk Vervecken