| <telerik:RadGrid ID="RadGrid1" runat="server" |
| AutoGenerateColumns="false" |
| AllowPaging="true" |
| AllowAutomaticInserts="false" |
| AllowAutomaticDeletes="false" |
| AllowAutomaticUpdates="false" |
| OnItemDataBound="RadGrid1_ItemDataBound" |
| OnNeedDataSource="RadGrid1_NeedDataSource" |
| OnInsertCommand="RadGrid1_InsertCommand" |
| OnUpdateCommand="RadGrid1_UpdateCommand" |
| OnPreRender="RadGrid1_PreRender" |
| > |
| <MasterTableView |
| EditMode="PopUp" |
| CommandItemDisplay="Top" |
| DataKeyNames="NoteID" |
| > |
| <EditFormSettings InsertCaption="Add new Note" /> |
| <Columns> |
| <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" HeaderStyle-Width="35px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> |
| <telerik:GridBoundColumn DataField="NoteID" UniqueName="NoteID" Visible="false" /> |
| <telerik:GridTemplateColumn HeaderText="!" UniqueName="Important" HeaderStyle-Font-Bold="true" HeaderStyle-Width="10px"> |
| <ItemTemplate> |
| <asp:Label ID="lblImportant" runat="server" ForeColor="Red" Text='<%# (bool)Eval("Important") ? "!" : "" %>' ToolTip="Note is marked as important" Font-Bold="true" /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn HeaderText="Type" DataField="NoteType" UniqueName="NoteType" DataType="System.String" ItemStyle-Wrap="false" HeaderStyle-Width="110px" /> |
| <telerik:GridBoundColumn HeaderText="Recorded By" DataField="RecordedBy" UniqueName="RecordedBy" DataType="System.String" ReadOnly="true" HeaderStyle-Wrap="false" HeaderStyle-Width="120px" ItemStyle-Wrap="false" /> |
| <telerik:GridBoundColumn HeaderText="Date Created" DataField="ServerDate" UniqueName="ServerDate" DataType="System.DateTime" HeaderStyle-Wrap="false" HeaderStyle-Width="140px" ItemStyle-Wrap="true" /> |
| <telerik:GridBoundColumn HeaderText="Subject" DataField="SubjectSummary" UniqueName="SubjectSummary" DataType="System.String" /> |
| </Columns> |
| <EditFormSettings InsertCaption="Add new Note" CaptionFormatString="Edit Note" CaptionDataField="NoteID" EditFormType="Template"> |
| <FormTemplate> |
| <table cellpadding="4" cellspacing="0" width="100%" border="0"> |
| <tr> |
| <td style="width: 10px; white-space: nowrap; font-weight: bold;">Recorded By:</td> |
| <td> |
| <asp:Label ID="lblRecordedBy" runat="server" Text='<%# Bind("RecordedBy") %>' /> |
| </td> |
| <td style="font-weight: bold;">on</td> |
| <td> |
| <asp:Label ID="lblServerDate" runat="server" Text='<%# Bind("ServerDate") %>' /> |
| </td> |
| <td style="width: 10px; font-weight: bold;">Type:</td> |
| <td style="width: 114px;"> |
| <telerik:RadComboBox ID="cboType" runat="server" SkinID="RadCombo" Width="110px" /> |
| </td> |
| </tr> |
| </table> |
| <table cellpadding="4" cellspacing="0" width="100%" border="0"> |
| <tr> |
| <td style="width: 40px; font-weight: bold;">Subject:</td> |
| <td colspan="3"> |
| <telerik:RadTextBox ID="txtSubject" runat="server" |
| SkinID="RadTextBoxDefault" |
| Text='<%# DataBinder.Eval(Container.DataItem, "Subject") %>' |
| Width="100%" |
| /> |
| </td> |
| <td style="width: 40px; font-weight: bold;">Important?</td> |
| <td style="width: 10px;"><asp:CheckBox ID="chkImportant" runat="server" Checked='<%# (Container is GridEditFormInsertItem) ? false : Eval("Important") %>' /></td> |
| </tr> |
| <tr> |
| <td colspan="100%" valign="top" align="left"> |
| <telerik:RadEditor ID="radEditor_Note" runat="server" |
| Width="100%" |
| Height="250px" |
| Content='<%# DataBinder.Eval(Container.DataItem, "Note") %>' |
| AutoResizeHeight="true" |
| EditModes="Design" |
| ToolbarMode="Default" |
| > |
| <Tools> |
| <telerik:EditorToolGroup> |
| <telerik:EditorTool Name="Bold" /> |
| <telerik:EditorTool Name="Italic" /> |
| <telerik:EditorTool Name="Underline" /> |
| <telerik:EditorSeparator /> |
| <telerik:EditorTool Name="JustifyLeft" /> |
| <telerik:EditorTool Name="JustifyCenter" /> |
| <telerik:EditorTool Name="JustifyRight" /> |
| <telerik:EditorSeparator /> |
| <telerik:EditorTool Name="AjaxSpellCheck" /> |
| <telerik:EditorSeparator /> |
| <telerik:EditorTool Name="ToggleScreenMode" /> |
| </telerik:EditorToolGroup> |
| </Tools> |
| </telerik:RadEditor> |
| </td> |
| </tr> |
| </table> |
| <table width="100%" style="margin-top: 10px;"> |
| <tr> |
| <td align="right" colspan="100%"> |
| <asp:Button ID="btnUpdate" runat="server" |
| Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' |
| CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' |
| SkinID="btnSearch" |
| Visible='<%# (AllowAdd || AllowEdit) ? true : false %>' |
| /> |
| |
| <asp:Button ID="btnCancel" runat="server" |
| Text='<%# (AllowAdd || AllowEdit) ? "Cancel" : "Close" %>' |
| CausesValidation="False" |
| CommandName="Cancel" |
| SkinID="btnSearch" |
| /> |
| </td> |
| </tr> |
| <tr> |
| <td colspan="100%"> |
| </td> |
| </tr> |
| </table> |
| <asp:Label ID="lblNoteTypeID" runat="server" Text='<%# Bind("NoteTypeID") %>' Visible="false" /> |
| </FormTemplate> |
| </EditFormSettings> |
| </MasterTableView> |
| <ClientSettings> |
| <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="PopUpShowing" /> |
| <Scrolling AllowScroll="true" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| // enable/disable command items based on security |
| foreach (GridCommandItem item in RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)) |
| { |
| if (!AllowAdd) |
| { |
| ((Button)item.FindControl("AddNewRecordButton")).Visible = false; |
| ((LinkButton)item.FindControl("InitInsertButton")).Visible = false; |
| } |
| ((LinkButton)item.FindControl("RebindGridButton")).Visible = false; |
| ((Button)item.FindControl("RefreshButton")).Visible = false; |
| } |
| } |
| protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| LoadData(); |
| } |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
| { |
| // get handles for the controls in the FormTemplate |
| GridEditableItem item = (GridEditableItem)e.Item; |
| Label lblNoteTypeID = item.FindControl("lblNoteTypeID") as Label; |
| Label lblRecordedBy = item.FindControl("lblRecordedBy") as Label; |
| Label lblServerDate = item.FindControl("lblServerDate") as Label; |
| RadComboBox cboType = item.FindControl("cboType") as RadComboBox; |
| RadTextBox txtSubject = item.FindControl("txtSubject") as RadTextBox; |
| CheckBox chkImportant = item.FindControl("chkImportant") as CheckBox; |
| RadEditor radEditor_Note = item.FindControl("radEditor_Note") as RadEditor; |
| Button btnUpdate = item.FindControl("btnUpdate") as Button; |
| Button btnCancel = item.FindControl("btnCancel") as Button; |
| string noteTypeID = lblNoteTypeID.Text; |
| // set the combo |
| switch (ForeignKeyType) |
| { |
| case ForeignKeyTypes.Branch: |
| bindComboToEnum(cboType, ListCategory.BranchNoteType); |
| break; |
| case ForeignKeyTypes.BranchProspect: |
| bindComboToEnum(cboType, ListCategory.BranchProspectNoteType); |
| break; |
| case ForeignKeyTypes.Recruit: |
| bindComboToEnum(cboType, ListCategory.RecruitNoteType); |
| break; |
| default: break; |
| } |
| // Edit versus Insert logic |
| if (e.Item.OwnerTableView.IsItemInserted) |
| { |
| // insert mode |
| lblRecordedBy.Text = CurrentUser.FullName; |
| lblServerDate.Text = DateTime.Now.ToString(); |
| } |
| else |
| { |
| // edit mode |
| cboType.SelectedIndex = cboType.Items.IndexOf(cboType.Items.FindItemByValue(noteTypeID)); |
| cboType.Enabled = AllowEdit; |
| txtSubject.ReadOnly = !AllowEdit; |
| chkImportant.Enabled = AllowEdit; |
| radEditor_Note.Enabled = AllowEdit; |
| btnUpdate.Visible = AllowEdit; |
| btnCancel.Text = "Close"; |
| } |
| } |
| else if (e.Item is GridHeaderItem) |
| { |
| GridHeaderItem headerItem = e.Item as GridHeaderItem; |
| headerItem["EditCommandColumn"].Text = AllowEdit ? "Edit" : "View"; |
| } |
| } |
| protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) |
| { |
| GridEditableItem item; |
| NoteEntity note; |
| int newNoteTypeID; |
| string msg = string.Empty; |
| item = e.Item as GridEditableItem; |
| newNoteTypeID = (item.FindControl("cboType") as RadComboBox).SelectedValue.ToInt(); |
| note = ServiceProxy.getService<INoteService>().Fetch(item.GetDataKeyValue("NoteID").ToString().ToInt(), FetchTypes.Heavy); |
| // update the note |
| note.Note = (item.FindControl("radEditor_Note") as RadEditor).Content; |
| note.Important = (item.FindControl("chkImportant") as CheckBox).Checked; |
| note.Subject = (item.FindControl("txtSubject") as RadTextBox).Text; |
| // update the note type |
| switch (ForeignKeyType) |
| { |
| case ForeignKeyTypes.Branch: |
| if (note.BranchNote != null) |
| note.BranchNote[0].BranchNoteTypeID = newNoteTypeID; |
| break; |
| case ForeignKeyTypes.BranchProspect: |
| if (note.BranchProspectNote != null) |
| note.BranchProspectNote[0].BranchProspectNoteTypeID = newNoteTypeID; |
| break; |
| case ForeignKeyTypes.Recruit: |
| if (note.RecruitApplicationNote != null && note.RecruitApplicationNote.Count > 0) |
| note.RecruitApplicationNote[0].RecruitNoteTypeID = newNoteTypeID; |
| break; |
| default: break; |
| } |
| // perform the save |
| note = ServiceProxy.getService<IEntityService>().EntitySave(note) as NoteEntity; |
| msg = note.StatusMessage; |
| if (msg.Length > 0) |
| { |
| lblStatusMessage.Text = msg; |
| lblStatusMessage.ForeColor = System.Drawing.Color.Red; |
| ErrorHandler.Handle(new Exception(msg), Request); |
| } |
| e.Item.OwnerTableView.ClearEditItems(); |
| LoadData(true); |
| } // RadGrid1_UpdateCommand |
| protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e) |
| { |
| GridEditableItem item; |
| NoteEntity note; |
| int newNoteTypeID; |
| string msg = string.Empty; |
| item = e.Item.OwnerTableView.GetInsertItem() as GridEditableItem; |
| note = new NoteEntity(); |
| newNoteTypeID = (item.FindControl("cboType") as RadComboBox).SelectedValue.ToInt(); |
| note.Note = (item.FindControl("radEditor_Note") as RadEditor).Content; |
| note.Important = (item.FindControl("chkImportant") as CheckBox).Checked; |
| note.Subject = (item.FindControl("txtSubject") as RadTextBox).Text; |
| note.ClientDate = DateTime.Now; |
| note.RecordedBy = CurrentUser.FullName; |
| // add the note type |
| switch (ForeignKeyType) |
| { |
| case ForeignKeyTypes.Branch: |
| BranchNoteEntity bne = new BranchNoteEntity(ForeignKey, note.NoteID); |
| note.BranchNote.Add(bne); |
| break; |
| case ForeignKeyTypes.BranchProspect: |
| BranchProspectNoteEntity bpne = new BranchProspectNoteEntity(ForeignKey.ToInt(), note.NoteID); |
| note.BranchProspectNote.Add(bpne); |
| break; |
| case ForeignKeyTypes.Recruit: |
| RecruitApplicationNoteEntity rne = new RecruitApplicationNoteEntity(ForeignKey.ToInt(), note.NoteID); |
| note.RecruitApplicationNote.Add(rne); |
| break; |
| default: break; |
| } |
| // perform the save |
| note = ServiceProxy.getService<IEntityService>().EntitySave(note) as NoteEntity; |
| msg = note.StatusMessage; |
| if (msg.Length > 0) |
| { |
| lblStatusMessage.Text = msg; |
| lblStatusMessage.ForeColor = System.Drawing.Color.Red; |
| ErrorHandler.Handle(new Exception(msg), Request); |
| } |
| e.Item.OwnerTableView.IsItemInserted = false; |
| LoadData(true); |
| } // RadGrid1_InsertCommand |
| private void LoadData() |
| { |
| LoadData(false); |
| } |
| private void LoadData(bool rebind) |
| { |
| DataSet dsSource = ServiceProxy.getService<INoteService>().FetchNotes(ForeignKeyType, ForeignKey, FetchTypes.Heavy); |
| if (dsSource.Tables.Count > 0) |
| { |
| DataColumn dc = new DataColumn("SubjectSummary", Type.GetType("System.String")); |
| dsSource.Tables[0].Columns.Add(dc); |
| foreach (DataRow dr in dsSource.Tables[0].Rows) |
| { |
| string summary = dr["Subject"].ToString().StripTags(); |
| dr["SubjectSummary"] = summary.Length < SummaryLength ? summary : string.Format("{0}...", summary.Left(SummaryLength - 3)); |
| } |
| RadGrid1.DataSource = dsSource; |
| if (rebind) |
| RadGrid1.DataBind(); |
| } |
| ErrorHandler.Handle(new ArgumentException(string.Format("No data was returned for the FetchNotes method:\n\nForeignKeyType: {0}\nForeignKey: {1}\n", ForeignKeyType, ForeignKey)), this.Request); |
| } |
Hello,
I have a grid with a nested view template. I removed the expand/collapse column to create a customized one.
In the ItemDataBound method I do the following:
TableCell tcExpand = item["Expand"];Image img = new Image();img.ImageUrl = "/images/expand_collapse_plus.gif";img.AlternateText = "+";img.Attributes.Add("OnClick","ExpandThisMasterTableViewItem(this);");tcExpand.Controls.Clear();tcExpand.Controls.Add(img);On the front end I have:
function ExpandThisMasterTableViewItem(sender) { var rowIndex = $(sender).closest("tr").attr("id"); rowIndex = rowIndex.substr(rowIndex.lastIndexOf('_') + 1); var firstMasterTableViewRow = $find("<%= myGrid.MasterTableView.ClientID %>").get_dataItems()[rowIndex]; if (firstMasterTableViewRow.get_expanded()) { $(sender).closest("tr").find("td").css("background-color", "none"); $(sender).closest("img[src*='expand']").src = "/images/expand_collapse_plus.gif"; firstMasterTableViewRow.set_expanded(true); } else { $(sender).closest("tr").find("td").css("background-color", "#DBFEDB"); $(sender).closest("img[src*='expand']").attr('src', '/images/expand_collapse_minus.gif'); firstMasterTableViewRow.set_expanded(true); }}
The line firstMasterTableViewRow.set_expanded always seems to call an image for my custom expand button and I end up with an error :
GET http://localserver/mypage/undefined 404 (Not Found)
If I comment the line, I do not have that 404 not found error. But i need to expand / collapse my rows.
Any idea why this error is thrown with that line?
Thank you
Hi community,
I am facing the following challenge:
I want to view some table data with nested details and different structure, but the details should be load on demand to reduce load to the database.
I tried using the NestedViewTemplate which unfortunately shows the same behavior regardless of the "HierarchyLoadMode" or the "GroupLoadMode".
All of the data queries are fired at once during initial load/databind.
I also tried it with the example from http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/hierarchy-with-templates/defaultcs.aspx which shows the same behavior.
Isn't there an option to load data for the NestedViewTemplate on demand? What am I doing wrong?
Best regards,
Tobias

