Reputation: 77
Here's my problem.
I have a repeater. Inside it has lots of textboxes. In the right most column, there is a linkbutton. This link button when clicked will show a modalpopupextender which will display the detail record of the selected row.
I have made it work just fine but its slow because when you click the linkbutton, it will refresh the whole page.
I don't want to reload the repeater because this is the part that is very slow.
I tried adding an updatePanel (repeater inside updatePanel) but ofcourse since the repeater is inside the updatePanel it will still reload the repeater.
So the question is, how do I do it so when the linkbutton is clicked, it wont reload the repeater...
Any ideas would be greatly appreciated. By the way, I'm developing it with .net 2.0, c#
Upvotes: 1
Views: 2243
Reputation: 932
Try this one.
<asp1:UpdatePanel ID="updatepanel4" runat="server" >
<ContentTemplate>
<table id="AssignedRequest" class="tablecont" runat="server" style="width: 900px;" >
<tr>
<td>
<div style=" display:block; width:900px; height:350px;overflow:scroll; ">
<asp:Repeater runat="server" ID="RepeaterRequest">
<HeaderTemplate >
<table class="list_table" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<th>Name</th>
<th></th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Eval("NAME")%></td>
<td><a onclick="window.open(this.href,this.target,'directories=no,
menubar=no,resizable=no,scrollbars=1,
status=no,toolbar=no,addressbar=no,fullscreen=yes');
return false;" href="View.aspx?name=<%#Eval("NAME")%>">View</a></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</td>
</tr>
</table>
</ContentTemplate>
</asp1:UpdatePanel>
Upvotes: 1
Reputation: 11975
Why not go for something like a master-child relationship. Do you require further interaction with the child data you are showing to the user? Please specify the nature if so.
Assuming that the child data that you are going to show is simple data meant to simply convey related data to user, you can go for a combination jQuery, and repeaters to accomplish your objective.
The first repeater you show your master data. Against each row in your repeater you show a show button here. You do not need a linkbutton here; just a simple anchor will do. You'd have to write js in it to toggle the correct child data.
All the child data should also be repeated. But not shown to the user at first. Only that particular child item should be shown - this is suitably triggered by the show anchor which is clicked on the master repeater. Rest is all js/css.
Below is a link to a sample project which demonstrates the concept.
http://www.coderun.com/ide/?w=2ObqOpjZz0qt7OrXYmmxwA
Upvotes: 0
Reputation: 28980
Register in the code behind, this code you add it after your bind, for example in your Page_Load, (You can also use ItemDataBound or ItemCreated delegate).
rpt.DataBind();
foreach (RepeaterItem ri in rpt.Items)
{
if (ri.ItemType == ListItemType.Item || ri.ItemType == ListItemType.AlternatingItem)
{
LinkButton lnkButton1 = (LinkButton)ri.FindControl("lnkButton1");
ScriptManager1.RegisterAsyncPostBackControl(lnkButton1);
}
}
Upvotes: 0