I've created a dynamic grid which allows me to load different sets of data. I've now turned it into a widget so it can be placed and configured multiple times on a page. The problem I have now is I'm receiving this error when I load more than one widget.
There must be only one instance of RadStyleSheetManager per page.
Same is true for the RadPersisgenceManager. How might I overcome this issue so I can load multiple controls dynamically on a page?
I know this has come up multiple times and I have read multiple posts but have not been able to get it to work
On the parent page in the web browser, there is a button. When a user clicks on the button, it opens a page with a RadGrid in a RadWindow. We will call that WindowA.
In the RadGrid in WindowA, each record has a column with a HyperLink. When clicking on the HyperLink, it opens a different page in another RadWindow for the user to edit and update the data for that record. We will call that WindowB.
When the user edits the data and clicks on the Update button in WindowB, it needs to do the following:
- Execute a SQL statement to update the record in the database table.
- Close WindowB.
- Refresh or Rebind the RadGrid in WindowA using the RadAjaxManager to call an ajaxRequest to show the changes in the data.
-----------------------------------------------------------------------
I was able to do something similiar between the browser window (parent) and a RadWindow where the parent has the RadGrid which gets updated after user clicks on Update button in RadWindow. But I cannot get the scenario above to work.
-----------------------------------------------------------------------
I have read the article in http://docs.telerik.com/devtools/aspnet-ajax/controls/window/how-to/calling-functions-in-windows .
When I debug through the Javascript function, I get the error " Object doesn't support property or method 'get_ContentFrame' " on the following line of code:
oWnd.get_ContentFrame().contentWindow.MyTestViewTodayRelFn();
Below is my code.
Please help me to get this to work. A working example would help alot.
Thanks!
------------------------------------------------------------------------
Update button click subroutine in code-behind for page in WindowB ( VB code)
Protected Sub rbtnUpdateOrder_Click(sender As Object, e As EventArgs) Handles rbtnUpdateOrder.Click
...
ScriptManager.RegisterStartupScript(Me, [GetType](), "mykey", "CloseAndRebind();", True)
...
End Sub
Javascript function CloseAndRebind in page in WindowB (put in <head> </head> section):
function CloseAndRebind(args) {
var oManager = GetRadWindow().BrowserWindow.GetRadWindowManager();
var oWnd = oManager.getWindowByName("Release History");
oWnd.get_ContentFrame().contentWindow.MyTestViewTodayRelFn();
alert(oWnd);
GetRadWindow().close();
}
Javascript function MyTestViewTodayRelFn in page in WindowA (put in <head> </head> section):
function MyTestViewTodayRelFn() {
alert("Called MyTestViewTodayRelFn");
}
Note: MyTestViewTodayRelFn is just a test function. Here is an example of what the actual function would be in the page for WindowA:
function refreshGridRYG(arg) {
if (!arg) {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
}
else {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
}
}
Sincerely,
Keith Jackson
ScriptManager
.RegisterStartupScript(this.Page, this.GetType(), "printRADGrid", "PrintRadGrid();", true);
but the contents of my radgrid seems to be null. I am also using master pages. I have spent a while trying to find an easy solution and haven't been very successful. Can someone please point me in the right direction? Thanks in advance for your help!
I am trying to hide and show RadHtmlChart based on selection of dropdown. It works fine (hides and shows) unless i set style="display:none;", in that case it does not show itself. Not sure if it matters, but I load control not on Page_Load, but on Button click.
This is another annoyance with Telerik controls that drives me bananas.
Please suggest something
<telerik:RadHtmlChart runat="server" ID="pieChart" style="display:none;"
Width="1100px" Height="580px"
Transitions="true">
<ChartTitle Text="" >
<Appearance Align="Center" Position="Top" Visible="false">
<TextStyle Bold="true"/>
</Appearance>
</ChartTitle>
<Legend>
<Appearance Position="Right" Visible="false"></Appearance>
</Legend>
<PlotArea>
<Series>
<telerik:PieSeries DataFieldY="TotalEmploymentOM" NameField="IndustryName">
<LabelsAppearance Position="OutsideEnd" DataField="IndustryName">
</LabelsAppearance>
<TooltipsAppearance Color="White" DataFormatString="{0:N0}"/>
</telerik:PieSeries>
</Series>
</PlotArea>
</telerik:RadHtmlChart>
function onchange_ddlSelectionOM() {
var ddltext = $('option:selected', $('#ddlSelectionOM')).text();
if (ddltext == "Pie") {
document.getElementById("<%=grdOM.ClientID %>").style.display = "none";
document.getElementById("<%=chartJobsBySectorAnnualOM.ClientID %>").style.display = "none";
document.getElementById("<%=pieChart.ClientID %>").style.display = "";
}
}
Hello,
Is there a way to make the filter image/icon standout out more when the column has a filter applied to it. I'm currently using the Windows 7 skin and it is hard to tell which columns have a filter applied based on the slight difference in styling between the image of a column with no filter vs the image of a column with an active filter.
-Alex
We use the RadTileList on a RadTab panel as first tab item. When I click on a Tile a new tab is opened.
On leaving the RadTileList tab I would like to save the vertical scroll position and restore it when the RadTileList tab is visited again.
Any ideas how to accomplish this? I did not found any client-side methods for it.
Hi,
I'd like to know if Telerik has any component or some tutorial/demo to sign a PDF with a certificate.
I found this tutorial: http://demos.telerik.com/aspnet-ajax/editor/examples/import-export/pdf-export/defaultcs.aspx to generate a PDF, but I can't find a way to sign this file with a certificate.
Is there any way or any Telerik's component to do this task?
This would be required to be used on web pages, at the moment ASP.Net or MVC are both acceptable.
Thanks,
Adriano Gaspar.
As shown in the examples I have implemented a Provider for the Gantt chart. The provider appears to be working, when I break through it the methods are called, items are inserted, updated and deleted in the database etc. Both GetTasks and GetDependencies return an ITask list. The problem I'm having is that nothing appears in the Gantt chart (it loads with no Tasks showing).
When I add new Tasks those will show (and are added to the database) and I can update them etc. After a page refresh they also no longer show.
Here is the provider implementation, GetById returns a DataSet and Mutate returns an object containing the ID of inserted item + success/error info:
public
class
GanttCustomProvider : GanttProviderBase
{
private
long
_projectId;
private
string
_connString;
public
GanttCustomProvider(
long
projectId,
string
connString) :
base
()
{
_projectId = projectId;
_connString = connString;
}
public
override
ITaskFactory TaskFactory
{
get
{
return
new
CustomGanttTaskFactory();
}
}
public
override
List<ITask> GetTasks()
{
using
(var client =
new
FunctionsClient())
{
var source = client.GetById(
new
Phase { PROJECT_ID = _projectId, ConnectionString = _connString })
.Tables[0].AsEnumerable();
var list = source.Select(row =>
new
CustomTask
{
ID = row[
"ID"
],
ParentID = row[
"PARENT"
],
Title = row[
"TITLE"
].ToString(),
Start = (DateTime)row[
"START_DATE"
],
End = (DateTime)row[
"END_DATE"
],
Summary = (
bool
)row[
"SUMMERY"
],
OrderID = row[
"ORDER_ID"
],
Expanded = (
bool
)row[
"EXPANDED"
],
PercentComplete = Decimal.Parse(row[
"PERCENTCOMPLETE"
].ToString()),
Time = (
double
)row[
"TIME"
]
}).ToList<ITask>();
return
list;
}
}
public
override
ITask InsertTask(ITask t)
{
var task = (CustomTask)t;
using
(var client =
new
FunctionsClient())
{
task.ID = client.Mutate(
new
Phase
{
PROJECT_ID = _projectId,
PARENT = (
int
?)task.ParentID,
TITLE = task.Title,
START_DATE = task.Start,
END_DATE = task.End,
SUMMERY = task.Summary,
ORDER_ID = (
int
?)task.OrderID,
EXPANDED = task.Expanded,
Mode = Modes.Insert,
ConnectionString = _connString
}).returnID;
return
task;
}
}
public
override
ITask UpdateTask(ITask t)
{
var task = (CustomTask)t;
using
(var client =
new
FunctionsClient())
{
client.Mutate(
new
Phase
{
ID = (
int
)task.ID,
PARENT = (
int
?)task.ParentID,
PROJECT_ID = _projectId,
TITLE = task.Title,
START_DATE = task.Start,
END_DATE = task.End,
SUMMERY = task.Summary,
ORDER_ID = (
int
)task.OrderID,
EXPANDED = task.Expanded,
TIME = task.Time,
Mode = Modes.Update,
ConnectionString = _connString
});
}
return
task;
}
public
override
ITask DeleteTask(ITask task)
{
using
(var client =
new
FunctionsClient())
{
client.Mutate(
new
Phase
{
ID = (
int
)task.ID,
Mode = Modes.Delete,
ConnectionString = _connString
});
return
task;
}
}
public
override
List<IDependency> GetDependencies()
{
using
(var client =
new
FunctionsClient())
{
var source = client.GetById(
new
PhaseDependency { ProjectID = _projectId, ConnectionString = _connString })
.Tables[0].AsEnumerable();
var list = source.Select(row =>
new
Dependency
{
ID = row[
"ID"
],
PredecessorID = row[
"PredecessorID"
],
SuccessorID = row[
"SuccessorID"
],
Type = (DependencyType)row[
"Type"
]
}).ToList<IDependency>();
return
list;
}
}
public
override
IDependency InsertDependency(IDependency dependency)
{
using
(var client =
new
FunctionsClient())
{
dependency.ID = client.Mutate(
new
PhaseDependency
{
PredecessorID = (
int
)dependency.PredecessorID,
SuccessorID = (
int
)dependency.SuccessorID,
Type = (
int
)dependency.Type,
Mode = Modes.Insert,
ConnectionString = _connString
}).returnID;
}
return
dependency;
}
public
override
IDependency DeleteDependency(IDependency dependency)
{
using
(var client =
new
FunctionsClient())
{
client.Mutate(
new
PhaseDependency
{
ID = (
int
)dependency.ID,
Mode = Modes.Delete,
ConnectionString = _connString
});
}
return
dependency;
}
}
Here are the implementations of the Custom Task and Factory:
public
class
CustomTask : Task
{
public
CustomTask() :
base
() { }
public
double
? Time
{
get
{
return
(
double
?)(ViewState[
"Time"
] ?? (
double
?)
null
); }
set
{ ViewState[
"Time"
] = value; }
}
protected
override
IDictionary<
string
,
object
> GetSerializationData()
{
var dict =
base
.GetSerializationData();
dict[
"Time"
] = Time;
return
dict;
}
public
override
void
LoadFromDictionary(System.Collections.IDictionary values)
{
base
.LoadFromDictionary(values);
Time = values[
"Time"
] ==
null
? (
float
?)
null
:
float
.Parse(values[
"Time"
].ToString());
}
}
public
class
CustomGanttTaskFactory : ITaskFactory
{
Task ITaskFactory.CreateTask()
{
return
new
CustomTask();
}
}
And finally the Page the Gantt is on:
<%@ Page Language=
"C#"
AutoEventWireup=
"true"
CodeBehind=
"GanttTest.aspx.cs"
Inherits=
"GanttTest"
%>
<!DOCTYPE html>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head runat=
"server"
>
<title></title>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<div>
<telerik:RadScriptManager runat=
"server"
/>
<telerik:RadGantt runat=
"server"
id=
"rgPlanning"
AutoGenerateColumns=
"false"
>
<YearView UserSelectable=
"True"
/>
<Columns>
<telerik:GanttBoundColumn DataField=
"Title"
DataType=
"String"
Width=
"100px"
HeaderText=
"Title"
/>
<telerik:GanttBoundColumn DataField=
"Start"
DataType=
"DateTime"
DataFormatString=
"dd/MM/yy"
Width=
"100px"
HeaderText=
"Start"
/>
<telerik:GanttBoundColumn DataField=
"End"
DataType=
"DateTime"
DataFormatString=
"dd/MM/yy"
Width=
"100px"
HeaderText=
"End"
/>
<telerik:GanttBoundColumn DataField=
"Time"
DataType=
"Number"
Width=
"100px"
UniqueName=
"Time"
HeaderText=
"Hours"
/>
</Columns>
<CustomTaskFields>
<telerik:GanttCustomField PropertyName=
"Time"
Type=
"Number"
ClientPropertyName=
"time"
/>
</CustomTaskFields>
</telerik:RadGantt>
</div>
</form>
</body>
</html>
And code behind:
public
partial
class
GanttTest : Page
{
private
long
? projectID = 3;
private
string
connString =
"Connectionstring";
protected
void
Page_Load(
object
sender, EventArgs e)
{
rgPlanning.Provider =
new
GanttCustomProvider(projectID.Value, connString);
}
}
project using RadClientDataSource to binding RadDropdownTree control using WebService WCF. Load data is ok.
This my code:
.aspx:
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadClientDataSource ID="RadClientDataSource1" runat="server"
AllowBatchOperations="True">
<ClientEvents OnCustomParameter="ParameterMap" OnDataParse="Parse" />
<DataSource>
<WebServiceDataSourceSettings BaseUrl="UserInfoService.svc/">
<Select Url="GetDonVis" DataType="JSON" RequestType="Post" ContentType="application/json; charset=utf-8" />
</WebServiceDataSourceSettings>
</DataSource>
<Schema>
<Model>
<telerik:ClientDataSourceModelField FieldName="MaDonVi" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="TenDonVi" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="ParentId" DataType="String" />
</Model>
</Schema>
</telerik:RadClientDataSource>
<telerik:RadDropDownTree RenderMode="Classic" EnableFiltering="true" ID="RadDropDownTree1" runat="server"
DropDownSettings-Height="220px" Width="100%" DropDownSettings-CloseDropDownOnSelection="true"
ClientDataSourceID="RadClientDataSource1" DataTextField="TenDonVi"
DataValueField="MaDonVi" DataFieldID="MaDonVi"
DataFieldParentID="ParentId" Skin="Office2007">
<CollapseAnimation Type="None" />
</telerik:RadDropDownTree>
WebService:
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
public CustomersResult GetDonVis()
{
//Doc data tu DB
SqlConnection sqlConnection = new SqlConnection();
try
{
sqlConnection.ConnectionString = "SERVER=localhost;Database=LongBien;UID=sa;PWD=abcde12345-;";
sqlConnection.Open();
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM tblDmDonVi;", sqlConnection);
DataTable dataTable = new DataTable("DonVi");
da.Fill(dataTable);
da.Dispose();
List<ServiceDonVi> result = new List<ServiceDonVi>();
foreach (DataRow dataRow in dataTable.Rows)
{
ServiceDonVi donVi = new ServiceDonVi();
donVi.MaDonVi = dataRow["MaDonVi"].ToString();
donVi.TenDonVi = dataRow["TenDonVi"].ToString();
if (dataRow["ParentId"] != DBNull.Value)
{
donVi.ParentId = dataRow["ParentId"].ToString();
}
result.Add(donVi);
}
dataTable.Dispose();
CustomersResult a = new CustomersResult();
a.Data = result;
a.Count = 100;
return a;
}
catch (Exception exception)
{
throw;
}
finally
{
sqlConnection.Close();
sqlConnection.Dispose();
}
}
But I has problem:
1. When addnew data item -> save data in database is ok. (Example: value selected = 5)
2. When edit this item, how to set selected item keep old value (value = 5) has save in database???
i am using TabStrip with RadMultiPage.
these tabs share the save asp:Button. i would like to know is it possible to trigger the validationgroup base on the current selected tab?
for example i have 3 tabs
Tab 1 - Validation group: "validateIntro"
Tab 2 - Validation group: "validateBody"
Tab 3 - Validation group: "validateFinal"
so when user is on tab 1 and click on the Next button, only validateIntro should fire, similarly when user is on tab 2 only validateBody should fire