i need to call Server side "Grid_ItemCommand"
<telerik:RadGrid ID="DgDataGrid" runat="server" AllowPaging="true" PageSize="10" OnItemDataBound="DgDataGrid_ItemDataBound" OnItemCommand="DgDataGrid_ItemCommand" CellSpacing="2" >
<MasterTableView AutoGenerateColumns="false" TableLayout="Fixed">
<Columns>
....
</MasterTableView>
<ClientSettings>
<ClientEvents OnCommand="OnCommand" />
</ClientSettings>
Hi all,
Using UI for ASP.NET AJAX Q3 2015 along with VS 2013. I am using below link as a prototype.
http://demos.telerik.com/aspnet-ajax/asyncupload/examples/validation/defaultcs.aspx
I modified it to fit my requirements. I would like to use RadAjaxLoadingPanel and RadAsyncUpload together on the button click event of the below button (attached AsyncUpload - Validation.png)
<telerik:RadButton runat="server" Skin="Silk" ID="BtnSubmit"Text="Validate the uploaded files" OnClick="BtnSubmit_Click"></telerik:RadButton>
On Button Click event, the routine uploads the file as well as runs SQL Stored procedure and on return Stored procedure also executes SSIS packages.
The whole process takes some 5-7 minutes that is the main reason I would like to display the Loading Panel during the execution phase. Instead of IE “Waiting for Local host” message. If I do use RadAjaxLoadingPanel, after the process complete, current form stays open, does not go to attached 2nd screen (Attachment 2.png).
Below is my complete code. Thanks for any help
Gc_0620
_________
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml'><head runat="server"> <title>Telerik ASP.NET Example</title> <link rel="stylesheet" type="text/css" href="styles.css" /> <script type="text/javascript" src="scripts.js"></script></head><body> <form id="form1" runat="server"> <telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function rAsyncUpload_Selected(sender, args) { var currentFileName = args.get_fileName(); document.getElementById('<%=hidValueFileName.ClientID %>').value = currentFileName; } function OnClientFileUploadRemoved(sender, args) { var currentFileName = args.get_fileName(); // alert(currentFileName); //OnClientFileUploadRemoved document.getElementById('<%=hidValueFileName.ClientID %>').value = ""; __doPostBack("<%= RefreshButton.UniqueID %>", "OnClick"); } </script> </telerik:RadCodeBlock> <div class="demo-container size-medium"> <div class="qsf-demo-canvas"> <h2>Upload your files</h2> <ul class="qsf-list"> <li> <strong>Allowed file types:</strong> jpg, jpeg, png, gif,csv (client-side validation). </li> <li> <strong>Allowed overall upload size:</strong> 100 MB (server-side validation). </li> </ul> <table> <tr id="in_put" runat="server"> <td> <telerik:RadMonthYearPicker ID="RadMonthYearPicker1" AutoPostBack="true" OnSelectedDateChanged="btnPopulate_Form" runat="server"> </telerik:RadMonthYearPicker> </td> <td> <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" AllowedFileExtensions="jpg,jpeg,png,gif,csv" TargetFolder="" MultipleFileSelection="Automatic" OnClientFileSelected="rAsyncUpload_Selected" PostbackTriggers="BtnSubmit" MaxFileSize="100971520" Skin="Silk" OnClientFileUploadRemoved="OnClientFileUploadRemoved" UploadedFilesRendering="BelowFileInput"> </telerik:RadAsyncUpload> </td> </tr> </table> <div class="qsf-results"> <telerik:RadButton runat="server" Skin="Silk" ID="BtnSubmit" Text="Validate the uploaded files" OnClick="BtnSubmit_Click"> </telerik:RadButton> <asp:Panel ID="ValidFiles" Visible="false" runat="server" CssClass="qsf-success"> <h3>You successfully uploaded:</h3> <ul class="qsf-list" runat="server" id="ValidFilesList"></ul> </asp:Panel> <asp:Panel ID="InvalidFiles" Visible="false" runat="server" CssClass="qsf-error"> <h3>The Upload failed for:</h3> <ul class="qsf-list ruError" runat="server" id="InValidFilesList"> <li> <p class="ruErrorMessage">The size of your overall upload exceeded the maximum of 1 MB</p> </li> </ul> </asp:Panel> <telerik:RadButton Skin="Silk" ID="RefreshButton" runat="server" OnClick="RefreshButton_Click" Visible="false" Text="Back"></telerik:RadButton> </div> <div class="qsf-decoration"></div> </div> <script type="text/javascript"> //<![CDATA[ Sys.Application.add_load(function () { demo.initialize(); }); //]]> </script> <table> <tr> <td class="hiddentd_width"> <asp:HiddenField ID="hidValueFileName" runat="server" /> </td> <td class="hiddentd_width"> <asp:HiddenField runat="server" ID="hiddendmonth" Value="" /> </td> <td class="hiddentd_width"> <asp:HiddenField runat="server" ID="hdnstartdate" Value="" /> </td> <td class="hiddentd_width"> <asp:HiddenField runat="server" ID="hdnenddate" Value="" /> </td> <td class="hiddentd_width"> <asp:HiddenField runat="server" ID="hdncurrentfy" Value="" /> </td> <td class="hiddentd_width"> <asp:HiddenField runat="server" ID="hdnnexteffectivedate" Value="" /> </td> </tr> <tr> <td> <asp:HiddenField runat="server" ID="hdnCurrentFiscalYear_st_dt" Value="" /> </td> <td> <asp:HiddenField runat="server" ID="hdnNextFiscalYear_st_dt" Value="" /> </td> <td> <asp:HiddenField runat="server" ID="hdnCurrentMonthFile" Value="" /> </td> <td> <asp:HiddenField runat="server" ID="hdnNextMonthFile" Value="" /> </td> <td> <asp:HiddenField runat="server" ID="hdnEndCurrentMonthFile" Value="" /> </td> <td> <asp:HiddenField runat="server" ID="hdnBegNextMonthFile" Value="" /> </td> </tr> <tr> <td> <asp:HiddenField runat="server" ID="HiddenFiscalYear" Value="" /> </td> <td> <asp:HiddenField runat="server" ID="hdnFolderCreated" Value="" /> </td> <td> <telerik:RadToolTip runat="server" ID="tooltip1" TargetControlID="ClientID" IsClientID="true" Animation="FlyIn" Skin="WebBlue" OffsetX="35" EnableRoundedCorners="true" EnableShadow="true" RelativeTo="Element" AnimationDuration="2000" ShowDelay="500" RenderInPageRoot="true" Position="TopRight"> </telerik:RadToolTip> </td> </tr> </table> </div> </form></body></html>
using System;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Configuration;using System.Web.Security;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Telerik.Web.UI;using System.Collections;using System.Drawing;using System.Text.RegularExpressions;using System.Data.SqlClient;using System.IO;namespace WebApplication1{ public partial class WebForm1 : System.Web.UI.Page { const int MaxTotalBytes = 1048576; // 1 MB long totalBytes; public static string connectionString = ConfigurationManager.ConnectionStrings["my-ConnectionString"].ToString(); public SqlConnection sqlConnection = new SqlConnection(connectionString); //Declare a global SqlDataAdapter SqlDataAdapter public SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); //Declare a global SqlCommand SqlCommand public SqlCommand sqlCommand = new SqlCommand(); // SqlString a = new SqlString(); public static string Tempstr, Tempstr1, message, cleanMessage, global_export_folder, updatedDataKey, folderpath = string.Empty; protected void Page_Load(object sender, EventArgs e) { } public void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e) { /* BtnSubmit.Visible = false; RefreshButton.Visible = true; RadAsyncUpload1.Visible = false; var liItem = new HtmlGenericControl("li"); liItem.InnerText = e.File.FileName; if (totalBytes < MaxTotalBytes) { // Total bytes limit has not been reached, accept the file e.IsValid = true; totalBytes += e.File.ContentLength; } else { // Limit reached, discard the file e.IsValid = false; } if (e.IsValid) { ValidFiles.Visible = true; ValidFilesList.Controls.AddAt(0, liItem); } else { InvalidFiles.Visible = true; InValidFilesList.Controls.AddAt(0, liItem); } */ } protected void RefreshButton_Click(object sender, EventArgs e) { Page.Response.Redirect(Request.RawUrl); } protected void btnPopulate_Form(object sender, EventArgs e) { if (RadMonthYearPicker1.DbSelectedDate == null) { hiddendmonth.Value = ""; // RadAjaxPanel1.ResponseScripts.Add(string.Format("alert('- Reporting Month is required!!!');")); return; } if (RadMonthYearPicker1.SelectedDate.Value >= DateTime.Now) { // RadAjaxPanel1.ResponseScripts.Add(string.Format("alert('- Can't be future date!');")); // return; } // Tempstr = RadMonthYearPicker1.DbSelectedDate.ToString(); // Tempstr1 = Tempstr; string startmonth_year = RadMonthYearPicker1.SelectedDate.Value.Month.ToString() + " , " + RadMonthYearPicker1.SelectedDate.Value.Year.ToString(); DateTime selectedDate = RadMonthYearPicker1.SelectedDate.Value; DateTime startDate = selectedDate.AddDays((selectedDate.Day - 1) * -1); DateTime endDate = startDate.AddDays(DateTime.DaysInMonth(startDate.Year, startDate.Month) - 1); string dtselectedyear = RadMonthYearPicker1.SelectedDate.Value.Year.ToString(); DateTime NextMonthEffectiveDate = endDate.AddDays(+1); // int PreviousYear = (RadMonthYearPicker1.SelectedDate.Value.Year - 1); int NextYear = (RadMonthYearPicker1.SelectedDate.Value.Year + 1); string CurrentFiscalYear_st_dt, NextFiscalYear_st_dt = null; string month_selected = string.Empty; string currentmonth = string.Empty; string nextmonth = string.Empty; switch (RadMonthYearPicker1.SelectedDate.Value.Month.ToString()) { case "1": month_selected = "January"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "01E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "02B"; break; case "2": month_selected = "February"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "02E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "03B"; break; case "3": month_selected = "March"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "03E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "04B"; break; case "4": month_selected = "April"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "04E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "05B"; break; case "5": month_selected = "May"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "05E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "06B"; break; case "6": month_selected = "June"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "06E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "07B"; break; case "7": month_selected = "July"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "07E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "08B"; break; case "8": month_selected = "August"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "08E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "09B"; break; case "9": month_selected = "September"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "09E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "10B"; break; case "10": month_selected = "October"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "10E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "11B"; break; case "11": month_selected = "November"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "11E"; nextmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "12B"; break; case "12": month_selected = "December"; currentmonth = dtselectedyear.Substring(dtselectedyear.Length - 2) + "12E"; nextmonth = NextYear.ToString().Substring(NextYear.ToString().Length - 2) + "01B"; break; default: break; } if (RadMonthYearPicker1.SelectedDate.Value.Month <= 6) { CurrentFiscalYear_st_dt = "07/01/" + (RadMonthYearPicker1.SelectedDate.Value.Year - 1).ToString(); NextFiscalYear_st_dt = "07/01/" + (RadMonthYearPicker1.SelectedDate.Value.Year).ToString(); } else { CurrentFiscalYear_st_dt = "07/01/" + (RadMonthYearPicker1.SelectedDate.Value.Year).ToString(); NextFiscalYear_st_dt = "07/01/" + (RadMonthYearPicker1.SelectedDate.Value.Year + 1); //NextYear.ToString(); } hiddendmonth.Value = month_selected.ToString(); hdnstartdate.Value = startDate.ToShortDateString(); hdnenddate.Value = endDate.ToShortDateString(); hdncurrentfy.Value = NextFiscalYear_st_dt.Substring(NextFiscalYear_st_dt.ToString().Length - 4); // Until June, Selected year of date. // Higher than june, Selected year+1 hdnnexteffectivedate.Value = NextMonthEffectiveDate.ToShortDateString(); hdnNextFiscalYear_st_dt.Value = NextFiscalYear_st_dt.ToString(); hdnCurrentFiscalYear_st_dt.Value = CurrentFiscalYear_st_dt.ToString(); hdnCurrentMonthFile.Value = currentmonth.ToString(); hdnNextMonthFile.Value = nextmonth.ToString(); hdnEndCurrentMonthFile.Value = month_selected.ToString() + ' ' + RadMonthYearPicker1.SelectedDate.Value.Year.ToString(); if (RadMonthYearPicker1.SelectedDate.Value.Month == 12) { hdnBegNextMonthFile.Value = "January" + ' ' + (RadMonthYearPicker1.SelectedDate.Value.Year + 1).ToString(); Tempstr = "January" + ' ' + (RadMonthYearPicker1.SelectedDate.Value.Year + 1).ToString(); Tempstr1 = Tempstr; } else { hdnBegNextMonthFile.Value = NextMonthEffectiveDate.ToString("MMMM") + ' ' + RadMonthYearPicker1.SelectedDate.Value.Year.ToString(); Tempstr1 = Tempstr; } Tempstr = "Current FY Start Dt: " + CurrentFiscalYear_st_dt + " Next FY Start Dt: " + NextFiscalYear_st_dt + " Hidden FY: " + hdncurrentfy.Value; Tempstr1 = Tempstr; } protected void BtnSubmit_Click(object sender, System.EventArgs e) { // ValidationInput.Text = string.Empty; if (RadMonthYearPicker1.SelectedDate >= DateTime.Now || RadAsyncUpload1.UploadedFiles.Count == 0) { return; } else { if (RadMonthYearPicker1.SelectedDate.Value.Month <= 9) // if (RadMonthYearPicker1.SelectedDate.Value.Month.ToString().Length < 2) { folderpath = "0" + RadMonthYearPicker1.SelectedDate.Value.Month.ToString(); } else { folderpath = RadMonthYearPicker1.SelectedDate.Value.Month.ToString(); } string tempfolderpath = hdnCurrentFiscalYear_st_dt.Value.Substring(hdnCurrentFiscalYear_st_dt.Value.ToString().Length - 4) + "\\"; Tempstr = tempfolderpath; Tempstr1 = Tempstr; folderpath = "FY" + hdncurrentfy.Value + "\\" + hdncurrentfy.Value + '-' + folderpath + ' ' + hiddendmonth.Value; Tempstr = folderpath; Tempstr1 = Tempstr; sqlCommand = new SqlCommand("Import_Source_File", sqlConnection); sqlCommand.Parameters.AddWithValue("@FolderName", folderpath.ToString().Trim()); sqlCommand.Parameters.AddWithValue("@runtype", "1"); var outParam = new SqlParameter("@FolderCreated", SqlDbType.VarChar); outParam.Direction = ParameterDirection.Output; outParam.Size = 4000; sqlCommand.Parameters.Add(outParam); // sqlCommand.Parameters.@FolderCreated.size = 2000; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandTimeout = 7200; sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); sqlCommand.Dispose(); var folder = Path.GetDirectoryName(outParam.Value.ToString().Trim()) + "\\"; hdnFolderCreated.Value = "All files are created into Network Folder: " + folder; global_export_folder = folder; Tempstr = folder; Tempstr1 = Tempstr; sqlConnection.Close(); RadAsyncUpload1.TargetFolder = global_export_folder; string path = RadAsyncUpload1.TargetFolder; string file_name = hiddendmonth.Value.ToString(); foreach (UploadedFile file in RadAsyncUpload1.UploadedFiles) { file.SaveAs(Path.Combine((path), hidValueFileName.Value.ToString())); // + file.GetExtension())); } string destfileextension = System.IO.Path.GetExtension(hidValueFileName.Value.ToString().Trim()); string destfile_w_outextension = hidValueFileName.Value.ToString().Trim().Substring(0, hidValueFileName.Value.ToString().Trim().Length - destfileextension.Length); sqlCommand = new SqlCommand("Import_Source_File", sqlConnection); sqlCommand.Parameters.AddWithValue("@FolderName", global_export_folder.ToString()); sqlCommand.Parameters.AddWithValue("@runtype", "2"); sqlCommand.Parameters.AddWithValue("@SourcefileName", destfile_w_outextension.ToString().Trim()); sqlCommand.Parameters.AddWithValue("@SourceCSVfileName", hidValueFileName.Value.ToString().Trim()); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandTimeout = 7200; sqlConnection.Open(); Tempstr = "Global Export Folder: " + global_export_folder.ToString() + " Folder: " + folder.ToString().Trim(); Tempstr += " File Name with extension: " + hidValueFileName.Value.ToString().Trim() + " File Name w/o extension: " + destfile_w_outextension.ToString().Trim(); sqlCommand.ExecuteNonQuery(); sqlCommand.Dispose(); if (sqlConnection.State == ConnectionState.Open) { Tempstr = "Connection Open"; } else { Tempstr = "Connection Close"; } sqlConnection.Close(); // Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "disp_confirm();", true); BtnSubmit.Visible = false; RefreshButton.Visible = true; in_put.Visible = false; // RadMonthYearPicker1.Visible = false; BtnSubmit.Visible = false; RefreshButton.Visible = true; RefreshButton.Text = "Return"; RadAsyncUpload1.Visible = false; } } }}
Hello
I am using a , Dropdown Control, Rad Menu and Popup Window in a shared hosting server but unfortunately its not working.
I have checked the forum and seen the probable solutions, unfortunately any of them works out.
You can check the issue on : http://ravidiesel.in/Project/Hostingtest/Test_Hosting.aspx
And the workable version on : http://182.18.176.12:82/Project/Hostingtest/Test_Hosting.aspx
I am relay confused what gone wrong. I have just copied all the files from one hosting provider to another.
Here is the Web.Config file that I am using:
Do any person can help me out on this. I am really stacked up.
Regards
Santanu
<?xml version="1.0" encoding="UTF-8"?><configuration>
<connectionStrings>
</connectionStrings>
<system.web>
<!--<machineKey validationKey="E6237171580ECD6B2F36126027EB27D9173DA5C4C7C815B99FEF5ADAADF8D20E2BBF09D038826EDDAF2A5D0E8DD79D89D6631C2B47485FE350C912504AAB4F1E,IsolateApps" decryptionKey="2C7FA1284F8573B1F0F95F761ED7B212C368643F33A9A6FE,IsolateApps" validation="SHA1" />
<sessionState timeout="5400"/>-->
<sessionState mode="StateServer" cookieless="false" timeout="5"/>
<machineKey
validationKey="59361B5E99D541785FF6EBA8650E08CC87428B34DBB6C68B401CE07ECEBE886EC3413E59C53FC46A31F6FCCADAED2A14CCC27E63DAD789CCDF20191F0612E3B3"
decryptionKey="E0289E75B93F90F755AC3A7F4B2A5F4FBDD2091A9B193A3BBCF5F4AFB23E64EF"
validation="SHA1"
decryption="AES" />
<httpRuntime maxRequestLength="1048576" />
<pages maintainScrollPositionOnPostBack="true" enableEventValidation="false" viewStateEncryptionMode="Never" />
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<!--<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />-->
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" /></assemblies>
<buildProviders>
<!--<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>-->
</buildProviders>
</compilation>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
<add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
<add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ReportViewerWebControlHandler" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add name="Telerik_Web_UI_DialogHandler_aspx" preCondition="integrated" verb="*" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />
<add name="Telerik_Web_UI_SpellCheckHandler_axd" preCondition="integrated" verb="*" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" />
<add name="ChartImage_axd" verb="*" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" />
<add name="Telerik_Web_UI_WebResource_axd" preCondition="integrated" verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode" /></handlers>
<modules>
<add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" preCondition="managedHandler" />
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
<!--<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="managedHandler" />-->
<!--<add name="ScriptModule-4.0" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />-->
</modules>
</system.webServer>
</configuration>

We are using telerik old version which was using dll of rad controls.Now we are upgrading these controls to latest version of telerik and getting more code issue which was not working .
My following code is not working , So please let us know How we can fixed this issue.
Telerik.Web.UI.RadTreeView was unable to find an embedded skin with the name '~/RadControls/TreeView/Skins/Arrows/3DBlue'. Please, make sure that the skin name is spelled correctly and that you have added a reference to the Telerik.Web.UI.Skins.dll assembly in your project. If you want to use a custom skin, set EnableEmbeddedSkins=false.
<telerik:RadTreeView ID="rtvTopLeftPatientMenu" Skin="Arrows/3DBlue"
runat="server" OnNodeClick="rtvTopLeftPatientMenu_NodeClick"
BeforeClientToggle = "BeforeToggleHandler" BeforeClientClick = "BeforeClientClick" >
</telerik:RadTreeView>
We are using telerik old version which was using dll of rad controls.Now we are upgrading these controls to latest version of telerik and getting more code issue which was not working .
My following code is not working , So please let us know How we can fixed this issue.
'Telerik.Web.UI.RadEditor' does not contain a definition for 'ConvertToLower' and 'FileEncoding' .
Telerik.Web.UI.RadEditor rd = new Telerik.Web.UI.RadEditor();
rd.ConvertToLower = true; ----------error
rd.FileEncoding = 65001; //UTF8 --------error
rd.Html = sMessage;
sMessage = rd.Text;
I have added telerik:RadDatePicker in a gridView. Its fetching results and calender as expected. But when i am exporting to excel. I am getting error.
Server Error in '/' Application.
Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.
Source Error:
Line 121:
Line 122: // render the table into the htmlwriter Line 123: table.RenderControl(htw); Line 124:
Line 125: // render the htmlwriter into the response
Source File: \App_Code\GridViewExportUtil.cs Line: 123
Stack Trace:
[InvalidOperationException: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.]
Telerik.Web.UI.ScriptRegistrar.GetScriptManager(Control control) +161
Telerik.Web.UI.RadWebControl.RegisterScriptDescriptors() +39