<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadAjaxProblem.aspx.cs" |
Inherits="Ajax.RadAjaxProblem" %> |
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title>Test Ajax</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="scriptManagerProxy1" runat="server"> |
</asp:ScriptManager> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="radNumber1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="lblTotal" UpdatePanelRenderMode="Inline" /> |
<telerik:AjaxUpdatedControl ControlID="btnOk" UpdatePanelRenderMode="Inline" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="radNumber2"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="lblTotal" UpdatePanelRenderMode="Inline" /> |
<telerik:AjaxUpdatedControl ControlID="btnOk" UpdatePanelRenderMode="Inline" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="btnOk"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="lblMessage" UpdatePanelRenderMode="Inline" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<div style="margin:50px" > |
<telerik:RadNumericTextBox ID="radNumber1" runat="server" Type="Number" MinValue="1" |
AutoPostBack="true" NumberFormat-DecimalDigits="0" Width="75px" ShowSpinButtons="true" |
Value="1" OnTextChanged="OnNumber1Changed" /> |
plus |
<telerik:RadNumericTextBox ID="radNumber2" runat="server" Type="Number" MinValue="1" |
AutoPostBack="true" NumberFormat-DecimalDigits="0" Width="75px" ShowSpinButtons="true" |
Value="1" OnTextChanged="OnNumber2Changed" /> |
equals |
<asp:Label runat="server" ID="lblTotal"></asp:Label>. |
<p> |
Message: |
<asp:Label ID="lblMessage" runat="server" Text="..."></asp:Label> |
</p> |
<p> |
<asp:Button runat="server" ID="btnOk" OnClick="btnOk_Click" Text="OK" /> |
</p> |
</div> |
</form> |
</body> |
</html> |
using System; |
using Telerik.Web.UI; |
namespace Ajax |
{ |
public partial class RadAjaxProblem : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
private void UpdateTotal() |
{ |
int arg1 = (int) (radNumber1.Value.HasValue ? radNumber1.Value.Value : 0); |
int arg2 = (int) (radNumber2.Value.HasValue ? radNumber2.Value.Value : 0); |
lblTotal.Text = String.Format("{0}", arg1 + arg2); |
} |
protected void OnNumber1Changed(object sender, EventArgs e) |
{ |
UpdateTotal(); |
} |
protected void OnNumber2Changed(object sender, EventArgs e) |
{ |
UpdateTotal(); |
} |
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) |
{ |
} |
protected void btnOk_Click(object sender, EventArgs e) |
{ |
lblMessage.Text = String.Format("OK clicked at " + DateTime.Now.ToLongTimeString()); |
} |
} |
} |
Hello
On a page I have RadNavigation menu with submenu and a AutoCompleteBox with OnEntryAdded event. If I put the AutoCompleteBox inside the UpdatePanel, after OnEntryAdded is fired, RadNavigation menu does not work anymore - it's blocked, I can't access submenu nodes. There is no javascript errors on the page, so I don't know how to fix this. Can you help me please.
I'm attaching the sample code which you can use to see the issue.
<%@ Page Title="" Language="VB" AutoEventWireup="false" CodeFile="test1.aspx.vb" Inherits="test1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<form id="form1" enctype="multipart/form-data" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" EnableScriptGlobalization="true" Runat="server">
</telerik:RadScriptManager>
<telerik:RadNavigation ID="radNav" Skin="MetroTouch" Font-Size="Medium" runat="server" RenderMode="Auto">
<Nodes>
<telerik:NavigationNode Text="Test">
<Nodes>
<telerik:NavigationNode NavigateUrl="test1.aspx" Text="Test 1"></telerik:NavigationNode>
<telerik:NavigationNode NavigateUrl="test1.aspx" Text="Test 2"></telerik:NavigationNode>
</Nodes>
</telerik:NavigationNode>
</Nodes>
</telerik:RadNavigation>
<asp:UpdatePanel runat="server" ID="up1">
<ContentTemplate>
<telerik:RadAutoCompleteBox OnEntryAdded="drpLista_EntryAdded" ID="RadAutoCompleteBox1" Width="180px" runat="server" Skin="Bootstrap">
</telerik:RadAutoCompleteBox>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
Imports System.Data
Imports System.Data.SqlClient
Imports Telerik.Web.UI
Partial Class test1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
BindToArrayList(RadAutoCompleteBox1)
End Sub 'Page_Load
Private Sub BindToArrayList(ByVal autoCompleteBox As RadAutoCompleteBox)
Dim itemsList As New ArrayList()
itemsList.Add("One")
itemsList.Add("Two")
itemsList.Add("Three")
autoCompleteBox.DataSource = itemsList
End Sub 'BindToArrayList
Protected Sub drpLista_EntryAdded(sender As Object, e As AutoCompleteEntryEventArgs)
End Sub
End Class
On Firefox the Radeditor imagemanager window is:
1. Always sticking on top of browserwindow
2. not high enough for content, see screenshot.
Marc01.
protected
void
RDDL_Statut_Load(
object
sender, EventArgs e)
02.
{
03.
DC_FiltragesDataContext Mydb =
new
DC_FiltragesDataContext();
04.
var results = (from U
in
Mydb.PLOP
05.
select
new
{ statut = U.STATUT}).Distinct();
06.
07.
RDDL_Statut.DataSource = results;
08.
RDDL_Statut.DataTextField =
"statut"
;
09.
RDDL_Statut.DataValueField =
"statut"
;
10.
11.
RDDL_Statut.DataBind();
12.
RDDL_Statut.Items.Insert(0,
new
DropDownListItem(
"--ALL STATUT--", "
ALL"));
13.
14.
}
Hi, I have an issue with my drop down list.
Lets say that i have a DropDownList Displaying : A, B ,C , D etc. And I need a default item.
Using this code , my data is not correctly bound.
The display of the DrowDownList Is the one i expected . But my "RDDL_Statut.SelectedItem.Value.ToString()" Is returning the Next Index.
When A is clicked I get B value.
i have used demo code from the http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/client-item-template/defaultvb.aspx?show-source=true
and i got error message :
Parser Error Description: An error occurred during the parsing of
a resource required to service this request. Please review the
following specific parse error details and modify your source file
appropriately.
Parser Error Message: Type 'Telerik.Web.UI.GridTemplateColumn' does not have a public property named 'clientitemtemplate'.
Source Error:
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="TitleClientTemplateColumn" HeaderText="Title"> Line 30:
<clientitemtemplate>
<span style="#=formatTitle(ContactTitle)#">#=ContactTitle #</span>
</clientitemtemplate>
I seem to have problems using a RadProgressArea together with a webservice method called from client side.
If I on the other hand use a code behind function as the way of updating the progress, the updating of the progress works.
Why?
I will start with describing the working approach with code behind and then the client side calling a webservice approach.
Working setup
In the webpage, I have a telerik:RadProgressArea and a RadProgressManager:
<
telerik:RadProgressArea
ID
=
"progressArea"
ProgressIndicators="TotalProgressBar,TotalProgressPercent" Skin="Metro"
HeaderText="Please wait!" runat="server"/>
<
telerik:RadProgressManager
ID
=
"progressManager"
runat
=
"server"
/>
I also have an asp:Button like:
OnClick="Button1_Click"
In that code behind eventhandler I perform a lot of work. It has a loop where it performs some tasks. Before the loop, I have this code:
var progress = RadProgressContext.Current;
var num = 0;
var maxnum = tasks.Count();
progress.PrimaryPercent = 0;
progress.PrimaryValue = 0;
progress.PrimaryTotal = maxnum;
After every task, in other words in the end of the loop, I update PrimaryPercent and PrimaryValue like:
num++;
progress.PrimaryPercent = num * 100 / maxnum;
progress.PrimaryValue = num;
rapMain.ResponseScripts.Add("CloseWindow()");
var rawProgressData = {InProgress:true,ProgressCounters:true,PrimaryPercent:'81',PrimaryValue:'111',PrimaryTotal:'136'};
The non working setup (using a WebService)
I have an aspx file with an identical setup as in the working case.
I call the web method with javascript:
var progressBar = $find(progressAreaId);
progressBar.show();
var pm = getRadProgressManager();
pm.startProgressPolling();
$.ajax({
type: "POST",
url: "Foobar.asmx/Methodname",
data: {id:2343},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg)
{
progressBar.hide();
alert("done!");
}
});
(If I do not call pm.startProgressPolling, the ashx will not be called frequently to get the progress values).
The web method looks like this:
[WebMethod(EnableSession = true)]
public bool MethodName(int id)
{
var progress = RadProgressContext.Current;
/* some code that retrieves an array of tasks */
var maxnum = tasks.Count;
progress.PrimaryPercent = 0;
progress.PrimaryValue = 0;
progress.PrimaryTotal = maxnum;
foreach (var task in tasks)
{
/* code that performs task */
result++;
progress.PrimaryPercent = result * 100 / maxnum;
progress.PrimaryValue = result;
}
return true;
}
However, the progress will never be updated and then the web service method has run, the progressbar will dissapear as it should.
The polling will not get the expected data but say that InProgress is false.
Here is the a response to Telerik.RadUploadProgressHandler.ashx?RadUrid=a1dcfc89-bd8c-43d3-b88f-718890d7fc04&RadUploadTimeStamp=1467898578437&:
var rawProgressData = {InProgress:false,ProgressCounters:false};
Hi Telerik Team, you are doing an amazing work but today I need some more information.
I need to focus the gantt view on a task while double clicking on its name.
I look forward something like the "ScrollToDateTime" function or something like that.
I already tried this solution : http://www.telerik.com/forums/scroll-to-current-day but it could not find the ".bind" property of the "._widget".
I also need to directly open a popup after the insertion of a new task. The problem is that I can't find the task ID in the OntaskInsert event.
Could you please help me ?
Hi,
Trying to gather some info on how to bind the model to a RadGrid when in Edit mode for a dropdown list (or even a RadDropDownList).
I have the following markup:
<
telerik:RadGrid
ID
=
"rgTest"
runat
=
"server"
AutoGenerateColumns
=
"false"
AllowPaging
=
"true"
AllowSorting
=
"true"
ClientSettings-EnableRowHoverStyle
=
"true"
OnItemCommand
=
"rgTest_ItemCommand"
OnDeleteCommand
=
"rgTest_DeleteCommand"
OnItemDataBound
=
"rgTest_ItemDataBound"
PageSize
=
"10"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
MasterTableView
AutoGenerateColumns
=
"false"
DataKeyNames
=
"Id"
SelectMethod
=
"GetData"
UpdateMethod
=
"UpdateData"
ItemType
=
"Model.TestData"
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"false"
/>
<
Columns
>
<
telerik:GridButtonColumn
UniqueName
=
"EditItem"
CommandName
=
"Edit"
ItemStyle-Width
=
"40"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-ForeColor
=
"White"
Text
=
"Edit"
ButtonType
=
"LinkButton"
ButtonCssClass
=
"btn btn-primary btn-sm"
>
</
telerik:GridButtonColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"Id"
HeaderText
=
"ID"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblID"
runat
=
"server"
Text='<%# Item.Id %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"TestTitle"
HeaderText
=
"Title"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblTestTitle"
runat
=
"server"
Text='<%# Item.TestTitle %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"TestType"
HeaderText
=
"Type"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblTestType"
runat
=
"server"
Text='<%# Item.TestType %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormStyle
/>
<
FormTemplate
>
<
label
for
=
"txtTestTitle"
class
=
"col-md-4 control-label"
>Title</
label
>
<
asp:TextBox
ID
=
"txtTestTitle"
runat
=
"server"
ClientIDMode
=
"Static"
Text='<%# BindItem.TestTitle %>' CssClass="form-control" autocomplete="off"></
asp:TextBox
>
<
label
for
=
"ddlType"
class
=
"col-md-4 control-label"
>Type</
label
>
<
asp:DropDownList
ID
=
"ddlType"
runat
=
"server"
Width
=
"100%"
CssClass
=
"form-control"
>
</
asp:DropDownList
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
My code behind as follows:
public IQueryable<
Model.TestData
> GetData()
{
DbContext ctx = new DbContext();
return (from c in ctx.TestData
select c).OrderBy(a => a.Id);
}
public void UpdateWebProjectRequest(int Id)
{
using(DbContext ctx = new DbContext())
{
Model.TestData td = ctx.TestData.Where(a => a.Id == Id).FirstOrDefault();
TryUpdateModel(td);
if (ModelState.IsValid)
{
ctx.SaveChanges();
}
}
}
protected void rgTest_ItemDataBound(object sender, GridItemEventArgs e)
{
if(e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
// Populate the DropdownList here.
DropDownList ddlType = (DropDownList) editItem.FindControl("ddlType");
// Some method here to load the dropdownlist.
var list = new List<
Models.TestTypes
>();
ddlType.DataSource = lst;
ddlType.DataValueField = "TypeId";
ddlType.DataTextField = "TypeName";
ddlType.DataBind();
ddlType.SelectedValue = DataBinder.Eval(editItem.DataItem, "TestType").ToString();
}
}
The issue I am having is that when I changed the value in the dropdownlist and invoke an update command, the new value selected on the dropdownlist is not being propagated to the model, hence, the correct data is not being saved.
I've looked at the article in this link:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/custom-edit-forms
But I am not able to figure out how to bind the dropdownlist value properly.
Any suggestions or ideas would be appreciated.
Thanks.
~A