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

Reference a radupload ctrl in a grid edittemplate

2 Answers 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Morten asked on 24 Jun 2008, 09:47 AM
I'm having trouble following the upload ctrl in grid example (http://www.telerik.com/DEMOS/ASPNET/Prometheus/Controls/Examples/Integration/RadUploadInAjaxifiedGrid/DefaultCS.aspx).

Specifically, I can't seem to reference the RadUpload control placed in the EditItemTemplate when the grid enteres "Insert mode".

The RadUpload ctrl:
            <EditItemTemplate>
              <telerik:RadUpload ID="File" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1" ControlObjectsVisibility="None" MaxFileSize="1000000" Skin="Telerik" />
            </EditItemTemplate>

This code fails:
var upload = $find(window('File'));

2 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Petkov
Telerik team
answered on 24 Jun 2008, 11:51 AM
Hi Morten71,

You will find the key in the Grid ItemDataBound event on the demo's code-behind:

        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
            { 
                RadUpload upload = e.Item.FindControl("RadUpload1"as RadUpload; 
                RadAjaxPanel1.ResponseScripts.Add(string.Format("window['UploadId'] = '{0}';", upload.ClientID)); 
            } 
        } 

This is how the Upload client object is passed to the client.

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 24 Jun 2008, 10:49 PM
thanks, I wasn't aware of the server side code bit
Tags
Grid
Asked by
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Konstantin Petkov
Telerik team
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or