Not able to add attribute on page OnInit

2 posts, 0 answers
  1. Joby
    Joby avatar
    25 posts
    Member since:
    Nov 2010

    Posted 20 Nov 2012 Link to this post

    Hi,
      I have a radbutton with the name "rbtnDelete".Here i am trying to register below code on page OnInit method 

    ClientScript.RegisterClientScriptBlock(this.GetType(),
    "ConfirmDelete", objUtl.RadConfirmDelete(),true);
    this.rbtnDelete.Attributes.Add("OnClientClicking",
    "function(sender,args){ConfirmDelete(sender, args, 'dgvContactList',
    'hidContactRowCount');}");

    .But it is not working. But if i try to use in aspx with this code it is working fine 

     OnClientClicking="function(sender,args){ConfirmDelete(sender,args,'dgvContactList','hidContactRowCount');}"


    Please help me

  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 20 Nov 2012 Link to this post

    Hey Joby,

    In your first example, why are you setting the OnClientClicking event using the Attributes collection, instead of setting the property directly on the control. This is how I would do it.
    this.rbtnDelete.OnClientClicking = ".....";

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top