This is a migrated thread and some comments may be shown as answers.

InitInsert

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jomey
Top achievements
Rank 1
Jomey asked on 09 Jul 2008, 11:19 PM
When I click the "add new record" default button - i want it to have onclick javascript.  Is there a way I can access this button from the codebehind and do a "attributes.add" to it?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Jul 2008, 05:26 AM
Hi Jomey,

Try accessing the AddNewRecord button in the code behind as shown below.

CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridCommandItem) 
        { 
            GridCommandItem cmditm = (GridCommandItem)e.Item; 
            LinkButton btn = (LinkButton)cmditm.FindControl("InitInsertButton"); 
            btn.Attributes.Add("OnClick", "return Show();"); 
 
        } 
   } 


JS:
 <script type="text/javascript"  language="javascript" > 
         function Show() 
         { 
 
         } 
          
        </script> 


Thanks
Shinu.
Tags
Grid
Asked by
Jomey
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or