How can I use RadUpload or RadAsyncUpload control in RadGrid batch edit mode?
I tried following code but RadAsyncUpload shows 0 files in UploadedFile enumerator.
01.
protected
void
RadGrid1_BatchEditCommand(
object
sender, GridBatchEditingEventArgs e)
02.
{
03.
foreach
(GridBatchEditingCommand command
in
e.Commands)
04.
{
05.
if
((command.Type == GridBatchEditingCommandType.Update))
06.
{
07.
Hashtable newValues = command.NewValues;
08.
09.
if
(newValues !=
null
)
10.
{
11.
var CTRL = RadGrid1.FindControl(RadGrid1.MasterTableView.ClientID +
"_AttachmentColumn"
);
12.
RadAsyncUpload asyncUpload = RadGrid1.FindControl(RadGrid1.MasterTableView.ClientID +
"_AttachmentColumn"
).Controls[0]
as
RadAsyncUpload;
13.
14.
}
15.
}
16.
}
17.
}
<
telerik:GridAttachmentColumn
UploadControlType
=
"RadUpload"
EditFormHeaderTextFormat
=
"Upload File:"
HeaderText
=
"Attachment Column"
UniqueName
=
"AttachmentColumn"
>
</
telerik:GridAttachmentColumn
>
I have several ClientDataSources on a page. How do i cancel a long running one if I want to.
Marty
Hi:
I have placed RadDockZone and RadDoc inside of FormView EditItemTemplate. The FormView's ItemUpdating event cannot seem to find the Bind values in the form. If I remove the RadDockZone and RadDoc, it works as expected.
Phil
Hello, I have an old project I am upgrading to the most recent Telerik Release and I'm running into issues while redirecting from a login page.
The code is pretty straight forwards,. the Default.aspx page looks something like this:
protected void Page_Load(object sender, EventArgs e)
{
if (Context.Session != null)
{
if (Session.IsNewSession)
{
string szCookieHeader = Request.Headers["Cookie"];
if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
{
Response.Redirect("/Login.aspx");
}
}
}
if (!Convert.ToBoolean(Session["UserIsAdmin"]))
{
//Acquire appropriate redirect path from database
Response.Redirect(redirectPath);
}
else
{
Response.Redirect("/Modules/Admin/UserSetup.aspx");
}
}
and the login page has a username and password field with a log in button that looks like so:
protected void bLogin_Click(object sender, EventArgs e)
{
try
{
if (allowLogin)
{
UserClass userAuthenticationClass = new UserClass(eUsername.Text, ePassword.Text);
if (userAuthenticationClass.IsValidUser)
{
string s = FormsAuthentication.DefaultUrl;
Session["User"] = userAuthenticationClass;
Session["UserID"] = userAuthenticationClass.UserID;
Session["Username"] = userAuthenticationClass.Username;
Session["UserMasterID"] = userAuthenticationClass.UserMasterID;
Session["UserIsAdmin"] = (eUsername.Text.ToUpper() == "ADMINISTRATOR") ? "True" : "False"
Session["UserType"] = userAuthenticationClass.UserType;
Session["EmailAddress"] = userAuthenticationClass.EmailAddress;
Session["SessionID"] = Guid.NewGuid().ToString();
Session.Timeout = 1440;
AppCode.SessionStatistics.InsertStatistic(Session["SessionID"].ToString(), Session["UserID"].ToString());
RadAjaxPanel1.Redirect("/Default.aspx");
//FormsAuthentication.RedirectFromLoginPage(eUsername.Text, false);
//Response.Redirect("/Default.aspx", false);
//Server.Transfer("/Default.aspx", false);
//Server.Execute("/Default.aspx", true);
}
else
{
LabelMessage.Text = "Could Not Authenticate User";
}
}
}
catch (Exception ex)
{
LabelMessage.Text = ex.Message;
}
}
So Here's where it gets odd. When debugging from Visual Studio, this works correctly. when running on my local web server (set up on my development machine) this also works correctly. but when deployed to a test server, the login button just does not redirect. (it clicks, authenticates the user, then returns to the login page)
I was wondering if it's possible that there is something happening that would cause the Session variables to be lost when using RadAjaxPanel.Redirect?
Keep in mind, this method works perfectly fine on the development environment. Is there anything I need to install/set up on the test environment for this to work?
i'm cascading dropdownbox (radcombobox) with clientdatasource but i'm a having challenges when changing the main combobox in hopes of having oncustomparameter to fire again.
ComboBox
<
telerik:RadComboBox
runat
=
"server"
EmptyMessage
=
"Function"
ID
=
"RcbFun"
Width
=
"80px"
OnClientLoad
=
"Rcb_OnClientLoad"
DataTextField
=
"Code"
DataValueField
=
"Functions"
AppendDataBoundItems
=
"True"
ClientDataSourceID
=
"CdsFunc"
ItemsPerRequest
=
"15"
Filter
=
"Contains"
EnableLoadOnDemand
=
"true"
ShowMoreResultsBox
=
"true"
EnableVirtualScrolling
=
"true"
OnClientSelectedIndexChanged
=
"Rcb_OnClientSelectedIndexChanged"
></
telerik:RadComboBox
>
<
telerik:RadComboBox
runat
=
"server"
EmptyMessage
=
"Sub-Function"
ID
=
"RcbSubF"
Width
=
"80px"
OnClientLoad
=
"Rcb_OnClientLoad"
DataTextField
=
"Code"
DataValueField
=
"SubFunction"
AppendDataBoundItems
=
"True"
ClientDataSourceID
=
"CdsSubF"
ItemsPerRequest
=
"15"
Filter
=
"Contains"
HighlightTemplatedItems
=
"true"
OnClientSelectedIndexChanged
=
"Rcb_OnClientSelectedIndexChanged"
EnableLoadOnDemand
=
"true"
></
telerik:RadComboBox
>
RadClientDataSource
<
telerik:RadClientDataSource
ID
=
"CdsFunc"
runat
=
"server"
>
<
DataSource
>
<
WebServiceDataSourceSettings
BaseUrl
=
"LibraryService.svc/"
>
<
Select
Url
=
"GetFunctions"
DataType
=
"JSON"
RequestType
=
"Get"
ContentType
=
"application/json; charset=utf-8"
/>
</
WebServiceDataSourceSettings
>
</
DataSource
>
<
Schema
DataName
=
"d"
>
</
Schema
>
</
telerik:RadClientDataSource
>
<
telerik:RadClientDataSource
ID
=
"CdsSubF"
runat
=
"server"
>
<
ClientEvents
OnCustomParameter
=
"ParamMap"
/>
<
DataSource
>
<
WebServiceDataSourceSettings
BaseUrl
=
"LibraryService.svc/"
>
<
Select
Url
=
"RcbGetSubFunctions"
DataType
=
"JSON"
RequestType
=
"Get"
ContentType
=
"application/json; charset=utf-8"
/>
</
WebServiceDataSourceSettings
>
</
DataSource
>
<
Schema
DataName
=
"d"
></
Schema
>
</
telerik:RadClientDataSource
>
OnCustomParameter Method
1.
function
ParamMap(sender, args) {
2.
if
(RcbFun.get_value() !=
""
) {
3.
if
(args.get_type() ==
"read"
&& args.get_data()) {
4.
args.set_parameterFormat({ paramFunction: RcbFun.get_value() });
5.
}
6.
}
7.
}
Loading items into RcbSubF after selecting the a value RcbFun for the first time is not a problem. The issues lies in selecting another value in RcbFun. The OnCustomParameter event "ParamMap" will not fire again. Any suggestion?
Please be advised that these controls are in side a RadPanelBar.
I am currently hiding several gridbound columns on load by setting Display="False".
User can display/hide columns using the column header context menu.
All works fine accept that when a user maximizes the browser window all the hidden columns are displayed.
It doesn't happen every time, though most times.
Tested with same issue on Edge and Firefox.
Any help would be greatly appreciated.
I have a telerik RadGrid. I have applied Manual CRUD operations in it. I am using In-Place editing mode. The problem is, when I am trying to Insert or Update the records, i am getting null values by this method
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
Same thing happening in both RadGrid_UpdateCommand and ​RadGrid_​InsertCommand.
Following is my ASPX code
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"RadScriptManager1"
/>
<
telerik:RadSkinManager
ID
=
"RadSkinManager1"
runat
=
"server"
ShowChooser
=
"true"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rGrid"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rGrid"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
runat
=
"server"
ID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:RadFormDecorator
ID
=
"RadFormDecorator1"
runat
=
"server"
DecorationZoneID
=
"demo"
EnableRoundedCorners
=
"false"
DecoratedControls
=
"All"
/>
<
telerik:RadGrid
ID
=
"rGrid"
runat
=
"server"
AllowPaging
=
"True"
PageSize
=
"10"
AllowSorting
=
"True"
AutoGenerateColumns
=
"false"
AllowFilteringByColumn
=
"True"
CellSpacing
=
"0"
GridLines
=
"None"
OnNeedDataSource
=
"rGrid_NeedDataSource"
OnItemCreated
=
"rGrid_ItemCreated"
OnPreRender
=
"rGrid_PreRender"
OnInsertCommand
=
"rGrid_InsertCommand"
OnUpdateCommand
=
"rGrid_UpdateCommand"
ondeletecommand
=
"rGrid_DeleteCommand"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
GroupingSettings
CaseSensitive
=
"false"
/>
<
MasterTableView
DataKeyNames
=
"ID"
EditMode
=
"InPlace"
CommandItemDisplay
=
"Top"
InsertItemPageIndexAction
=
"ShowItemOnCurrentPage"
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
HeaderText
=
"Edit"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
DataField
=
"ID"
UniqueName
=
"ID"
HeaderText
=
"ID"
ColumnEditorID
=
"GridTextBoxEditor1"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Name"
UniqueName
=
"Name"
HeaderText
=
"Name"
ColumnEditorID
=
"GridTextBoxEditor1"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ContactPerson"
UniqueName
=
"ContactPerson"
HeaderText
=
"Contact Person"
ColumnEditorID
=
"GridTextBoxEditor2"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Address"
UniqueName
=
"Address"
HeaderText
=
"Address"
ColumnEditorID
=
"GridTextBoxEditor3"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Country"
UniqueName
=
"Country"
HeaderText
=
"Country"
ColumnEditorID
=
"GridTextBoxEditor4"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"City"
UniqueName
=
"City"
HeaderText
=
"City"
ColumnEditorID
=
"GridTextBoxEditor5"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Phone"
UniqueName
=
"Phone"
HeaderText
=
"Phone"
ColumnEditorID
=
"GridTextBoxEditor6"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Email"
UniqueName
=
"Email"
HeaderText
=
"Email"
ColumnEditorID
=
"GridTextBoxEditor7"
>
</
telerik:GridBoundColumn
>
<
telerik:GridClientDeleteColumn
HeaderText
=
"Delete"
ButtonType
=
"ImageButton"
>
<%--<
telerik:GridButtonColumn
ConfirmText
=
"Delete this product?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
/>--%>
<
HeaderStyle
Width
=
"70px"
/>
</
telerik:GridClientDeleteColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
ButtonType
=
"ImageButton"
/>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnUserAction
=
"UserAction"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
Following is Code behind
public
partial
class
Suppliers : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
}
}
protected
void
rGrid_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
Code.BLL.Suppliers objSuppliers =
new
Code.BLL.Suppliers();
List<Code.BLL.Suppliers> lstSupplier = objSuppliers.Load();
rGrid.DataSource = lstSupplier;
}
protected
void
rGrid_ItemCreated(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
}​
protected
void
rGrid_PreRender(
object
sender, EventArgs e)
{
}
protected
void
rGrid_InsertCommand(
object
sender, GridCommandEventArgs e)
{
GridEditableItem editedItem = e.Item
as
GridEditableItem;
Hashtable newValues =
new
Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
//editedItem.ExtractValues(newValues); I have tried both methods, but got null values from both
}
protected
void
rGrid_UpdateCommand(
object
sender, GridCommandEventArgs e)
{
GridEditableItem editedItem = e.Item
as
GridEditableItem;
//Prepare new dictionary object
Hashtable newValues =
new
Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
editedItem.ExtractValues(newValues);I have tried both methods, but got
null
values from both
}
protected
void
rGrid_DeleteCommand(
object
sender, GridCommandEventArgs e)
{
}
}
Hi,
I have a rad button in a rad window, with both client click and on server event. the page in which the rad window is there has a radajaxmanager and a rad grid. The server event handles the export of radgrid data to an excel, this is an ajax request. I do not want to use the gridexporting. The following code exports the file:
using (ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook())
{
var worksheet = wb.Worksheets.Add(datatable, fileName);
worksheet.Tables.First().ShowAutoFilter = false;
worksheet.Tables.First().Theme = ClosedXML.Excel.XLTableTheme.None;
httpContext.Response.Clear();
httpContext.Response.Buffer = true;
httpContext.Response.Charset = Encoding.UTF8.WebName;
httpContext.Response.AddHeader("content-disposition", string.Format("{0}{1}", "attachment;filename=", fileName));
httpContext.Response.ContentType = contentType;
using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
{
workbook.SaveAs(memoryStream);
memoryStream.WriteTo(httpContext.Response.OutputStream);
httpContext.Response.Flush();
httpContext.Response.End();
}
}
After exporting the file, the ClientEvents-OnResponseEnd of radajaxmanager is not firing in Safari browser on MAC, I want this event to be fired to hide an image. It is firing in IE and Chrome on both MAC and windows but not in Safari. Please suggest.
Thanks in advance.
Saravana
I have an asp.net application hosted on IIS and while the site works perfectly on my local dev machine once I upload it to a web server running IIS, all the controls look wrong.
The runtime DLLs have been installed on the server also.
Not exactly sure why this is happening but I suspect it is some config issue.
See below for how it behaves.
Any idea on a fix?