HI,
Last few days I am posting the same prob again and again, but I am nt getting proper response .
Again now I am posting the prob once…
1:- I want to retrieve the uploaded file name and no of files from the RadUpload Control, which is under RadGrid.
My code looks like as follow…
<telerik:RadAjaxManager ID="RadAjaxManager2" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1" >
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
//On insert and update buttons click temporarily disables ajax to perform upload actions
function conditionalPostback(e, sender)
{
var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
if (sender.EventTarget.match(theRegexp))
{
var upload = $find(window['UploadId']);
//AJAX is disabled only if file is selected for upload
if(upload.getFileInputs()[0].value != "")
{
sender.EnableAjax = false;
}
}
}
</script>
</telerik:RadScriptBlock>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" clientevents-onrequeststart="conditionalPostback"
Width="75px" Transparency="5">
<img style="margin-top: 150px;" alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading4.gif") %>' />
</telerik:RadAjaxLoadingPanel>
<telerik:RadGrid PageSize="3" AllowPaging="true" ID="RadGrid1" runat="server" GridLines="Horizontal"
AllowFilteringByColumn="true" Skin="WebBlue" AllowAutomaticDeletes="True" OnNeedDataSource="RadGrid1_NeedDataSource"
OnDeleteCommand="RadGrid1_DeleteCommand" OnInsertCommand="RadGrid1_InsertCommand"
OnUpdateCommand="RadGrid1_UpdateCommand" OnItemDataBound="RadGrid1_ItemDataBound"
OnItemInserted="RadGrid1_ItemInserted">
<PagerStyle Mode="Slider" />
<MasterTableView AutoGenerateColumns="false" DataKeyNames="TerritoryID" EditMode="EditForms"
CommandItemDisplay="TopAndBottom">
<Columns>
<telerik:GridEditCommandColumn>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn ReadOnly="true" HeaderText="TerritoryID" DataField="TerritoryID"
UniqueName="TerritoryID" />
<telerik:GridBoundColumn ReadOnly="false" HeaderText="TerritoryDescription" DataField="TerritoryDescription"
UniqueName="TerritoryDescription" />
<telerik:GridBoundColumn ReadOnly="false" HeaderText="RegionID" DataField="RegionID"
UniqueName="RegionID" />
<telerik:GridButtonColumn CommandName="Delete" Text="Delete">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
<FormTemplate>
<table id="Table2" cellspacing="2" cellpadding="1" width="250" border="1" rules="none"
style="border-collapse: collapse">
<tr>
<td>
<table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0">
<tr>
<td>
TerritoryID:
</td>
<td>
<asp:TextBox ID="txtTerritoryID" MaxLength="5" Visible='<% # (Container as GridItem).OwnerTableView.IsItemInserted %>'
runat="server">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
TerritoryDescription:
</td>
<td>
<asp:TextBox ID="txtTerritoryDescription" runat="server" Text='<%# Eval( "TerritoryDescription" ) %>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td>
RegionID: </td>
<td>
<telerik:RadUpload ID="RadUpload1" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1" ControlObjectsVisibility="None" AllowedFileExtensions=".aspx" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<b>Territory Info:</b>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="btnUpdate" Text='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>'>
</asp:Button>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
C#:-
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
{
GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
RadAjaxManager2.Alert((item.FindControl("RadUpload1") as RadUpload).UploadedFiles.Count.ToString());
)
OR
protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)
{
GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
int cnt=(item.FindControl("RadUpload1") as RadUpload).UploadedFiles.Count;
Response.Write((item.FindControl("RadUpload1") as RadUpload).UploadedFiles[0].FileName);
}
Above either of the following ways I am nt able to retreive any fiels, which I have uploaded through RadUpload control…
Please provide me solution int his regards…
Regards,
Ranganath.S