I want to reply on answer which are in repeater

Posted by Sumit2k6 under Regular Expressions on 12/22/2010 | Points: 10 | Views : 1199 | Status : [Member] | Replies : 4
I have a repeater control in which i have loaded questions and i want to answer the question by clicking a link in the same repeater with out post back. i want to show a textbox and a button to display when click the link




Responses

Posted by: Madhuk on: 12/22/2010 [Member] Starter | Points: 25

Up
0
Down
Use update panel to partial postback.
Initially hide the textbox and button
Using the repeater itemcommand property when you click on the link display the textbox and button.

Sumit2k6, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sumit2k6 on: 12/23/2010 [Member] Starter | Points: 25

Up
0
Down
can u explain a little more about this

Sumit2k6, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhuk on: 12/23/2010 [Member] Starter | Points: 25

Up
0
Down
The itemtemplate of repeater control looks as
<ItemTemplate>

<asp:Label ID="lblName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "column")%>'></asp:Label>
<asp:TextBox ID="txtName" BackColor="#d4d0c8" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "column")%>' Visible="false"></asp:TextBox>
<asp:LinkButton ID="lnkEdit" runat="server" CommandName="update" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "column") %>'>Edit</asp:LinkButton>
</ItemTemplate>

In item command of repeater
if (e.CommandName == "update")

{
// your code here to show the textbox and button
}

If you are using linq then check this article
http://www.c-sharpcorner.com/UploadFile/kannagoud/3797/Default.aspx



Sumit2k6, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/6/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

to make it more generic and have great performance, you can dynamically load the controls as per our requirement.

Check the below link

http://stackoverflow.com/questions/128083/dynamically-adding-controls-in-asp-net-repeater

Thanks
Karthik
www.f5Debug.net

Sumit2k6, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response