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

[Solved] FileUpload not working when EditMode="EditForm"

4 Answers 201 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Computer Surgeon
Top achievements
Rank 1
Computer Surgeon asked on 31 Mar 2009, 02:42 PM
Hi,

     In my RadGrid i use EditMode in EditForm style. RadGrid has the option to upload documents. I don't use UserControl instead use as follows...
<telerik:GridTemplateColumn HeaderButtonType="TextButton" UniqueName="Upload" HeaderText="File Name"
                                        <ItemTemplate> 
                                            <asp:Label runat="server" ID="lblFileName" Text='<%# Eval("FileName") %>' /> 
                                        </ItemTemplate> 
                                        <EditItemTemplate> 
                                            <span style="color: #FF0000;">*</span> 
                                            <asp:FileUpload Width="400" ID="RadUpload1" runat="server" /> 
                                            <asp:RequiredFieldValidator Visible='<%# (Container is GridEditFormInsertItem) %>' 
                                                runat="server" ControlToValidate="RadUpload1" ErrorMessage="Please select any file" 
                                                ID="ReqUpload" SetFocusOnError="true" ToolTip="Please upload a file"></asp:RequiredFieldValidator> 
                                        </EditItemTemplate> 
                                        <ItemStyle Width="10%" HorizontalAlign="right" /> 
                                        <HeaderStyle Width="20%" HorizontalAlign="center" /> 
                                    </telerik:GridTemplateColumn> 

In here on Click of EDIT all the custom controls shows up inedit mode but unable to retrieve the FileUpload control alone like
FileUpload FUDoc = (FileUpload)e.Items.FindControl("RadUpload1") always this code return null.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Apr 2009, 05:50 AM
Hi,

Try the following code snippet to access the FileUpload control.

CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
    { 
        FileUpload FUDoc = (FileUpload)e.Item.FindControl("RadUpload1"); 
    } 

Thanks,
Shinu.


0
Computer Surgeon
Top achievements
Rank 1
answered on 01 Apr 2009, 12:53 PM
Hi,

    Still i'm getting the same "" value for the above said issue.i.e,. while trying to fetch string FileName = FUDoc.FileName; Can u send any example where radgrid uses EditMode="EditForm" without using user control and containing FileUpload. I hope the value in FileUpload gets vanish on click of Save.
0
Computer Surgeon
Top achievements
Rank 1
answered on 01 Apr 2009, 01:06 PM
Hi,

  In another scenarion i use UserControl to upload documents. In here there is a complete postback held. Here i can get the value inside the FileUpload Control on Update mode of operation. Is there any idea to avoid that complete post back and accomplish the same requirement.

Now i'm trying with modal pop up i.e., with help of AjaxControlToolKit-ModalPopUpExtender in that modal popup i 'v telerik:RadComboBox the dropdown list goes underneath the modalpopup. i set the ZIndex ="1000" but no use.  Is there any way to overcome this issue or its a bad idea to use modal popup on click of Add New Document of an RadGrid. Please suggest me whether to use modalpopup or UserControl for upload document.
0
Computer Surgeon
Top achievements
Rank 1
answered on 02 Apr 2009, 04:52 AM
Hi ,

     I could't find any reply for the above post/issue arised. I dont know that i'm not clear in explaning my issue or you guys totally confused or did not overcome this issue upto date. So , i'm turning back to use the usercontrol but i awaiting to find any solution.

             
Tags
Grid
Asked by
Computer Surgeon
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Computer Surgeon
Top achievements
Rank 1
Share this question
or