Get Name of the Control inside Repeater

A

Asif

Hi all,

I have following repeator control with two controls

<asp:repeater id="rptSurvey" runat="server">
<ItemTemplate>
<asp:RadioButtonList id="Rd" runat="server">
<asp:ListItem Value="1" >Enable</asp:ListItem>
<asp:ListItem Value="2" >Delete</asp:ListItem>
</asp:RadioButtonList>

<asp:LinkButton id="btnUpdate" runat="server">LinkButton</
asp:LinkButton>
</ItemTemplate>
</asp:repeater>

I need to add client side script on Link Button so if user select
Delete Option and click Link button it must be confirm first.

I am trying to add code on ItemDataBoundEvent

If e.Item.ItemType = ListItemType.Item Then
CType(e.Item.FindControl("btnUpdate"),
LinkButton).Attributes.Add("onClick", "return confirm('" &
CType(e.Item.FindControl("Rd"), RadioButtonList).SelectedValue &
"');")
End If

My client side script is

<script language="javascript">
function confirm(id)
{
alert(id);
return false;
}
</script>

But it did not work.

Can anyone please let me know about where I am wrong and how to get
control through client side script inside Repeator Control to do
client side confirmation before updating record?

Thanks

Asif
 

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

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top