Get Name of the Control inside Repeater

Discussion in 'ASP .Net Web Controls' started by Asif, Oct 22, 2007.

  1. Asif

    Asif Guest

    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
     
    Asif, Oct 22, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    1
    Views:
    609
    darrel
    Jul 1, 2004
  2. Replies:
    1
    Views:
    7,069
    Karl Seguin
    Aug 10, 2005
  3. uncensored
    Replies:
    0
    Views:
    847
    uncensored
    Oct 25, 2006
  4. HockeyFan
    Replies:
    1
    Views:
    1,033
    Masudur
    Jul 4, 2007
  5. Microsoft

    Repeater inside a Repeater

    Microsoft, Aug 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    227
    Microsoft
    Aug 21, 2006
Loading...

Share This Page