I have a page with a RadListView Control:
Because I need to get the value of the DataKey from the list view I need to open a RadWindow during the ItemCommand Event in the code behind:
Before adding the ListView control to the ASPX page, I used to open the window from the ASPX page using Java:
And close the RadWindow that was opened with this Java:
When I used the ASPX page and java to open the window and then closed the window, the java did a great job of calling the RadAjaxManager and refreshing my ListView.
Now when I open the window from the VB code behind, the RadAjaxManager is no longer called when the pop up window is closed.
How can I ensure that the the RadAjaxManager fires when the pop up window closes even though the pop up is opened from the code behind?
I hope this was not TOO confusing. :)
<
telerik:RadListView
ID
=
"rlv_Responses"
runat
=
"server"
DataKeyNames
=
"IDTicketsResponses"
DataSourceID
=
"sds_Responses"
Skin
=
"WebBlue"
BorderColor
=
"#5A7594"
BorderStyle
=
"Solid"
BorderWidth
=
"1px"
Width
=
"400px"
>
<
AlternatingItemTemplate
>
<
div
class
=
"rlvA"
>
<
table
cellpadding
=
"3"
cellspacing
=
"0"
style
=
"border: thin solid #293852; padding: 10px; width: 100%"
>
<
tr
>
<
td
style
=
"padding: 5px"
>
<
asp:Label
ID
=
"lbl_EnteredDate"
runat
=
"server"
Text='<%# Eval("EnteredDate") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"padding: 5px"
>
<
asp:Label
ID
=
"lbl_FullName"
runat
=
"server"
style
=
"font-weight: 700; color: #597791"
Text='<%# Eval("FullName") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"padding: 5px"
>
<
asp:Label
ID
=
"lbl_Response"
runat
=
"server"
Text='<%# Eval("Response") %>' />
<
asp:Label
ID
=
"lbl_TicketsResponses"
runat
=
"server"
Text='<%# Eval("IDTicketsResponses") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"padding: 5px"
>
<
asp:Button
ID
=
"SelectButton"
runat
=
"server"
CommandName
=
"Select"
Text
=
"Details"
/>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Label"
></
asp:Label
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
AlternatingItemTemplate
>
<
InsertItemTemplate
>
</
InsertItemTemplate
>
<
ItemTemplate
>
<
div
class
=
"rlvI"
>
<
table
cellpadding
=
"3"
cellspacing
=
"0"
style
=
"border: thin solid #293852; padding: 10px; width: 100%; background-color: #E6E6E6;"
>
<
tr
>
<
td
style
=
"padding: 5px;"
>
<
asp:Label
ID
=
"lbl_EnteredDate0"
runat
=
"server"
Text='<%# Eval("EnteredDate") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"padding: 5px;"
>
<
asp:Label
ID
=
"lbl_FullName0"
runat
=
"server"
style
=
"font-weight: 700; color: #597791"
Text='<%# Eval("FullName") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"padding: 5px;"
>
<
asp:Label
ID
=
"lbl_Response0"
runat
=
"server"
Text='<%# Eval("Response") %>' />
<
asp:Label
ID
=
"lbl_TicketsResponses0"
runat
=
"server"
Text='<%# Eval("IDTicketsResponses") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"padding: 5px;"
>
<
asp:Button
ID
=
"SelectButton"
runat
=
"server"
CommandName
=
"Select"
Text
=
"Details"
/><
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Label"
></
asp:Label
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
ItemTemplate
>
<
EmptyDataTemplate
>
<
div
class
=
"RadListView RadListView_Default"
>
<
div
class
=
"rlvEmpty"
>
There are no items to be displayed.</
div
>
</
div
>
</
EmptyDataTemplate
>
<
LayoutTemplate
>
<
div
class
=
"RadListView RadListView_Default"
>
<
div
ID
=
"itemPlaceholder"
runat
=
"server"
>
</
div
>
</
div
>
</
LayoutTemplate
>
<
SelectedItemTemplate
>
<
div
class
=
"rlvISel"
>
<
asp:Label
ID
=
"lbl_EnteredDate1"
runat
=
"server"
Text='<%# Eval("EnteredDate") %>' />
<
asp:Label
ID
=
"lbl_FullName1"
runat
=
"server"
Text='<%# Eval("FullName") %>' />
<
asp:Label
ID
=
"lbl_Response1"
runat
=
"server"
Text='<%# Eval("Response") %>' />
<
asp:Label
ID
=
"lbl_TicketsResponses1"
runat
=
"server"
Text='<%# Eval("IDTicketsResponses") %>' />
</
div
>
</
SelectedItemTemplate
>
</
telerik:RadListView
>
Because I need to get the value of the DataKey from the list view I need to open a RadWindow during the ItemCommand Event in the code behind:
Protected
Sub
RadListView1_ItemCommand(
ByVal
sender
As
Object
,
ByVal
e
As
RadListViewCommandEventArgs)
Handles
rlv_Responses.ItemCommand
If
e.CommandName = RadListView.SelectCommandName
Then
Dim
item
As
RadListViewDataItem = TryCast(e.ListViewItem, RadListViewDataItem)
Dim
IDTicketsResponses
As
String
= item.GetDataKeyValue(
"IDTicketsResponses"
).ToString()
Session(
"IDTicketsResponses"
) = IDTicketsResponses
Dim
scriptstring
As
String
=
"radopen('helpdesk_tickets_respond_edit.aspx', 'EditResponse');"
RadAjaxManager1.ResponseScripts.Add(
String
.Format(
"refreshGrid('{0}')"
,
"Server Response!"
))
ScriptManager.RegisterStartupScript(
Me
,
Me
.[
GetType
](),
"radopen"
, scriptstring,
True
)
End
If
End
Sub
Before adding the ListView control to the ASPX page, I used to open the window from the ASPX page using Java:
<telerik:RadCodeBlock ID=
"RadCodeBlock1"
runat=
"server"
>
<script type=
"text/javascript"
language=
"javascript"
>
function
getQuerystring(key, default_) {
if
(default_ ==
null
) default_ =
""
;
key = key.replace(/[\[]/,
"\\\["
).replace(/[\]]/,
"\\\]"
);
var
regex =
new
RegExp(
"[\\?&]"
+ key +
"=([^&#]*)"
);
var
qs = regex.exec(window.location.href);
if
(qs ==
null
)
return
default_;
else
return
qs[1];
}
function
AddResponse() {
var
param1 = getQuerystring(
'IDTicket'
);
var
param2 = getQuerystring(
'IDRequestor'
);
var
oWnd = radopen(
"helpdesk_tickets_respond.aspx?IDTicket="
+ param1 +
"&IDRequestor="
+ param2,
"UserListDialog"
);
return
false
;
}
function
refreshGrid(arg) {
if
(!arg) {
$find(
"<%= RadAjaxManager1.ClientID %>"
).ajaxRequest(
"Rebind"
);
}
}
</script>
</telerik:RadCodeBlock>
And close the RadWindow that was opened with this Java:
<script type=
"text/javascript"
>
function
Close(args) {
GetRadWindow().BrowserWindow.refreshGrid(args);
GetRadWindow().close();
}
function
GetRadWindow() {
var
oWindow =
null
;
if
(window.radWindow) oWindow = window.radWindow;
//Will work in Moz in all cases, including clasic dialog
else
if
(window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
//IE (and Moz as well)
return
oWindow;
}
function
CancelEdit() {
GetRadWindow().close();
}
</script>
When I used the ASPX page and java to open the window and then closed the window, the java did a great job of calling the RadAjaxManager and refreshing my ListView.
Now when I open the window from the VB code behind, the RadAjaxManager is no longer called when the pop up window is closed.
How can I ensure that the the RadAjaxManager fires when the pop up window closes even though the pop up is opened from the code behind?
I hope this was not TOO confusing. :)