Protected
Sub
rgvSecurityUsers_ItemUpdated(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridUpdatedEventArgs)
Handles
rgvSecurityUsers.ItemUpdated
If
Not
e.Exception
Is
Nothing
Then
Dim
EditItem
As
GridEditableItem =
DirectCast
(e.Item, GridEditableItem)
Dim
strUserId
As
String
= EditItem.GetDataKeyValue(
"UserID"
).ToString()
Dim
strUserName
As
String
= TryCast(EditItem(
"UserName"
).Controls(0), TextBox).Text
Dim
strMessage
As
String
=
"User "
+ strUserId +
" "
& strUserName &
" cannot be updated. Reason: "
+ e.Exception.Message
MsgBox(e.Exception.Message)
Dim
scriptstring
As
String
=
"radalert('"
+ strMessage +
"', 330, 210);"
e.KeepInEditMode =
True
e.ExceptionHandled =
True
ScriptManager.RegisterStartupScript(
Me
,
Me
.[
GetType
](),
"radalert"
, scriptstring,
True
)
End
If
End
Sub
DataFormatString
="{0:C2}
203,00 |
186,00 |
3.233,00 kr |
137,00 |
213,00 |
157,00 |
173,00 |
546,00 |
751,00 |
1.750,00 kr |
1.750,00 kr |
150,00 |
203,00 kr |
186,00 kr |
3 233,00 kr |
137,00 kr |
213,00 kr |
157,00 kr |
173,00 kr |
546,00 kr |
751,00 kr |
1 750,00 kr |
1 750,00 kr |
150,00 kr |
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!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
></
title
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
<
script
src
=
"scripts.js"
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
</
script
>
<
telerik:RadWindowManager
ID
=
"WindowManager"
runat
=
"server"
Behaviors
=
"Move,Close,Resize"
DestroyOnClose
=
"true"
KeepInScreenBounds
=
"true"
Modal
=
"true"
ReloadOnShow
=
"true"
ShowContentDuringLoad
=
"false"
VisibleStatusbar
=
"false"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"DialogWindow"
OpenerElementID
=
"OpenDialogButton"
NavigateUrl
=
"Dialog.aspx"
runat
=
"server"
Width
=
"650px"
Height
=
"450px"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
div
>
<
h1
>Test Window Drag Issue</
h1
>
<
ol
>
<
li
>1. Click "Open Dialog".</
li
>
<
li
>2. Click "Submit" button in the window. This issues a Thread.Sleep(5000) to simulate a long-running task.</
li
>
<
li
>3. While the window is posting-back, drag the window around.</
li
>
<
li
>4. The window will close, via script from the server-side postback. And then the window will re-appear.</
li
>
<
li
>5. Now, attempt to close the window. You cannot close this dialog.</
li
>
</
ol
>
<
p
>Click "Open Dialog" button.</
p
>
<
asp:Button
ID
=
"OpenDialogButton"
runat
=
"server"
Text
=
"Open Dialog"
/>
</
div
>
</
form
>
</
body
>
</
html
>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dialog.aspx.cs" Inherits="RadControls_WindowIssue.Dialog" %>
<!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
></
title
>
<
script
src
=
"scripts.js"
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager2"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadAjaxPanel
id
=
"AjaxPanel1"
LoadingPanelID
=
"LoadingPanel1"
runat
=
"server"
>
<
h1
>Dialog Page</
h1
>
<
p
>A sample dialog to illustrate the issue.</
p
>
<
ol
>
<
li
>1. Click the Submit button.</
li
>
<
li
>2. The postback event has a Thread.Sleep(5000) - 5 seconds. Then, the server-side code issues a close window script.</
li
>
<
li
>3. While the page is in the middle of a post-back, drag the Window.</
li
>
<
li
>4. Observe that when the window closes, it opens back up and is visible. However, now you cannot close the dialog.</
li
>
</
ol
>
<
asp:Button
id
=
"SubmitButton"
runat
=
"server"
Text
=
"Submit"
OnClick
=
"SubmitClick"
/>
</
telerik:RadAjaxPanel
>
<
telerik:RadAjaxLoadingPanel
ID
=
"LoadingPanel1"
Skin
=
"Default"
runat
=
"server"
/>
</
form
>
</
body
>
</
html
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
namespace
RadControls_WindowIssue
{
public
partial
class
Dialog : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
SubmitClick(
object
sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
ScriptManager.RegisterStartupScript(
this
, GetType(),
"close"
,
"CloseModal();"
,
true
);
}
}
}
function
GetRadWindow() {
var
oWindow =
null
;
if
(window.radWindow)
oWindow = window.radWindow;
else
if
(window.frameElement && window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return
oWindow;
}
function
CloseModal() {
var
radWindow = GetRadWindow();
radWindow.close(returnValue);
}
<telerik:RadAjaxPanel ID="RadAjaxPanel1" RestoreOriginalRenderDelegate="false" runat="server">
<asp:LinkButton ID="linkbuttonShowHide" runat="server" Text="Show Group Questions"
Font-Size="xx-small" Visible="false" CommandArgument='<%# Eval("QID") %>'
OnCommand="linkbuttonShowHide_Command" CommandName="Click" />
<asp:Panel ID="panel" Visible="false" runat="server">
<asp:GridView ID="gridview1" Visible="true" CssClass="tablescale" runat="server"
ShowHeader="false" ShowFooter="false" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="id" Visible="true" />
<asp:BoundField DataField="text" Visible="true" HtmlEncode="false" />
</Columns>
</asp:GridView>
</asp:Panel>
</telerik:RadAjaxPanel>
when the grid is first loaded the panel is not visible, then when the linkbutton is clicked it is opened with roughly the following code:
protected void linkbuttonShowHideRRQuests_Command(object sender, CommandEventArgs e)
{
LinkButton _lbShowRR = (LinkButton)sender;
GridView _gvRR = (GridView)((LinkButton)sender).Parent.FindControl("gridview1");
Panel _panelRR = (Panel)((LinkButton)sender).Parent.FindControl("panel");
if (_lbShowRR.Text != "Show Questions")
{
_lbShowRR.Text =
"Show Questions";
_gvRR.DataSource =
null;
_gvRR.DataBind();
_panelRR.Visible =
false;
}
else
{
_lbShowRR.Text =
"Hide Questions";
_gvRR.DataSource =
this.GroupQuestions;
_gvRR.DataBind();
_panelRR.Visible =
true;
}
}
When I add code to export the grid to excel where:
RadGrid.ExportSettings.ExportOnlyData =
true;
RadGrid.ExportSettings.IgnorePaging =
true;
RadGrid.ExportSettings.OpenInNewWindow =
true;
I am binding the data in the OnNeedDataSource event of the grid.
The issue I am having is that when RestoreOriginalRenderDelegate="false", the panel will not open, but when RestoreOriginalRenderDelegate="true", the panel will open but the export does not work correctly, I get the
error that I have seen in a few other posts.
I have looked at a few posts and have tried setting the inheritance of the page to the RadAjaxPage and also try to implement IRadAjaxPage, none of this seems to work.
Is there any other work arounds where both can happen, I can export to excel and I can open the panel within the ajax panel?
Thanks for your help!
Aaron
<
telerik:RadChart
ID
=
"RadChart1"
runat
=
"server"
DefaultType
=
"StackedSplineArea100 "
Width
=
"1000"
Height
=
"800"
>
</
telerik:RadChart
>
Imports Telerik.Web.UI
Imports Telerik.Charting
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
RadChart1.DataGroupColumn = "Year"
RadChart1.DataSource = ChartData.GetGrouplData()
RadChart1.DataBind()
For i As Integer = 0 To RadChart1.Series.Count - 1
RadChart1.Series(i).DataXColumn = "Month"
RadChart1.Series(i).DataYColumn = "MonthCount"
RadChart1.Series(i).DefaultLabelValue = "#%"
Next
End Sub
End Class
Public Class ChartData
Public Shared Function GetGrouplData() As DataTable
Dim dataTableGroupData As New DataTable()
dataTableGroupData = New DataTable()
dataTableGroupData.Columns.Add("Year")
dataTableGroupData.Columns.Add("Month")
dataTableGroupData.Columns.Add("MonthCount")
dataTableGroupData.Rows.Add(New Object() {"2009", "1", "50"})
dataTableGroupData.Rows.Add(New Object() {"2009", "2", "20"})
dataTableGroupData.Rows.Add(New Object() {"2009", "3", "70"})
dataTableGroupData.Rows.Add(New Object() {"2009", "4", "143"})
dataTableGroupData.Rows.Add(New Object() {"2009", "5", "210"})
dataTableGroupData.Rows.Add(New Object() {"2009", "6", "250"})
dataTableGroupData.Rows.Add(New Object() {"2009", "7", "252"})
dataTableGroupData.Rows.Add(New Object() {"2009", "8", "396"})
dataTableGroupData.Rows.Add(New Object() {"2009", "9", "406"})
dataTableGroupData.Rows.Add(New Object() {"2009", "10", "470"})
dataTableGroupData.Rows.Add(New Object() {"2009", "11", "472"})
dataTableGroupData.Rows.Add(New Object() {"2009", "12", "431"})
dataTableGroupData.Rows.Add(New Object() {"2010", "1", "10"})
dataTableGroupData.Rows.Add(New Object() {"2010", "2", "50"})
dataTableGroupData.Rows.Add(New Object() {"2010", "3", "234"})
dataTableGroupData.Rows.Add(New Object() {"2010", "4", "101"})
dataTableGroupData.Rows.Add(New Object() {"2010", "5", "231"})
dataTableGroupData.Rows.Add(New Object() {"2010", "6", "482"})
dataTableGroupData.Rows.Add(New Object() {"2010", "7", "20"})
dataTableGroupData.Rows.Add(New Object() {"2010", "8", "87"})
dataTableGroupData.Rows.Add(New Object() {"2010", "9", "58"})
dataTableGroupData.Rows.Add(New Object() {"2010", "10", "10"})
dataTableGroupData.Rows.Add(New Object() {"2010", "11", "99"})
dataTableGroupData.Rows.Add(New Object() {"2010", "12", "312"})
GetGrouplData = dataTableGroupData
End Function
End Class