I am having quite an issue with the modal popup extender, and I fear my situation is very unique.
I have an aspx page that has 2 update panels. The first update panel contains a dropdown box with a list of locations, I'll call this UPD1. The second update panel contains a webpart that contains a user control that lists contact information for the location selected, I'll call this UPD2. On this user control is a modal popup ajax control that displays a dialog to add new contacts for the location and it is loaded by clicking a button. When the page is first displayed and I click the add button in UPD2 the modal dialog displays just fine. If I change the loaction in UPD1, which causes UPD2 to be updated with contact information for the new location selected in UPD1 the add button in UPD2 no loger displays the modal dialog, but, causes a postback.
If I change the page containg these 2 update panels and remove the webpart from UPD2 and just place gthe user control in UPD2 the page works fine.
Any ideas? I am really stuck on this one.
Thanks,
Here as my user control.ascx code
<%@.ControlLanguage="VB"
AutoEventWireup="false"
CodeFile="NotificationList.ascx.vb"Inherits="NotificationList"
%>
<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %><%@.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI"TagPrefix="asp" %>
<scripttype="text/javascript">var vClearFields;
function fLoadRecipDialog(vNotificationID){
var vFirstName = document.getElementById("CMNFirstName" + vNotificationID);alert ("vFirstName Is " + vFirstName);
alert ("vFirstName Value Is " + vFirstName.value);var vLastName = document.getElementById("CMNLastName" + vNotificationID);
var vTitle = document.getElementById("CMNTitle" + vNotificationID);var vEMail = document.getElementById("CMNEMail" + vNotificationID);
var vFrequency = document.getElementById("CMNFrequency" + vNotificationID);var vFirstNameField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_txtRecipFirstName");
vFirstNameField.value = vFirstName.value;
var vLastNameField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_txtRecipLastName");vLastNameField.value = vLastName.value;
var vTitleField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_txtRecipTitle");vTitleField.value = vTitle.value;
var vEMailField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_txtRecipEMail");vEMailField.value = vEMail.value;
var vFrequencyField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_drpFrequency");vFrequencyField.selectedIndex = parseFloat(vFrequency.value) - 1;
var vNotificationIDField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_hdnNotificationID");vNotificationIDField.value = vNotificationID;
vClearFields="N";document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_btnAddRecipient").click();
}
function fClearFields(){
if (vClearFields !="N"){
var vFirstNameField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_txtRecipFirstName");vFirstNameField.value ="";
var vLastNameField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_txtRecipLastName");vLastNameField.value ="";
var vTitleField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_txtRecipTitle");vTitleField.value ="";
var vEMailField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_txtRecipEMail");vEMailField.value ="";
var vFrequencyField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_drpFrequency");vFrequencyField.selectedIndex = parseFloat("0");
var vNotificationID = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_hdnNotificationID");vNotificationID.value ="0";
}
// vTestObject = $find("TestExtender");
// alert(vTestObject);
// vTestObject.show();
vClearFields="Y";returnfalse;
}
function fSaveRecip(){
var vActionField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_hdnAction");var vIDField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList1_hdnID");
vActionField.value ="Save";vIDField.value ="";
document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_lnkDoPost").click();}
function fDeleteRecip(vID){
var vActionField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_hdnAction");var vIDField = document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_hdnID");
vActionField.value ="Delete";vIDField.value = vID;
document.getElementById("WebPartManager1_gwpNotificationList_NotificationList_lnkDoPost").click();}
</script><divclass="wpContent">
<asp:TableID="tblNotifications"runat="server"BorderStyle="solid"BorderWidth="1"Width="100%">
</asp:Table><center>
<asp:ButtonID="btnAddRecipient"runat="server"Text="Add"onclientclick='javascript: return fClearFields();'/>
<asp:LinkButtonID="lnkDoPost"runat="server"></asp:LinkButton>
<asp:LabelID="LabelCausedRefresh"runat="server"Width="184px"></asp:Label>
<asp:HiddenFieldID="hdnAction"runat="server"/>
<asp:HiddenFieldID="hdnID"runat="server"/></center>
<cc1:ModalPopupExtenderBehaviorID="TestExtender"ID="ModalPopupExtender1"runat="server"TargetControlID="btnAddRecipient"popupControlID="modalPanel"BackgroundCssClass="modalBackground"DropShadow="true"OkControlID="btnRecipSave"OnOkScript="fSaveRecip()"CancelControlID="btnRecipClose"></cc1:ModalPopupExtender>
<divclass="modalPanel"id="modalPanel"style="display: none"><asp:PanelID="pnlAddRecipient"runat="server"BorderWidth="1"Width="368px">
<tableborder="0"width="100%">
<tr>
<tdcolspan="2"align="center">
<b>Location Management - Notification Recipient</b>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<b>Location:</b>
</td>
<td>
<asp:LabelID="lblRecipLocationName"runat="server"Text="Label"Width="208px"></asp:Label>
</td>
</tr>
<tr>
<td>
<b>Name:</b>
</td>
<tdstyle="height: 26px">
<asp:TextBoxID="txtRecipFirstName"runat="server"Width="72px"></asp:TextBox>
<asp:TextBoxID="txtRecipLastName"runat="server"Width="128px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<b>Title:</b>
</td>
<td>
<asp:TextBoxID="txtRecipTitle"runat="server"Width="210px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<b>E-mail:</b>
</td>
<td>
<asp:TextBoxID="txtRecipEMail"runat="server"Width="210px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<b>Frequency:</b>
</td>
<td>
<asp:DropDownListID="drpFrequency"runat="server">
<asp:ListItemValue="1">Weekly</asp:ListItem>
<asp:ListItemValue="2">Bi-Weekly</asp:ListItem>
<asp:ListItemValue="3">Monthly</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<tdcolspan="2"align="center">
<asp:LinkButtonID="btnRecipSave"runat="server">Save</asp:LinkButton>
<asp:LinkButtonID="btnRecipClose"runat="server">Close</asp:LinkButton>
<asp:HiddenFieldID="hdnNotificationID"runat="server"></asp:HiddenField>
</td>
</tr>
</table></asp:Panel>
</div></div>
Here is my ascx.vb code
Imports System.Data.SqlClient
Imports System.Data.OleDb
PartialClass NotificationListInherits System.Web.UI.UserControl
Dim cnRetailCommerceAs SqlConnection =Nothing
ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.LoadDim dsConsManageAsNew System.Data.DataSet
Dim cmdSelectAsNew SqlCommandDim parmCLocationAsNew SqlParameter("@.P_CLOCATION", Data.SqlDbType.VarChar, 50)
Dim daConsManageAsNew SqlDataAdapterDim tblRowAs TableRow
Dim tblCellAs TableCellDim m_aryFrequencies(3)AsString
m_aryFrequencies(1) ="Weekly"
m_aryFrequencies(2) ="Bi-Weekly"
m_aryFrequencies(3) ="Monthly"
LabelCausedRefresh.Text = Request.Form("__EventTarget")cnRetailCommerce =New SqlConnection(Session("CONNECTION"))cnRetailCommerce.Open()
IfMe.IsPostBackThen
If Request.Form("__EventTarget").Contains("lnkDoPost")Then
SelectCase hdnAction.ValueCase"Delete"
DeleteConManageLocNotification()
Case"Save"
If hdnNotificationID.Value.ToString ="0"Then
CreateConManageLocNotification()
Else
UpdateConManageLocNotification()
EndIf
EndSelect
EndIf
EndIf
parmCLocation.Direction = Data.ParameterDirection.Input
parmCLocation.Value = Session("CMLocation")cmdSelect.Connection = cnRetailCommerce
cmdSelect.CommandType = Data.CommandType.StoredProcedure
cmdSelect.CommandText ="USP_CONSMANAGEGETLOCNOTIFICATIONS"
cmdSelect.Parameters.Add(parmCLocation)
daConsManage.SelectCommand = cmdSelect
daConsManage.Fill(dsConsManage,"Notifications")Dim dvConsManageAsNew System.Data.DataView(dsConsManage.Tables("Notifications"))
Dim drRowAs System.Data.DataRowdvConsManage.RowFilter ="EMail='" & Session("EMAIL").ToString &"'"
If dvConsManage.Count = 0Then
tblRow =New TableRowtblNotifications.Rows.Add(tblRow)
tblCell =New TableCelltblCell.Text =" "
tblRow.Cells.Add(tblCell)
tblCell =New TableCelltblCell.Text ="<a href='javascript:fLoadRecipDialog(" & Chr(34) &"0" & Chr(34) &");'>Add Me</a>"
tblRow.Cells.Add(tblCell)
tblCell =New TableCelltblCell.Text ="<input type='hidden' name='CMNFirstName0' id='CMNFirstName0' value='" & Session("FIRSTNAME") &"'><input type='hidden' name='CMNLastName0' id='CMNLastName0' value='" & Session("LASTNAME") &"'><input type='hidden' name='CMNTitle0' id='CMNTitle0' value='" & Session("TITLE") &"'><input type='hidden' name='CMNEMail0' id='CMNEMail0' value='" & Session("EMAIL") &"'><input type='hidden' name='CMNFrequency0' id='CMNFrequency0' value='1'>"
tblRow.Cells.Add(tblCell)
EndIf
dvConsManage.Dispose()
If dsConsManage.Tables("Notifications").Rows.Count = 0Then
CreateDefaultConManageLocNotification()
EndIf
ForEach drRowIn dsConsManage.Tables("Notifications").RowsIf drRow("UserManageable") =TrueThen
tblRow =New TableRowtblNotifications.Rows.Add(tblRow)
tblCell =New TableCelltblCell.Text ="<a href='javascript:fDeleteRecip(" & Chr(34) & drRow("NotificationID") & Chr(34) &");'><IMG Src='images\red_x_trans.gif' border='0' height='10px' width='10px'></a>"
tblRow.Cells.Add(tblCell)
tblCell =New TableCelltblCell.Text ="<a href='javascript:fLoadRecipDialog(" & Chr(34) & drRow("NotificationID") & Chr(34) &");'>" & drRow("FirstName") &" " & drRow("LastName") &"</a>"
tblRow.Cells.Add(tblCell)
tblCell =New TableCelltblCell.Text = m_aryFrequencies(drRow("Frequency")) &"<input type='hidden' name='CMNFirstName" & drRow("NotificationID") &"' id='CMNFirstName" & drRow("NotificationID") &"' value='" & drRow("FirstName") &"'><input type='hidden' name='CMNLastName" & drRow("NotificationID") &"' id='CMNLastName" & drRow("NotificationID") &"' value='" & drRow("LastName") &"'><input type='hidden' name='CMNTitle" & drRow("NotificationID") &"' id='CMNTitle" & drRow("NotificationID") &"' value='" & drRow("Title") &"'><input type='hidden' name='CMNEMail" & drRow("NotificationID") &"' id='CMNEMail" & drRow("NotificationID") &"' value='" & drRow("EMail") &"'><input type='hidden' name='CMNFrequency" & drRow("NotificationID") &"' id='CMNFrequency" & drRow("NotificationID") &"' value='" & drRow("Frequency") &"'>"
tblRow.Cells.Add(tblCell)
EndIf
Next
tblRow =New TableRowtblNotifications.Rows.Add(tblRow)
tblCell =New TableCelltblCell.Text = hdnAction.Value
tblRow.Cells.Add(tblCell)
tblCell =New TableCelltblCell.Text = Now.ToString
tblRow.Cells.Add(tblCell)
tblCell =New TableCelltblCell.Text = hdnID.Value
tblRow.Cells.Add(tblCell)
dsConsManage.Dispose()
daConsManage.Dispose()
cnRetailCommerce.Close()
cnRetailCommerce.Dispose()
hdnID.Value =""
hdnAction.Value =""
EndSub
PrivateSub CreateDefaultConManageLocNotification()Dim cmdUpdateAsNew SqlCommand
Dim parmCLocationAsNew SqlParameter("@.P_CLOCATION", Data.SqlDbType.VarChar, 50)Dim parmFirstNameAsNew SqlParameter("@.P_FIRSTNAME", Data.SqlDbType.VarChar, 20)
Dim parmLastNameAsNew SqlParameter("@.P_LASTNAME", Data.SqlDbType.VarChar, 50)Dim parmTitleAsNew SqlParameter("@.P_TITLE", Data.SqlDbType.VarChar, 50)
Dim parmEMailAsNew SqlParameter("@.P_EMAIL", Data.SqlDbType.VarChar, 255)Dim parmFrequencyAsNew SqlParameter("@.P_FREQUENCY", Data.SqlDbType.Int)
Dim parmUserManageableAsNew SqlParameter("@.P_USERMANAGEABLE", Data.SqlDbType.Int)parmCLocation.Direction = Data.ParameterDirection.Input
parmCLocation.Value = Session("CMLocation")parmFirstName.Direction = Data.ParameterDirection.Input
parmFirstName.Value ="John"
parmLastName.Direction = Data.ParameterDirection.Input
parmLastName.Value ="Romeo"
parmTitle.Direction = Data.ParameterDirection.Input
parmTitle.Value ="AWT Consignment Inventory Manager"
parmEMail.Direction = Data.ParameterDirection.Input
parmEMail.Value ="JRomeo@.harsco.com"
parmFrequency.Direction = Data.ParameterDirection.Input
parmFrequency.Value = 1
parmUserManageable.Direction = Data.ParameterDirection.Input
parmUserManageable.Value = 0
cmdUpdate.Connection = cnRetailCommerce
cmdUpdate.CommandType = Data.CommandType.StoredProcedure
cmdUpdate.CommandText ="USP_CONSMANAGECREATELOCNOTIFICATIONS"
cmdUpdate.Parameters.Add(parmCLocation)
cmdUpdate.Parameters.Add(parmFirstName)
cmdUpdate.Parameters.Add(parmLastName)
cmdUpdate.Parameters.Add(parmTitle)
cmdUpdate.Parameters.Add(parmEMail)
cmdUpdate.Parameters.Add(parmFrequency)
cmdUpdate.Parameters.Add(parmUserManageable)
cmdUpdate.ExecuteNonQuery()
cmdUpdate.Dispose()
EndSub
PrivateSub CreateConManageLocNotification()Dim cmdUpdateAsNew SqlCommand
Dim parmCLocationAsNew SqlParameter("@.P_CLOCATION", Data.SqlDbType.VarChar, 50)Dim parmFirstNameAsNew SqlParameter("@.P_FIRSTNAME", Data.SqlDbType.VarChar, 20)
Dim parmLastNameAsNew SqlParameter("@.P_LASTNAME", Data.SqlDbType.VarChar, 50)Dim parmTitleAsNew SqlParameter("@.P_TITLE", Data.SqlDbType.VarChar, 50)
Dim parmEMailAsNew SqlParameter("@.P_EMAIL", Data.SqlDbType.VarChar, 255)Dim parmFrequencyAsNew SqlParameter("@.P_FREQUENCY", Data.SqlDbType.Int)
Dim parmUserManageableAsNew SqlParameter("@.P_USERMANAGEABLE", Data.SqlDbType.Int)parmCLocation.Direction = Data.ParameterDirection.Input
parmCLocation.Value = Session("CMLocation")parmFirstName.Direction = Data.ParameterDirection.Input
parmFirstName.Value = txtRecipFirstName.Text
parmLastName.Direction = Data.ParameterDirection.Input
parmLastName.Value = txtRecipLastName.Text
parmTitle.Direction = Data.ParameterDirection.Input
parmTitle.Value = txtRecipTitle.Text
parmEMail.Direction = Data.ParameterDirection.Input
parmEMail.Value = txtRecipEMail.Text
parmFrequency.Direction = Data.ParameterDirection.Input
parmFrequency.Value = drpFrequency.SelectedValue
parmUserManageable.Direction = Data.ParameterDirection.Input
parmUserManageable.Value = 1
cmdUpdate.Connection = cnRetailCommerce
cmdUpdate.CommandType = Data.CommandType.StoredProcedure
cmdUpdate.CommandText ="USP_CONSMANAGECREATELOCNOTIFICATIONS"
cmdUpdate.Parameters.Add(parmCLocation)
cmdUpdate.Parameters.Add(parmFirstName)
cmdUpdate.Parameters.Add(parmLastName)
cmdUpdate.Parameters.Add(parmTitle)
cmdUpdate.Parameters.Add(parmEMail)
cmdUpdate.Parameters.Add(parmFrequency)
cmdUpdate.Parameters.Add(parmUserManageable)
cmdUpdate.ExecuteNonQuery()
cmdUpdate.Dispose()
EndSub
PrivateSub DeleteConManageLocNotification()Dim cmdUpdateAsNew SqlCommand
Dim parmNotificationIDAsNew SqlParameter("@.P_NOTIFICATIONID", Data.SqlDbType.Int)parmNotificationID.Direction = Data.ParameterDirection.Input
parmNotificationID.Value = hdnID.Value
cmdUpdate.Connection = cnRetailCommerce
cmdUpdate.CommandType = Data.CommandType.StoredProcedure
cmdUpdate.CommandText ="USP_CONSMANAGEDELETELOCNOTIFICATIONS"
cmdUpdate.Parameters.Add(parmNotificationID)
cmdUpdate.ExecuteNonQuery()
cmdUpdate.Dispose()
EndSub
PrivateSub UpdateConManageLocNotification()Dim cmdUpdateAsNew SqlCommand
Dim parmNotificationIDAsNew SqlParameter("@.P_NOTIFICATIONID", Data.SqlDbType.Int)Dim parmCLocationAsNew SqlParameter("@.P_CLOCATION", Data.SqlDbType.VarChar, 50)
Dim parmFirstNameAsNew SqlParameter("@.P_FIRSTNAME", Data.SqlDbType.VarChar, 20)Dim parmLastNameAsNew SqlParameter("@.P_LASTNAME", Data.SqlDbType.VarChar, 50)
Dim parmTitleAsNew SqlParameter("@.P_TITLE", Data.SqlDbType.VarChar, 50)Dim parmEMailAsNew SqlParameter("@.P_EMAIL", Data.SqlDbType.VarChar, 255)
Dim parmFrequencyAsNew SqlParameter("@.P_FREQUENCY", Data.SqlDbType.Int)parmNotificationID.Direction = Data.ParameterDirection.Input
parmNotificationID.Value = hdnNotificationID.Value
parmCLocation.Direction = Data.ParameterDirection.Input
parmCLocation.Value = Session("CMLocation")parmFirstName.Direction = Data.ParameterDirection.Input
parmFirstName.Value = txtRecipFirstName.Text
parmLastName.Direction = Data.ParameterDirection.Input
parmLastName.Value = txtRecipLastName.Text
parmTitle.Direction = Data.ParameterDirection.Input
parmTitle.Value = txtRecipTitle.Text
parmEMail.Direction = Data.ParameterDirection.Input
parmEMail.Value = txtRecipEMail.Text
parmFrequency.Direction = Data.ParameterDirection.Input
parmFrequency.Value = drpFrequency.SelectedValue
cmdUpdate.Connection = cnRetailCommerce
cmdUpdate.CommandType = Data.CommandType.StoredProcedure
cmdUpdate.CommandText ="USP_CONSMANAGEUPDATELOCNOTIFICATIONS"
cmdUpdate.Parameters.Add(parmNotificationID)
cmdUpdate.Parameters.Add(parmCLocation)
cmdUpdate.Parameters.Add(parmFirstName)
cmdUpdate.Parameters.Add(parmLastName)
cmdUpdate.Parameters.Add(parmTitle)
cmdUpdate.Parameters.Add(parmEMail)
cmdUpdate.Parameters.Add(parmFrequency)
cmdUpdate.ExecuteNonQuery()
cmdUpdate.Dispose()
EndSubEndClass
Bump - I have a huge need to get this working. can someone please help?
No comments:
Post a Comment