Hi everyone,
I have implemented the RadProgressArea in my ASP.NET WebForms Sharepoint web application in which i am parsing an excel file and ingesting each excel row into my system and try to use the RadProgressArea to track the progress of the import process. for that I'am using a RadAsyncUpload to upload the excel file and an 'Import' Botton to process the selected file and ingest it into the system.
The problem I am facing here, is that each time after restarting the web server IIS and click the import botton the RadProgressArea is not displayed and the page is on loading mode until the file import processing is finished. Then the RadProgressArea start to be shown without any problem for further import click.
I need to know why the RadProgressArea is not displayed for the first time when my IIS is restared and start to work fine later on and what could be the possible solution for my probelm.
Here the configuration I m using in my both Dev and Integration environments :
In side </
system.webServer
>
<
p
><
handlers
> </
p
><
p
><
add
name
=
"Telerik.Web.UI.WebResource"
path
=
"Telerik.Web.UI.WebResource.axd"
verb
=
"*"
type
=
"Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2016.3.1027.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
/><
br
> <
add
name
=
"Telerik_Web_UI_DialogHandler_aspx"
path
=
"Telerik.Web.UI.DialogHandler.axd"
verb
=
"*"
type
=
"Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Version=2016.3.1027.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
/><
br
> <
add
name
=
"Telerik_Web_UI_SpellCheckHandler_axd"
path
=
"Telerik.Web.UI.SpellCheckHandler.axd"
type
=
"Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2016.3.1027.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
verb
=
"*"
preCondition
=
"integratedMode"
/><
br
> <
add
name
=
"Telerik_RadUploadProgressHandler_ashx"
path
=
"Telerik.RadUploadProgressHandler.ashx"
type
=
"Telerik.Web.UI.RadUploadProgressHandler, Telerik.Web.UI, Version=2016.3.1027.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
verb
=
"*"
preCondition
=
"integratedMode"
/><
br
> <
add
name
=
"ChartImage_axd"
path
=
"ChartImage.axd"
type
=
"Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Version=2016.3.1027.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
verb
=
"*"
preCondition
=
"integratedMode"
/><
br
> </
handlers
></
p
>
And add location to my web config like that :
<
location
path
=
"Telerik.RadUploadProgressHandler.ashx"
><
br
> <
system.web
><
br
> <
authorization
><
br
> <
allow
users
=
"*"
/><
br
> </
authorization
><
br
> </
system.web
><
br
> </
location
><
br
> <
location
path
=
"WebResource.axd"
><
br
> <
system.web
><
br
> <
authorization
><
br
> <
allow
users
=
"*"
/><
br
> </
authorization
><
br
> </
system.web
><
br
> </
location
>
In my aspx page i am using the RadProgressArea as :
<
p
><
span
id
=
"pnlActions"
runat
=
"server"
><
br
><
telerik:RadButton
ID
=
"btnImport"
Text
=
"Import"
OnClick
=
"btnImport_Click"
OnClientClicked
=
"function(button, args){hideRadBtn();return true;}"
<br> runat="server" Skin="Web20" RenderMode="Lightweight"><
br
><
Icon
PrimaryIconCssClass
=
"rbDownload2"
PrimaryIconLeft
=
"4"
PrimaryIconTop
=
"2"
></
Icon
><
br
> </
telerik:RadButton
><
br
><
br
><
telerik:RadButton
ID
=
"btnNew"
Text
=
"New import"
OnClick
=
"btnNew_Click"
Visible
=
"false"
<br> runat="server" Skin="Web20" RenderMode="Lightweight"><
br
><
Icon
PrimaryIconCssClass
=
"rbAdd2"
PrimaryIconLeft
=
"4"
PrimaryIconTop
=
"2"
></
Icon
><
br
></
telerik:RadButton
><
br
><
br
><
telerik:RadProgressManager
ID
=
"RadProgressManager1"
runat
=
"server"
/><
br
><
telerik:radprogressarea
id
=
"RadProgressArea1"
runat
=
"server"
style
=
"text-align: center"
DisplayCancelButton
=
"False"
<br>progressindicators="FilesCountBar,<
br
>FilesCount,<
br
>FilesCountPercent,<
br
>SelectedFilesCount,<
br
>CurrentFileName,<
br
>TimeElapsed,<
br
>TimeEstimated"><
br
></
telerik:radprogressarea
><
br
></
span
></
p
><
p
></
p
>
Thanks a lot for your support
Youness
<tlk:RadAutoCompleteBox runat="server" ID="cmb_numDep" EmptyMessage="Taper ..."
InputType="Text"Width="298px"TextSettings-SelectionMode="Single" AutoPostBack="True"
EnableClientFiltering="true"DropDownHeight="150"></tlk:RadAutoCompleteBox>
The AutoPostBack does’t work !! I want to keep clientFiltring enabled and launch postback when selecting value !
Is their a way to do it without using JavaScript ?
It is possible to set the height and width of the QR Code in pixels?. Already set de DotSize in 0, but the result image always has 53x53px.
<
telerik:GridTemplateColumn
HeaderText
=
"Don't Export"
HeaderStyle-Width
=
"40px"
DataField
=
"exportCheck"
SortExpression
=
"exportCheck"
UniqueName
=
"exportCheck"
>
<
ItemStyle
Width
=
"40px"
/>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"printCheck"
runat
=
"server"
AutoPostBack
=
"false"
OnCheckedChanged
=
"printCheckChanged"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Protected
Sub
RadGrid1_ItemDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
RadGrid1.ItemDataBound
If
TypeOf
e.Item
Is
GridDataItem
Then
'get the row item
Dim
item
As
GridDataItem =
DirectCast
(e.Item, GridDataItem)
'check to see if we need to check the box
Dim
export =
DirectCast
(item(
"export"
).Text,
String
)
'get the checkbox
Dim
check
As
CheckBox =
DirectCast
(item(
"exportCheck"
).Controls(1), CheckBox)
'if we need to check the box then we will get it and check it
If
(export =
"no"
)
Then
check.Checked =
True
End
If
'if export
End
If
'if e.item
End
Sub
'itemDataBound
I'm having difficulty getting the exception from the OnDataBindingFailed event
the event fires as expected, but the eventArgs object doesn't have the methods
get_exception() - returns the deserialized response text.
get_responseText() - returns the response text from the service.
as described in this doc link
https://docs.telerik.com/devtools/aspnet-ajax/controls/listview/data-binding/client-side/api
The error that is showing on the console is
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource ... blah blah blah
what am in missing?
this my aspx page
<%@ Page Title="" Language="C#" MasterPageFile="~/Modules/Module.Master" AutoEventWireup="true" CodeBehind="DataExporter.aspx.cs" Inherits="HelmOnline.Web.Modules.DataExporter.DataExporter" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ModuleHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ModuleContent" runat="server">
<div style="margin: 10px; height: 100%;">
<style type="text/css">
.rightAlign {
float: right;
}
.pad1 {
padding-right: 20px
}
</style>
<telerik:RadScriptBlock runat="server">
<script type="text/javascript">
function OpenHistoryTransaction(sender, transactionid, customerid, customersetupid, employeeid) {
var dialogWindow = $find("<%=RadWindow1.ClientID%>");
if (transactionid == 0)
{ dialogWindow.set_title("Add Transaction"); }
else
{ dialogWindow.set_title("Modify Transaction"); }
var baseUrl = "Dialog/AddEditHistoryTransaction.aspx";
baseUrl = baseUrl + "?";
baseUrl = baseUrl + "transactionid=" + transactionid;
baseUrl = baseUrl + "&";
baseUrl = baseUrl + "customerid=" + customerid;
baseUrl = baseUrl + "&";
baseUrl = baseUrl + "customersetupid=" + customersetupid;
baseUrl = baseUrl + "&";
baseUrl = baseUrl + "employeeid=" + employeeid;
dialogWindow.set_navigateUrl(baseUrl)
dialogWindow.set_modal(true);
dialogWindow.show();
}
function OnClientCloseHandler(sender, args) {
var btnRefreshGrids = $find("<%=btnRefreshGrids.ClientID%>");
btnRefreshGrids.click();
}
</script>
</telerik:RadScriptBlock>
<telerik:RadWindowManager RenderMode="Lightweight" ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false" ReloadOnShow="true" runat="server" EnableShadow="true">
<Windows>
<telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" runat="server" Height="325" Width="525" NavigateUrl="~/Modules/PaidTimeOff/Dialog/AddEditHistoryTransaction.aspx" OnClientClose="OnClientCloseHandler" Behaviors="Close" />
</Windows>
</telerik:RadWindowManager>
<telerik:RadAjaxManager ID="RadRadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="100%" />
<telerik:AjaxUpdatedControl ControlID="RadGrid2" UpdatePanelHeight="100%" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnRefreshGrids">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="btnRefreshGrids" />
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="100%" />
<telerik:AjaxUpdatedControl ControlID="RadGrid2" UpdatePanelHeight="100%" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
<ClientEvents />
</telerik:RadAjaxManager>
<telerik:RadAjaxPanel runat="server" ID="pDataExporter" PostBackControls="btnExportGrid" Height="100%">
<div style="margin: 0px; height: 5%;">
<telerik:RadButton ID="btnRefreshGrids" Text="Refresh" OnClick="btnRefreshGrids_Click" runat="server" Style="display: none;" />
<telerik:RadButton runat="server" ID="btnExport" Text="Export Data" Visible="true" OnClick="btnExport_Click"/>
</div>
<div style="margin: 0px; height: 95%;" id="gridContainer">
<div style="margin: 0px; height: 50%;">
<asp:ImageButton ID="btnExportGrid" runat="server" ImageUrl="/Images/Excel_XLSX.png" Height="24" Width="24" OnClick="btnExportGrid_Click" AlternateText="ExportToExcel" />
<telerik:RadGrid runat="server" ID="RadGrid1" Width="100%" Height="90%" AutoGenerateColumns="false" AllowPaging="False" AllowSorting="true" ShowGroupPanel="false" PageSize="10" RenderMode="Classic" AllowFilteringByColumn="true" GroupingSettings-CaseSensitive="false" OnNeedDataSource="RadGrid1_NeedDataSource" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged">
<MasterTableView TableLayout="Fixed">
<Columns>
<telerik:GridBoundColumn SortExpression="ExporterID" HeaderText="ExporterID" HeaderStyle-Width="0" HeaderButtonType="TextButton" DataField="ExporterID" DataFormatString="{0:d}" AllowFiltering="true" />
<telerik:GridBoundColumn SortExpression="StoredProcName" HeaderText="StoredProcName" HeaderStyle-Width="300" HeaderButtonType="TextButton" DataField="StoredProcName" DataFormatString="{0:d}" AllowFiltering="true" />
<telerik:GridBoundColumn SortExpression="Description" HeaderText="Description" HeaderButtonType="TextButton" DataField="Description" DataFormatString="{0:d}" AllowFiltering="true" />
</Columns>
</MasterTableView>
<ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True" EnablePostBackOnRowClick="true" Selecting-AllowRowSelect="true">
<Selecting AllowRowSelect="True"></Selecting>
<Resizing AllowRowResize="False" AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="False"></Resizing>
<Scrolling UseStaticHeaders="true" AllowScroll="true" />
</ClientSettings>
</telerik:RadGrid>
</div>
<div style="margin: 0px; height: 50%;">
<telerik:RadGrid Width="100%" Height="80%" ID="RadGrid2" OnNeedDataSource="RadGrid2_NeedDataSource" OnItemDataBound="RadGrid2_ItemDataBound" runat="server" AutoGenerateColumns="false" AllowPaging="False" AllowSorting="false" ShowGroupPanel="false" PageSize="10" RenderMode="Classic" AllowFilteringByColumn="false" GroupingSettings-CaseSensitive="false">
<MasterTableView TableLayout="Fixed">
<Columns>
<telerik:GridBoundColumn UniqueName="NameColumn" HeaderStyle-Width="150" SortExpression="ColumnName" HeaderText="Paramter" HeaderButtonType="TextButton" DataField="ColumnName" />
<telerik:GridBoundColumn UniqueName="TypeColumn" HeaderStyle-Width="0" SortExpression="ColumnType" HeaderText="ColumnType" HeaderButtonType="TextButton" DataField="ColumnType" />
<telerik:GridBoundColumn UniqueName="OrderColumn" HeaderStyle-Width="0" SortExpression="ColumnOrder" HeaderText="ColumnOrder" HeaderButtonType="TextButton" DataField="ColumnOrder" />
<telerik:GridTemplateColumn UniqueName="ValueColumn" HeaderText="Value"/>
</Columns>
</MasterTableView>
<ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True" EnablePostBackOnRowClick="false">
<Selecting AllowRowSelect="false"></Selecting>
<Resizing AllowRowResize="false" AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="False"></Resizing>
<Scrolling UseStaticHeaders="true" AllowScroll="true" />
</ClientSettings>
</telerik:RadGrid>
</div>
</div>
</telerik:RadAjaxPanel>
</div>
</asp:Content>
This is the codebehind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using xi = Telerik.Web.UI.ExportInfrastructure;
using Telerik.Web.UI.GridExcelBuilder;
using HelmOnline.Web.Common.Context;
namespace HelmOnline.Web.Modules.DataExporter
{
public partial class DataExporter : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.RadGrid1.Rebind();
}
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
using (var client = new svcHelm.HelmClient())
{
var grid = sender as RadGrid;
grid.DataSource = client.DataExporterReportsByUserID(SecurityContext.UserId);
}
}
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
{
GridDataItem selectedItem = (GridDataItem)RadGrid1.SelectedItems[0];
Session["RowIndex"] = selectedItem.ItemIndex;// Gets the index of currently selected row
this.RadGrid2.Rebind();
RadGrid2.Visible = true;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RadGrid2_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
int ExporterID = 0;
string StoredProcName = "";
if (this.RadGrid1.SelectedItems != null)
{
if (this.RadGrid1.SelectedItems.Count > 0)
{
var selectGridItem = (Telerik.Web.UI.GridDataItem)this.RadGrid1.SelectedItems[0];
ExporterID = int.Parse(selectGridItem["ExporterID"].Text);
StoredProcName = selectGridItem["StoredProcName"].Text;
using (var client = new svcHelm.HelmClient())
{
var grid = sender as RadGrid;
grid.DataSource = client.DataExporterObjectColumns(StoredProcName, SecurityContext.UserName);
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnRefreshGrids_Click(object sender, EventArgs e)
{
string selectedEmployeeId = string.Empty;
for (int i = 0; i < RadGrid1.Items.Count; i++)
{
if (RadGrid1.Items[i].Selected)
{
selectedEmployeeId = RadGrid1.Items[i]["EmployeeID"].Text;
}
}
this.RadGrid1.Rebind();
if (selectedEmployeeId.Length > 0)
{
for (int i = 0; i < RadGrid1.Items.Count; i++)
{
if (selectedEmployeeId == RadGrid1.Items[i]["EmployeeID"].Text)
{
RadGrid1.Items[i].Selected = true;
}
}
}
this.RadGrid2.Rebind();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnExportGrid_Click(object sender, ImageClickEventArgs e)
{
RadGrid1.ExportSettings.Excel.Format = (GridExcelExportFormat)Enum.Parse(typeof(GridExcelExportFormat), "Xlsx");
RadGrid1.ExportSettings.IgnorePaging = true;
RadGrid1.ExportSettings.ExportOnlyData = true;
RadGrid1.ExportSettings.OpenInNewWindow = true;
RadGrid1.MasterTableView.ExportToExcel();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
{
if(e.Item is GridDataItem){
var gdi = (GridDataItem)e.Item;
if (gdi != null){
var data = (HelmOnline.Web.svcHelm.DataExporterObjectColumn)gdi.DataItem;
if(data != null){
Control control = null;
switch (data.ColumnType.ToLower()){
case "int":
control = new RadNumericTextBox();
((RadNumericTextBox)control).NumberFormat.DecimalDigits = 0;
((RadNumericTextBox)control).ShowSpinButtons = true;
control.ID = "intControl";
control.DataBind();
break;
case "decimal":
control = new RadNumericTextBox();
control.ID = "decimalControl";
control.DataBind();
break;
case "money":
control = new RadNumericTextBox();
((RadNumericTextBox)control).NumberFormat.DecimalDigits = 2;
((RadNumericTextBox)control).ShowSpinButtons = true;
control.ID = "moneyControl";
control.DataBind();
break;
case "datetime":
control = new RadDatePicker();
control.ID = "datetimeControl";
control.DataBind();
break;
case "varchar":
control = new RadTextBox();
control.ID = "varcharControl";
control.DataBind();
break;
default:
control = new RadTextBox();
control.ID = "defaultControl";
control.DataBind();
break;
}
if(control != null){
gdi["ValueColumn"].Controls.Add(control);
gdi["ValueColumn"].DataBind();
}
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnExport_Click(object sender, EventArgs e)
{
var paramDictionary = new Dictionary<string, object>();
var grid = this.RadGrid2;
foreach (GridDataItem dataItem in grid.MasterTableView.Items){
Control control = null;
var pName = dataItem["NameColumn"].Text;
var pType = dataItem["TypeColumn"].Text;
var pOrder = int.Parse(dataItem["OrderColumn"].Text);
object pValue = null;
//CellValue = CType(RadGrid1.Items(i).FindControl("YourControlID"), TextBox).Text
//bool boolValue = (item["GridCheckBoxColumnUniqueName"].Controls[0] as CheckBox).Checked;
switch (pType.ToLower()){
case "int":
//var column = dataItem["ValueColumn"].TemplateControl;
//control = column.FindControl("intControl");
//pValue = int.Parse(((RadNumericTextBox)control).Value.ToString());
var column = dataItem["ValueColumn"].Text;//value inputed by user is not here
//RadNumericTextBox intcontrol = (RadNumericTextBox)dataItem["ValueColumn"].FindControl("intControl");
RadNumericTextBox intcontrol = (RadNumericTextBox)dataItem.FindControl("intControl");
pValue = int.Parse(intcontrol.Value.ToString());
break;
}
}
}
}
}
I am trying to get the values of the columns of the rad grid. I can get all the static values but not the value of the template column where the user would input values.
I have a Telerik Grid in which I have declared Radbutton which is populated in itemdatabound event. I have disabled it with condition from database.
But When ever the page index is Changed at the same item index the button is disabled.
Please kindly suggest a better way to do so.
Here is the code inside the ItemDataBound event
if (e.Item is GridDataItem)
{
GridDataItem dataItem = e.Item as GridDataItem;
if ((rddlLogLevel.SelectedValue).Contains("ERROR") == true)
{
DataSet ds = (DataSet)Session["LogErrors"];
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[e.Item.ItemIndex]["PSRNumber"].ToString() == "" && ds.Tables[0].Rows[e.Item.ItemIndex]["LeretaPSRLogID"].ToString() == "")
{ (dataItem["Action"].FindControl("rbtnCreatePSR") as RadButton).Enabled = true; }
else if (ds.Tables[0].Rows[e.Item.ItemIndex]["PSRNumber"].ToString() == "" && ds.Tables[0].Rows[e.Item.ItemIndex]["LeretaPSRLogID"].ToString() != "")
{ (dataItem["Action"].FindControl("rbtnCreatePSR") as RadButton).Enabled = false; }
else { (dataItem["Action"].FindControl("hylnk_PSR") as HyperLink).Visible = true; }
}
}
else { (dataItem["Action"].FindControl("rbtnCreatePSR") as RadButton).Enabled = false; }