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

Call Javascript after RadGrid1_ItemCommand

1 Answer 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 19 Aug 2008, 07:01 PM
Hello,

I have a dynamicly created RadGrid with GridButtonColumns.  I am using RadGrid1_ItemCommand event to identify which button was pressed.

How can I call a Javascript function in my header at this point? 

I have tried RowClick which does not fire on GridButtonColumns.

Thanks in advance.

David

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Aug 2008, 06:48 AM
Hi,

You can try the following code snippet to call a javascript function on clicking the header of a GridButtonColumn.

CS:
 protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridHeaderItem) 
        { 
            GridHeaderItem header = (GridHeaderItem)e.Item; 
            header["columnUniqueName"].Attributes.Add("onclick", "return Show();"); 
        } 
   } 

JS:
 <script type="text/javascript" language="javascript" > 
         function Show() 
         { 
          alert('Clicked Header ?') 
         } 
</script> 


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