I really hope someone can help me with this because it's really driving me crazy. I need to dynamically display multiple data tables on a page so I am using a Repeater to do so and in the ItemTemplate of the Repeater I am adding a Gridview control. One of the columns of the GridView control is a TemplateColumn that contains an ImageButton.
The tricky thing is that I am using .NET 2.0 and it seems that I have to register this control (I'm not sure if it's the gridview I have to register or the actual imagebutton within the gridview) for event validation.
I've tried overriding the Render method on the page and registering the control as follows:
Page.ClientScript.RegisterForEventValidation(CType (item.Controls(1), GridView).UniqueID)
.. with no luck.
Can someone please help me, this is driving me crazy. I'm at my wits end.
Here is my Repeater mark up:
<asp:Repeater ID="rptMain" runat="server" >
<HeaderTemplate>
<table width="90%">
<tr>
<th align="center">Bid #</th>
<th align="center">Bid Name</th>
<th align="center">Sequence #</th>
<th align="center">Sequence Desc</th>
<th align="center">Bid Qty</th>
<th align="center">Bid UOM</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class="bidInfoCell"><%#Eval("LiBidNum")%></td>
<td class="bidInfoCell"><%#Eval("LiBidDesc")%></td>
<td class="bidInfoCell"><%#Eval("LiSeqNum")%></td>
<td class="bidInfoCell"><%#Eval("LiSeqDesc")%></td>
<td class="bidInfoCell"><%#Eval("LiBidQty")%></td>
<td style="font-size:smaller;"><%#Eval("LiBidUOM")%></td>
</tr>
<tr>
<td colspan="6">
<asp:gridview ID="gvwPastSearch" runat="server" AutoGenerateColumns="false"
CssClass="tablegrid" Width="100%" OnRowCommand="gvwPastSearch_RowCommand" >
<RowStyle CssClass="TableItemRow" VerticalAlign="Top" Font-Size="small"></rowStyle>
<AlternatingrowStyle CssClass="TableAlternateRow" Font-Size="small"></AlternatingrowStyle>
<HeaderStyle CssClass="TableHeader" ForeColor="White" font-size="small"></HeaderStyle>
<PagerStyle BackColor="LightSlateGray" ForeColor="White" />
<Columns>
<asp:Boundfield DataField="LiBidCost" HeaderText="Cost"></asp:Boundfield>
<asp:Boundfield DataField="LiBidSell" HeaderText="Sell"></asp:Boundfield>
<asp:Boundfield DataField="LiItemBid" HeaderText="Bid?"></asp:Boundfield>
<asp:Templatefield HeaderText="Add/Remove/Move">
<ItemTemplate>
<asp:ImageButton ID="imgbtnPastRowCommand" runat="server"
ImageUrl="Images/arrow.gif" CommandName="AddItem" />
</ItemTemplate>
</asp:Templatefield>
</Columns>
</asp:gridview>
</td>
</tr>
</ItemTemplate>
<SeparatorTemplate>
<tr>
<td colspan="6">
<hr />
</td>
</tr>
</SeparatorTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>