-
2
Answers
-
Last Activity:
long time ago,
Dr. SPA
Your question has been submitted and is awaiting moderation.
Thank you for reporting this content, moderators have been notified of your submission.
The main question is how to update only the databound dropdownlist on the parent page, after the new value was added in a separate control, opened in a popup, using UrlUtils.PopUpUrl()?
After popup is closed the parent page is refreshed, new value appears in the list, but values entered/chosen in all other controls are lost. Is there a way to update only a specific control without refreshing the whole page?
Any help or link to topic, where this problem was already discussed, would be appreciated.
Parent page:
<%@ Control Language="vb" Inherits="testmodule.MainView" AutoEventWireup="false"
Explicit="True" CodeBehind="MainView.ascx.vb" %>
<asp:EntityDataSource ID="eds1" runat="server" ConnectionString="name=TESTEntities"
DefaultContainerName="TESTEntities" EnableFlattening="False" EntitySetName="ListItems"
Select="it.[ID], it.[Name]">
<asp:DropDownList ID="ddlList" runat="server" DataSourceID="eds1" DataTextField="Name"
DataValueField="ID">
Add new Item
Code behind:
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports System.Linq
Imports DotNetNuke
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Namespace testmodule
Partial Class MainView
Inherits Entities.Modules.PortalModuleBase
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
lb1.Attributes.Add("onclick", "return " & UrlUtils.PopUpUrl(NavigateURL("AddItem", "mid=" & Me.ModuleId), Me, PortalSettings, True, False))
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
End Class
End Namespace
Popup Control:
<%@ Control Language="vb" Inherits="testmodule.AddItem" AutoEventWireup="false"
Explicit="True" CodeBehind="AddItem.ascx.vb" %>
Add new item
Code behind:
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports System.Linq
Imports DotNetNuke
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Namespace testmodule
Partial Class AddItem
Inherits Entities.Modules.PortalModuleBase
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Protected Sub lb1_Click(sender As Object, e As EventArgs) Handles lb1.Click
Dim z As New ListItems
Using cont As New TESTEntities
z.Name = tbx.Text
cont.ListItems.Add(z)
cont.SaveChanges()
End Using
End Sub
End Class
End Namespace