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
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