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

How to attach a client event

2 Answers 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SultanOfSuede
Top achievements
Rank 1
SultanOfSuede asked on 17 Oct 2008, 06:24 PM
I'm using RadGrid with an EditForm.  I need to be able to attach JavaScript event code for a drop down control in the edit form.  The problem is, I don't know which event to use to get access to the control on the server side since none of them seems to have my <asp:DropDownList/> in its controls collections (the edit form however shows it plainly and it is able to update the data item just fine).

TIA 


2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 Oct 2008, 05:32 AM
Hi,

Try accessing the DropDownList from the edit form in the ItemDataBound event as shown below.

CS:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
        { 
            GridEditableItem edititem = (GridEditableItem)e.Item; 
            DropDownList ddl = (DropDownList)edititem.FindControl("DropDownList1"); 
            ddl.Attributes.Add("OnClick", "return Show();"); 
        } 
   } 


Thanks
Shinu.
0
SultanOfSuede
Top achievements
Rank 1
answered on 28 Oct 2008, 07:26 PM
Thanks, this was what I was looking for.

Ian
Tags
Grid
Asked by
SultanOfSuede
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
SultanOfSuede
Top achievements
Rank 1
Share this question
or