I have telerik 2011.3.1305.35 -> Q3.
In a sharepoint 2010 visual webpart I have a RadTreeView control, when some particular menu options are selected I want to open radwindow(s) which has an asp:updatepanel and within which I have another radtree,radgrid,repeator, RadAynscUpload (not all in same window).
Folowing is the code I have for this requirement:
Issues I am facing currently:
1) Every time I click on any of these menu options the page is getting refreshed and then radwindow is getting opened, Can we avoid page refresh and just simple open radwindow?
2) One of these RadWindows has RadAsyncUpload (for multiple file uploads), when I select the files to be uploaded I am getting a javascript error saying 'Syntax error' but I can see the file uploaded to the control then when I click on the Upload button my code says the uploadedfiles count is zero. I know there are web.config changes to be done for radupload is that the same case for RadAsyncUpload, can you please specify those?
I have also tried asp:fileupload (even though its not multiple upload) it is uploading the documents correctly but it is closing the radwindow even though I specified trigger for the button.
Code:
protected void rtvDocuments_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e) { RadTreeNode clickedNode = e.Node; switch (e.MenuItem.Value) { case "AddDoc": LoadAllGroups(rtvGroupstoAddDocs); RegisterStartupScript(RadWndwUploadDocs.ClientID); break; case "AddExistingGroup": LoadAllGroups(rtvAllGroups); //loads all the groups RegisterStartupScript(winGroupBrowse.ClientID); break; case "AddExistingDoc": LoadAllDocuments(); //loads all docs in grid RegisterStartupScript(RadWndwAllDocs.ClientID); break; //Other Cases here } private void RegisterStartupScript(string RadControlId) { string script = string.Empty; script = "function f(){$find(\"" + RadControlId + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); } //If files uploaded and on upload button click, submit the documents to repeator and then upload them to SP document library. //I tried both the control, when debugging AsyncUpload count is zero and getting "syntax error" on the page //FileUpload uploads succesfully but closes the radWindow, but I want the window to be showing up, If this is the only solution and if RadAsyncUpload is not helpful for me. protected void SubmitButton_Click(object sender, System.EventArgs e) { //If RadAsyncUpload is used.. I want this to be working because of multi uploads requirement. if (RadAsyncUpload1.UploadedFiles.Count > 0) { labelNoResults.Visible = false; Repeater1.Visible = true; Repeater1.DataSource = RadAsyncUpload1.UploadedFiles; Repeater1.DataBind(); List<string> lstFileNames = new List<string>(); foreach (UploadedFile file in RadAsyncUpload1.UploadedFiles) { lstFileNames.Add(file.FileName); } //AddedControl ISODocuments to SharePoint document library AddDoc(lstFileNames); } else { labelNoResults.Visible = true; Repeater1.Visible = false; } //If file upload is used. if (FileUpload1.PostedFile != null) { string siteUrl = SPContext.Current.Site.Url; using (SPSite siteColl = new SPSite(siteUrl)) { //Get SPWeb object representing a particular website using (SPWeb webSite = siteColl.OpenWeb()) { try { webSite.AllowUnsafeUpdates = true; webSite.Lists.IncludeRootFolder = true; //Get the document library in which documents will be uploaded SPList docLibrary = webSite.Lists["UpLoadedDocuments"]; // objFileUpload is asp.net FileUpload Object Stream FStream; string fname; FStream = FileUpload1.PostedFile.InputStream; int basenamestart = FileUpload1.PostedFile.FileName.LastIndexOf(@"\"); fname = FileUpload1.PostedFile.FileName.Substring(basenamestart + 1); //Upload files into SharePoint document library SPFile file = docLibrary.RootFolder.Files.Add(fname, FStream, true); file.Update(); } catch { } } } } }<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ABC.ascx.cs" Inherits="X.Y.Z" %> <%@ Register Assembly="Telerik.Web.UI, Version=2011.3.1305.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock2"> <script type="text/javascript"> </script> <script type="text/javascript" src="/_layouts/js/MyCustom.js"></script> </telerik:RadScriptBlock> <telerik:RadTreeView ID="rtvDocuments" runat="server" EnableDragAndDrop="True" OnNodeDrop="rtvDocuments_HandleDrop" OnClientNodeDropping="onDropping" OnClientNodeDragging="onNodeDragging" MultipleSelect="true" EnableDragAndDropBetweenNodes="true" OnNodeExpand="rtvDocuments_NodeExpand" AllowNodeEditing="true" OnContextMenuItemClick="rtvDocuments_ContextMenuItemClick" OnNodeEdit="rtvDocuments_NodeEdit"> <ContextMenus> <telerik:RadTreeViewContextMenu CssClass="ctxTreeMenu" ID="cMenuForGroups" runat="server"> <Items> <telerik:RadMenuItem Value="Rename" Text="Rename ..." Enabled="false" ImageUrl="/_layouts/Img/Outlook/rename.gif" PostBack="false"> </telerik:RadMenuItem> <telerik:RadMenuItem Value="NewFolder" Text="New Group" ImageUrl="/_layouts/Img/Outlook/12.gif"> </telerik:RadMenuItem> <telerik:RadMenuItem Value="AddDoc" Text="Add New Document" ImageUrl="/_layouts/Img/Outlook/journal.gif"> </telerik:RadMenuItem> <telerik:RadMenuItem Value="Delete" Text="Delete Group" ImageUrl="/_layouts/Img/Outlook/7.gif"> </telerik:RadMenuItem> <telerik:RadMenuItem IsSeparator="true"> </telerik:RadMenuItem> <telerik:RadMenuItem Value="Copy" Text="Clone ..." ImageUrl="/_layouts/Img/Outlook/10.gif"> </telerik:RadMenuItem> <telerik:RadMenuItem Value="AddExistingGroup" Text="Add Existing Group"> </telerik:RadMenuItem> <telerik:RadMenuItem Value="AddExistingDoc" Text="Add Existing Document"> </telerik:RadMenuItem> <telerik:RadMenuItem Value="ViewAll" Text="View all Instances of ..." ImageUrl="/_layouts/Img/Outlook/searchFolder.gif"> </telerik:RadMenuItem> </Items> <CollapseAnimation Type="OutBack" /> </telerik:RadTreeViewContextMenu> </ContextMenus> </telerik:RadTreeView> <telerik:RadWindow ID="winGroupBrowse" runat="server" EnableViewState="false" Modal="true" Overlay="true" Width="875px" Height="545px" EnableShadow="true" DestroyOnClose="true" ShowContentDuringLoad="false" ReloadOnShow="true"> <ContentTemplate> <div id="globalTree" class="globalTreeCont"> <asp:UpdatePanel ID="pnlTree" Visible="true" runat="server"> <ContentTemplate> <telerik:RadTreeView CssClass="globalTree" OnNodeExpand="rtvDocuments_NodeExpand" ID="rtvAllGroups" runat="server"> </telerik:RadTreeView> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </telerik:RadWindow> <telerik:RadWindow ID="RadWndwAllDocs" runat="server" EnableViewState="false" Modal="true" Overlay="true" Width="875px" Height="545px" EnableShadow="true" DestroyOnClose="true" ShowContentDuringLoad="false" ReloadOnShow="true"> <ContentTemplate> <asp:UpdatePanel ID="pnlGrid" Visible="true" runat="server"> <ContentTemplate> <telerik:RadGrid ID="rgrdAllDocs" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="true" AllowPaging="true" PageSize="10" AllowSorting="true" Height="100%" Width="100%"> <PagerStyle Mode="NextPrevAndNumeric" /> <MasterTableView Height="100%" Width="100%"> <Columns> <telerik:GridBoundColumn HeaderText="ID" DataField="ID" /> <telerik:GridBoundColumn HeaderText="Title" DataField="Title" /> <telerik:GridBoundColumn HeaderText="Description" DataField="Description" /> <telerik:GridBoundColumn HeaderText="ISOGroups" DataField="ISOGroupText" /> </Columns> </MasterTableView> </telerik:RadGrid> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </telerik:RadWindow> <telerik:RadWindow ID="RadWndwUploadDocs" runat="server" EnableViewState="false" Modal="true" Overlay="true" Width="875px" Height="545px" EnableShadow="true" DestroyOnClose="true" ShowContentDuringLoad="false" ReloadOnShow="true"> <ContentTemplate> <asp:UpdatePanel ID="pnlUpload" Visible="true" runat="server" UpdateMode="conditional"> <%-- If file upload is used instead of radAsyncUpload UNCOMMENT the trigger <Triggers> <asp:PostBackTrigger ControlID="SubmitButton" /> </Triggers> --%> <ContentTemplate> <div class="grid grid_18 wizardMargin"> <div id="uploadCont"> <div class="columns"> <div class="col1"> <h4> Groups on Page</h4> <div class="treeCont"> <telerik:RadTreeView CssClass="globalTree" OnNodeExpand="rtvDocuments_NodeExpand" ID="rtvGroupstoAddDocs" runat="server"></telerik:RadTreeView> </div> </div> <div class="col2"> <h4> Uploaded Files</h4> <div class="fileTree"> <asp:Label ID="labelNoResults" runat="server" Visible="True">No uploaded files</asp:Label> <asp:Repeater runat="server" ID="Repeater1"> <ItemTemplate> <div class="fileListStyle"> <%# DataBinder.Eval(Container.DataItem, "FileName").ToString() %> (<%# DataBinder.Eval(Container.DataItem, "ContentLength").ToString() %>bytes)<br /> </div> </ItemTemplate> </asp:Repeater> </div> </div> </div> <div class="uploadControls"> <h4> Select Files to Upload</h4> <div class="FileDetails"> <table class="uploadTable"> <tbody> <tr> <td class="uploader"> <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" Skin="default"> </telerik:RadAsyncUpload> //Tried asp fileupload, it is uploading files to document library and closing the radwindow.I donot want it to close it. // <asp:FileUpload ID="FileUpload1" runat="server" /> <asp:Button runat="server" ID="SubmitButton" Text="Upload files" OnClick="SubmitButton_Click" /> </td> </tr> </tbody> </table> </div> </div> </div> </div> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </telerik:RadWindow>Any help is appreciated.

here we setting the MultiViewRows based on a calculation.
some times the fourth month data(available date) will be none and user cannot view the foirth month
is this possible..in schduler_PreRender event?
please reply me urg
protected void schduler_PreRender(object sender, EventArgs e)
{
RadCalendar popupCalendar = schduler.FindControl("SelectedDateCalendar") as RadCalendar;
popupCalendar.ShowOtherMonthsDays =
false;
popupCalendar.AutoPostBack =
true;
int count = GetMonthCount(lst.ToArray(), popupCalendar.SelectedDate).Count;
popupCalendar.MultiViewColumns = 2;
double _val = (double)count;
popupCalendar.MultiViewRows = (
int)Math.Round(_val/2);
popupCalendar.FocusedDate = lst[0];
popupCalendar.DayRender +=
new Telerik.Web.UI.Calendar.DayRenderEventHandler(popupCalendar_DayRender);
}

