Hi,
I have a radupload tool in my RadGrid.
I allow user to upload file when user edits or inserts a row. But when inserting a row, I want user to be able to upload more than one files. On the other hand, when editing a row, I want user to insert just one file.
-This means I should be changing upload tool's property in edit and insert mode of grid-
Here is my grid:
How can I do that? I added this code below to ItemDataBound method. But it makes MaxFileInputCount=1000 in both edit and insert mode.
MaxFileInputCount should be 1 in edit mode and it should be 1000 in insert mode.
This is the code I wrote to ItemDataBound
I have a radupload tool in my RadGrid.
I allow user to upload file when user edits or inserts a row. But when inserting a row, I want user to be able to upload more than one files. On the other hand, when editing a row, I want user to insert just one file.
-This means I should be changing upload tool's property in edit and insert mode of grid-
Here is my grid:
| <MasterTableView Width="100%" CommandItemDisplay="Top"> |
| <Columns> |
| <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> |
| <telerik:GridTemplateColumn UniqueName="File" HeaderText="Image File"> |
| <ItemTemplate> |
| <asp:Image ID="img" runat="server" Height="50px"/> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <telerik:RadUpload ID="upload" runat="server" AllowedFileExtensions="gif,jpg,png" AllowedMimeTypes="image/gif,image/jpeg,image/png"></telerik:RadUpload> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn |
| DataField="Title" |
| HeaderText="Title" |
| UniqueName="Title"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
How can I do that? I added this code below to ItemDataBound method. But it makes MaxFileInputCount=1000 in both edit and insert mode.
MaxFileInputCount should be 1 in edit mode and it should be 1000 in insert mode.
This is the code I wrote to ItemDataBound
| if (e.Item is GridEditableItem && e.Item.IsInEditMode && grid.MasterTableView.IsItemInserted) |
| { |
| GridEditableItem temp = e.Item as GridEditableItem; |
| ((RadUpload)temp["File"].FindControl("upload")).MaxFileInputsCount = 1000; |
| ((RadUpload)temp["File"].FindControl("upload")).InitialFileInputsCount = 1; |
| } |