Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Wednesday, March 28, 2012

modal popup and update panel

hi there, i have a login button that when it is clicked, the modal popup will trigger and was able to logon to the system. the page has two link buttons, when i click on the 2nd link, the update panel will display the items assiciated with that link, and when i click on the 1st link, the update panel will display the items associated to the 1st link, its lakie i have a tabs..the problem is, when i added the modal popup on that page, and clicked on the 2nd link, it will not display the items of that link, i mean, it will not trigger any event at all...but when i remove the modal popup extender on that link, it will toggle..what am i missing here??please help.

thank you .Smile

Can you show me some code so that I can reproduce it?

Modal popup dont work

Hi,

I update to new version of toolkit but my 2 modal popup on my application don't work correctly.

The modal popups work correctly after first page load...but if I first click on another button or do another operation on my page and next I try to open the modal popup it don't appear.

Why?

Thanks for help.

Can you show some code of the code opening Modal dialogs? This is a weird behavior!

Regards


Ok.

This is the extender:

 <cc1:ModalPopupExtender ID="MPE1" runat="server" TargetControlID="filterBtn" CancelControlID="CancelButton" OkControlID="OkButton2" DropShadow="true" BackgroundCssClass="modalBackground" PopupControlID="filtroPanel" > </cc1:ModalPopupExtender>

the modal popup is opened when I click on "filterBtn" button


and this is the panel:

1<asp:Panel ID="filtroPanel" runat="server" CssClass="modalPopup" HorizontalAlign="Center"2 Style="display: none">3 <asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional" >4 <Triggers>5 <asp:AsyncPostbackTrigger ControlID="divisioneDdl" EventName="SelectedIndexChanged" />6 <asp:AsyncPostbackTrigger ControlID="classeDdl" EventName="SelectedIndexChanged" />7 <asp:AsyncPostbackTrigger ControlID="famigliaDdl" EventName="SelectedIndexChanged" />8 <asp:AsyncPostbackTrigger ControlID="ClearFilterBtn" EventName="Click" />9 <asp:AsyncPostbackTrigger ControlID="filterBtn" EventName="Click" />10 </Triggers>11 <ContentTemplate>12 <table>13 <tr>14 <td style="width: 100px; text-align: right">15 Tipo Erbario</td>16 <td style="width: 100px; text-align: left">17 <asp:DropDownList ID="ErbarioDdl" runat="server" Width="150px">18 <asp:ListItem Selected="True">Tutti</asp:ListItem>19 </asp:DropDownList></td>20 </tr>21 <tr>22 <td style="width: 100px; text-align: right">23 Divisione</td>24 <td style="width: 100px; text-align: left">25 <asp:DropDownList ID="divisioneDdl" runat="server" AutoPostBack="True" OnSelectedIndexChanged="divisioneDdl_SelectedIndexChanged"26 Width="150px">27 <asp:ListItem Selected="True">Tutti</asp:ListItem>28 </asp:DropDownList></td>29 </tr>30 <tr>31 <td style="width: 100px; text-align: right">32 Classe</td>33 <td style="width: 100px; text-align: left">34 <asp:DropDownList ID="classeDdl" runat="server" AutoPostBack="True" OnSelectedIndexChanged="classeDdl_SelectedIndexChanged"35 Width="150px">36 <asp:ListItem Selected="True">Tutti</asp:ListItem>37 </asp:DropDownList></td>38 </tr>39 <tr>40 <td style="width: 100px; text-align: right">41 Famiglia</td>42 <td style="width: 100px; text-align: left">43 <asp:DropDownList ID="famigliaDdl" runat="server" AutoPostBack="True" OnSelectedIndexChanged="famigliaDdl_SelectedIndexChanged"44 Width="150px">45 <asp:ListItem Selected="True">Tutti</asp:ListItem>46 </asp:DropDownList></td>47 </tr>48 <tr>49 <td style="width: 100px; text-align: right">50 Genere</td>51 <td style="width: 100px; text-align: left">52 <asp:DropDownList ID="genereDdl" runat="server" AutoPostBack="True" Width="150px">53 <asp:ListItem Selected="True">Tutti</asp:ListItem>54 </asp:DropDownList></td>55 </tr>56 </table>57 <br />58 <asp:Button ID="OkButton" runat="server" OnClick="OkButton_Click" OnClientClick="clickbtn()"59 Text="OK" />60    61 <asp:Button ID="CancelButton" runat="server" Text="Cancel" OnClientClick="clickbtn()" />6263 </ContentTemplate>646566 </asp:UpdatePanel>676869 <asp:Button ID="OkButton2" runat="server" Style="visibility: hidden"/>70 </asp:Panel>

OkButton2 is a button that is clicked by a javascript function, to close the popup.

In the page there are some update panel.


Anyone?

Help meCrying


I'm having the same issue with HoverMenuExtender and PopupControlExtender.
This sounds a lot likehttp://forums.asp.net/thread/1441672.aspx - try upgrading to Beta 2/61121.

Monday, March 26, 2012

Modal Popup extender need help PLEASE - URGENT

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 NotificationList

Inherits System.Web.UI.UserControl

Dim cnRetailCommerceAs SqlConnection =Nothing

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

Dim dsConsManageAsNew System.Data.DataSet

Dim cmdSelectAsNew SqlCommand

Dim parmCLocationAsNew SqlParameter("@.P_CLOCATION", Data.SqlDbType.VarChar, 50)

Dim daConsManageAsNew SqlDataAdapter

Dim tblRowAs TableRow

Dim tblCellAs TableCell

Dim 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.Value

Case"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.DataRow

dvConsManage.RowFilter ="EMail='" & Session("EMAIL").ToString &"'"

If dvConsManage.Count = 0Then

tblRow =New TableRow

tblNotifications.Rows.Add(tblRow)

tblCell =New TableCell

tblCell.Text =" "

tblRow.Cells.Add(tblCell)

tblCell =New TableCell

tblCell.Text ="<a href='javascript:fLoadRecipDialog(" & Chr(34) &"0" & Chr(34) &");'>Add Me</a>"

tblRow.Cells.Add(tblCell)

tblCell =New TableCell

tblCell.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").Rows

If drRow("UserManageable") =TrueThen

tblRow =New TableRow

tblNotifications.Rows.Add(tblRow)

tblCell =New TableCell

tblCell.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 TableCell

tblCell.Text ="<a href='javascript:fLoadRecipDialog(" & Chr(34) & drRow("NotificationID") & Chr(34) &");'>" & drRow("FirstName") &" " & drRow("LastName") &"</a>"

tblRow.Cells.Add(tblCell)

tblCell =New TableCell

tblCell.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 TableRow

tblNotifications.Rows.Add(tblRow)

tblCell =New TableCell

tblCell.Text = hdnAction.Value

tblRow.Cells.Add(tblCell)

tblCell =New TableCell

tblCell.Text = Now.ToString

tblRow.Cells.Add(tblCell)

tblCell =New TableCell

tblCell.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()

EndSub

EndClass


Bump - I have a huge need to get this working. can someone please help?

Modal popup extender inside another modal popup extender

Hi all,

I would like to know if this is possible.

Lets say a have a page with modalpopup extender and with update panel.

Onto that modal popup extender I dynamically and with async postback load a UserControlA. That UserControlA also contains modal popup extender and updatepanel, which loads UserControlBdynamically (sort of modal popup inheritance:) )


Is this at least possible in theory? To show another modalpopup in the first modalpopup? Because right now, trigerring modalpopup in UserControlA, modalpopup in page closes

UI would be something like this:

Modalpopup image

The problem is that i was designing everything with user controls, and then reusing them. And now there is such a problem:)

Hi,

I think it's quite possible theoretically. Please try to implement it as you planed first, and feel free to ask if you meet any problem.

Saturday, March 24, 2012

Modal Popup questions...

Hi there, i am using the modal popup and a couple of things i am trying to do arent quite working.

I have the a panel for my modal popup and an update panel within the panel...i am planning to have a multiview inside this updatepanel but...

1. How can i make the TargetControl still post back (to do some binding on the panel and get the correct view.).
2. I have the OK button on the panel posting back which is fine, i have removed the OKButton property, when not in an update panel the whole page posts back and page reset...however i dont want the whole page to post back...only the panel. So how can i clear the background style of modal popup so things are clickable again?
I can see my other updatepanels refreshing as i want when OK is clicked and the modal popup panel goes away but the background style stays...

Thanks

Steve

I think if i can remove the background style from js that will be number 2 done....any ideas?

for number 1:
i added some js to force postback

var postBack =new Sys.WebForms.PostBackAction();

postBack.set_target("ctl00_MainContentHolder_btnAccAdd");

postBack.set_eventArgument('');

postBack.performAction();

but the modal panel disappears and the background style is still there...although i was just hoping for the update panel within the modal panel to postback, wasnt expecting it to affect the modal panel.


Hi Steve,

It's not quite as simple as changing the background style. What we do is place a transparent div on top of all your controls (making them unclickable) as well as hide certain controls (like drop down lists) that show through this transparent div.

I really don't understand what you're asking here though. Why is your OK button (the thing that should close the modal popup) trying to update the popup instead? Perhaps you could provide a little more background information.

Thanks,
Ted

Hi Ted, thanks for posting.

Apologies for taking a long time to reply...i have been away for a couple of days (however i thought i activated email notification...clearly not!)

I have been having a play with the js code and taken some/added my own to do what i want to do.... before Atlas control kit i really knew diddley squat about js so its great to be able to learn from your stuff... :-)
What i meant by my OK button...i wanted the ok button to postback as if it were a normal button so it could update other updatepanels on the page (behind the background div), the only time it would postback was to postback the whole page and so rendering the popup as display=none again.
I also wanted serveral buttons on the page to popup the same modal panel showing different index on the multiview...thats why i wanted the TargetControl to post back.

Now i have my own js file...i have a couple of probelms
i am trying to get the drop shadow to work, i have copied the exact code from the toolkit but i get an object required error, i have this at the top of my file, Type.registerNamespace('AtlasControlToolkit'); is there something else I need to do for this code
_dropShadowBehavior = new AtlasControlToolkit.DropShadowBehavior(); to work??


Thanks
Steve


Hi Steve,

I think for your OK button the answer is to wrap it in anUpdatePanel. Any server side handler for it will still fire, and any updates you do to other content in otherUpdatePanels will be applied as well (i.e. if you update one of them, you're actually updating all of them). To get several buttons to open the sameModalPopup and have the contents of that popup determined by the button that launched it is a little tricker. The easiest solution is to create seperate popups. A slightly harder solution (but with less duplicated markup) would be to have each button's onclick handler prepare any expected content in the ModalPopup. I'm not terribly sure if you can get away with this using aMultiView though because it might not dump out all the markup for its views to the client. The slightly-harder-but-most-appropriate-for-your-situation solution is as follows:
1. Put an<asp:Button ... /> on your form withStyle='display: none;' to create a hidden button that gets sent to the client
2. Use that hidden button as the target control for yourModalPopup
3. Set anID="SomeID" on yourModalPopupProperties
4. Create regular server side handlers for all the buttons you want to launch the popup (making sure they're wrapped in anUpdatePanel of course)
5. In each of those server side handlers, get theMultiView all setup for that button
6. UseRegisterStartupScript to force yourModalPopup to display (using something like$object('SomeID')._show();)
There are examples of step 6 in otherforum posts, and we're also looking at ways to make it a lot easier to show/hide aModalPopup from the server for an upcoming release.

As for theType.registerNamespace('...') blowing up, that sounds like the "Atlas" libraries haven't been included first. Are you including your custom script at the top of the page? If so, the proper way to include a custom "Atlas" script like that is to add a reference as a child of yourScriptManager.

Thanks,
Ted


Hi Steve,

There are a lot of people trying to do the same thing withModalPopup, so I thought I'd create a sample (since those steps 1-6 aren't the clearest things in the world to follow). Unfortunately after talking with David (theModalPopup expert... and author, for that matter), the approach I described doesn't really work when you're inside anUpdatePanel. TheRegisterStartupScript code you send down will be run before everything's been set up properly... so to get it working we'll use the same approach but not actually show the popup until theUpdatePanel says it's done with the partial postback (I actually left in the old approach too, should anyone looking at this want to use it without anUpdatePanel - it's the script that is sent down ifScriptManager.IsInPartialRenderMode == false) by hooking into itspropertyChanged event. Here's a full example showing what to do:

<%@. Page Language="C#" %><%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> private void Button1_OnClick(object sender, EventArgs args) { Content.Text = "I was setup by Button1!"; ShowModalPopup(); } private void Button2_OnClick(object sender, EventArgs args) { Content.Text = "I was setup by Button2!"; ShowModalPopup(); } private void ShowModalPopup() { ModalPopupProperties popup = MyModalExtender.GetTargetProperties(Target); if (popup != null) { string script = ScriptManager.IsInPartialRenderingMode ? string.Format("showModalPopup('{0}', '{1}');", ScriptManager.PageRequestManagerID, popup.ID) : string.Format("function pageLoad() {{ var modal = $object('{0}'); if (modal) {{ modal._show(); }} }}", popup.ID); Page.ClientScript.RegisterStartupScript(typeof(ModalPopupExtender), "open", script, true); } }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>ModalPopup Demo</title> <style type="text/css"> .modalBackground { background-color:Gray; filter:alpha(opacity=70); opacity:0.7; } .modalPopup { background-color:#ffffdd; border-width:3px; border-style:solid; border-color:Gray; padding:3px; width:250px; } </style></head><body><form runat="server"><div> <script language="javascript" type="text/javascript"> var showPopupHandler = null; function showModalPopup(pageRequestManagerID, popupID) { var pageRequestManager = $object(pageRequestManagerID); if (pageRequestManager) { var onUpdatePanelPropertyChanged = function(sender, eventArgs) { if ((eventArgs.get_propertyName() == "inPostBack") && !pageRequestManager.get_inPostBack()) { var modal = $object(popupID); if (modal) modal._show(); pageRequestManager.propertyChanged.remove(showPopupHandler); showPopupHandler = null; } }; showPopupHandler = Function.createDelegate(this, onUpdatePanelPropertyChanged); pageRequestManager.propertyChanged.add(showPopupHandler); } } </script> <atlas:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" /> <atlas:UpdatePanel ID="Update" runat="server" Mode="Always"> <ContentTemplate> <asp:Panel ID="Popup" runat="server" CssClass="modalPopup" style="display: none"> <asp:Label ID="Content" runat="server" Text="Original Content" /><br /> <asp:Button ID="OK" runat="Server" Text="OK" /> <asp:Button ID="Cancel" runat="Server" Text="Cancel" /> </asp:Panel> <asp:Button ID="Target" runat="server" style="display: none" /> <asp:Button ID="Button1" runat="server" Text="Button 1" OnClick="Button1_OnClick" /><br /> <asp:Button ID="Button2" runat="server" Text="Button 2" OnClick="Button2_OnClick" /><br /> <atlasToolkit:ModalPopupExtender ID="MyModalExtender" runat="server"> <atlasToolkit:ModalPopupProperties ID="MyPopup" TargetControlID="Target" PopupControlID="Popup" BackgroundCssClass="modalBackground" DropShadow="true" OkControlID="Ok" CancelControlID="Cancel" /> </atlasToolkit:ModalPopupExtender> </ContentTemplate> </atlas:UpdatePanel></div></form></body></html>
Again, we're looking at making this a LOT easier with updates in our next release.

Thanks,
Ted


I get this error on the line containing this information.

Page.ClientScript.RegisterStartupScript(typeof(ModalPopupExtender),"open", script,true)

This is the error message.

Error 'ModalPopupExtender' is a type and cannot be used as an expression. c:\inetpub\wwwroot\XX\SecurityTest.aspx.vb 25 60

Any ideas?
Thanks


Here you go Greg

Page.ClientScript.RegisterStartupScript(ModalPopupExtender.GetType,"open", script,True)


Thanks Michael worked perfectly.

And thanks Ted for the example you are a life saver.

-Greg


Thanks Ted.

Thats just what i was after....thanks for the time put in to resolve this.

Again apologies for the delay...my email notification clearly isn't working.

Steve


Is it possible to keep the modal popup open when clicking 'ok'

I have a validation control in the popup panel and would like to display the error message in the modal popup if a textbox value is not ok.

The user will then be able to correct the input.

thanks


Hi everyone,

Thenewest release of the Toolkit (now available on CodePlex) allows you to show/hide from the server using the following:

 ModalPopupProperties popup = MyModalExtender.GetTargetProperties(MyControl);if (popup !=null) popup.Show();// Or call popup.Hide();

Thanks,
Ted


Hi RolfN,

I'd recommend you just have a seperate button (possibly hidden usingstyle='visibility: hidden;') as your OK button and then just a regular button with "OK" as its text. You can then call.click() on the real button client side or.Hide() on yourModalPopupProperties server side.

Thanks,
Ted

Hi!

Scenario:
A user choose a row in gridview and gets details from det row in a formview in modalpopup.

I tried to put the codelines above in my code like this:

protectedvoid gridview_SelectedIndexChanged(object sender,EventArgs e)
{
ModalPopupProperties popup = ModalPopupExtender1.GetTargetProperties(up1);
if (popup !=null)
popup.Show();// Or call popup.Hide();
}
Up1 is a updatepanel that surrounds the gridview.

Problem is that the modal popup triggers on every event on the gridview.
eg. when I sort.

thanks


Hi santon,

I don't think this is a bug because sorting does change the selected index. For an example of how to useModalPopup in aGridView, take a look at David'sblog post.

Thanks,
Ted

Modal Popup Validation

I have 2 required field validators in an update panel in my modal popup panel. I use Matt Gibson's Validator dll and tag mapping for validators inside update panels. However, in this modal popup, postback is not prevented. As you can see, I give the modal popup no control over the save button. Yes, the validation group is the same on the validators and the button. Yes, the validation appears onblur. With the errormessage displayed, if I click on the save button, the postback goes through. How do I fix this?

<ajaxToolkit:ModalPopupExtender runat="server" ID="mpe_fix"BackgroundCssClass="modalBackground"CancelControlID="btn_Cancel"PopupControlID="pnl_fix"TargetControlID="hdn_dummy" /><asp:Button runat="server" ID="btn_save"Text="Save"ValidationGroup="fix"CausesValidation="true" />

Bump.

Modal window with update panel stops working after its shown and hidden once

I'm having some trouble with the modal window tool. It behaves perfectly the first time i show it, and the first time I hide it, then although the updatepanel postback behaviour still works (and the text field in the example below is still updated) the modal window doesn't fire the onOkScript or hide as it does the firsttime.

Does anyone have any ideas?

<div><asp:LinkButtonID="lbCommunityProfile"runat="server">Community Profile</asp:LinkButton></div><atlas:UpdatePanelID="updatePanel2"runat="server"Mode="Always"><ContentTemplate><asp:LabelID="lTest"runat="server"Text="NoneSet"></asp:Label></ContentTemplate></atlas:UpdatePanel><atlasToolkit:ModalPopupExtenderID="ModalPopupExtender1"runat="server"><atlasToolkit:ModalPopupPropertiesTargetControlID="lbCommunityProfile"PopupControlID="Panel1"BackgroundCssClass="modalBackground"DropShadow="true"OkControlID="OkButton"onOkScript="__doPostBack('ctl00$ContentPlaceHolder$lbCommunityProfile','');alert('go');"CancelControlID="CancelButton"/></atlasToolkit:ModalPopupExtender><asp:PanelID="Panel1"CssClass="modalPopup"runat="server"><atlas:UpdatePanelID="updatePanel1"runat="server"Mode="Conditional"><ContentTemplate>

This is panel 1

<asp:TextBoxID="tbTest"runat="server"></asp:TextBox><asp:ButtonID="OkButton"runat="server"Text="OK"OnClick="OkButton_Click"UseSubmitBehavior="false"></asp:Button><asp:ButtonID="CancelButton"runat="server"Text="Cancel"></asp:Button></ContentTemplate></atlas:UpdatePanel></asp:Panel>

and in the aspx.cs file

protectedvoid OkButton_Click(object sender,EventArgs e)

{

string str = tbTest.Text;

lTest.Text =

"set" + tbTest.Text +"end";

}

Also just wondering what the javascript is to close a modal window. I understand you can use the ok and cancel buttons. I'd like to have a x in the top right of my window and have that close.


Is this with the June CTP of Atlas?
yes the most recent ctp

yes the july ctp


The June CTP is currently (this may change very soon) the most recent Atlas release. It has a problem whereby UpdatePanel updates under Firefox break all extenders. It sounds like you're hitting this problem. Atlas is aware of it and should have a new release out soon to correct the problem. Thanks for your patience!

Just wondering if any progress has been made on this topic?


The July CTP of Atlas fixes the problem mentioned above.
I am experiencing this problem with the July CTP. Appears to notnecessarilybe fixed. I've got a lot of other things goin on in the same page... I'm going to try and issolate the issue.

Wednesday, March 21, 2012

ModalPanel - How can I us AJAX instead of postback to update database ?

I'm new to AJAX and this suite of tools. I have a page that when a user clicks a link button my ModalPanel with various input fields appears. When the user clicks the okay button I want to make an async call instead of having the page post back. I need to be able to call one of my business objects defined in C# so what is the best way to do this?

If you can provide details or even a small example I would appreciate it.

My code behind method looks like this:

void OnClick(...)

{

Broker b = new Broker();

b.name = NameTextBox.Text;

b.account = AccountTextBox.Text;

b.Save();


}

Why not just wrap the modalpopup in an updatepanel and let the page postback? It is easier then to have access to the server controls from the form and have full interaction with the other page elements during the postback in case you want to update other stuff on the page.

What benefits are you looking for by not posting back?

Jason

Modalpopup

I am trying to use the ModalPopup control on a page that has a couple of update panels. However, all controls are still enabled ( with the exception of dropdownlists which dissappear).

This is causing a huge problem, because if the button that triggers the popup is click more than once, when you close the popup using the OK/Cancel buttons, the dropdown lists do not come back as the control thinks there are other insatnces hanging around but are not visible on the screen.

Any ideas.

Thanks

Sorry. My Fault. Had not given the background attribute a css class.

ModalPopup & UpdatePanel

OK, so my first question is, should it be possible to call an update panel from the modal popup?

I think I have a pretty common task I'm going after here. On the page I have a repeater that displays all the information in the table. Then under that table, I have a spot where you can add new entries to the table. The update panel works perfectly from there but when I attempt to call the same update panel from the OK button in my modal it doesn't do anything.

So here is the code that is important:

1[WebMethod()]2public void saveModal(string strItemID,string strItemDesc,string strItemAmount,string strItemLocked,string strItemOrder)3 {4 SqlDataAdapter daItemsEdit =new SqlDataAdapter("SELECT * FROM tblIssueItems WHERE itemID = '" + strItemID +"' AND generation = '" + strCurrentGen +"'", myConn);5 daItemsEdit.Fill(dsEdit,"tblIssueItems");6 DataTable tblIssueItemsEdit = dsEdit.Tables["tblIssueItems"];78 DataRow rowEdit = tblIssueItemsEdit.Rows[0];910 rowEdit["sortOrder"] = strItemOrder;11 rowEdit["itemDescription"] = strItemDesc;12 rowEdit["amount"] = strItemAmount;13 rowEdit["lock"] = strItemLocked;1415 SqlCommandBuilder sqlBuilder =new SqlCommandBuilder(daItemsEdit);//Used for SQL Connections16 daItemsEdit.UpdateCommand = sqlBuilder.GetUpdateCommand();17 daItemsEdit.Update(dsEdit,"tblIssueItems");1819//Update Table20 dbUnlocked();21 }2223public void dbUnlocked()24 {25//Grab All Unlocked Items26 SqlDataAdapter daItems =new SqlDataAdapter("SELECT * FROM tblIssueItems WHERE issueID = '" + strCurrentIssue +"' AND generation = '" + strCurrentGen +"' AND lock <> '1' ORDER BY sortOrder, itemID", myConn);27 daItems.Fill(dsRep,"tblIssueItems");2829if (dsRep.Tables["tblIssueItems"].Rows.Count != 0)30 {31 pnlUnlocked.Visible =true;32 repUnlocked.DataSource = dsRep.Tables["tblIssueItems"].DefaultView;33 repUnlocked.DataBind();34 }35else36 {37 lblNoUnlocked.Visible =true;38 }3940 dsRep.Clear();41 }4243public void btnSubmit_Click(object sender, EventArgs e)44 {45if (Page.IsValid)46 {47//Determine Next ItemID Number48int intItemID = Convert.ToInt32(strLastIDUsed);49 intItemID++;5051//Add New Record52 SqlDataAdapter daAdd =new SqlDataAdapter("SELECT TOP 1 * FROM tblIssueItems", myConn);53 daAdd.Fill(dsAdd,"tblIssueItems");5455//Create a data row56 DataRow newRow = dsAdd.Tables["tblIssueItems"].NewRow();5758 newRow["issueID"] = strCurrentIssue;59 newRow["generation"] = strCurrentGen;60 newRow["itemID"] = intItemID;61 newRow["sortOrder"] = ddlSortOrder.SelectedItem.Value;62 newRow["ItemDescription"] = txtDesc.Text;63 newRow["Amount"] = txtAmount.Text;6465//Add the datarow to the dataset66 dsAdd.Tables["tblIssueItems"].Rows.Add(newRow);6768//Use Command Building to create an insert command69 SqlCommandBuilder sCB =new SqlCommandBuilder(daAdd);7071//Update the DB with values72 daAdd.Update(dsAdd,"tblIssueItems");7374//------------------------75 //Update Last Item ID Used Column76 SqlCommandBuilder sCBU =new SqlCommandBuilder(daIssue);77 daIssue.UpdateCommand = sCBU.GetUpdateCommand();7879 tblIssue.Rows[0]["lastItemID"] = intItemID;8081 daIssue.Update(dsAll,"tblIssue");8283//Update Table84 dbUnlocked();85 clearAddArea();86 }87 }
So in the code above, everything in the WebMethod.SaveModal works exactly as designed. I included my other button on the page that works as designed so you could see that as well. On the other side of the code, here is what I did for the updatePanel.
  
1 <atlas:UpdatePanel runat="server" id="up1">2 <triggers>3 <atlas:controleventtrigger controlid="btnSubmit" eventname="Click" />4 <atlas:controleventtrigger controlid="OkButton" eventname="Click" />5 </triggers>6 <ContentTemplate>7<asp:Panel runat="server" ID="pnlUnlocked" Height="200" ScrollBars="auto" Visible="false">8 <asp:repeater ID="repUnlocked" runat="server">9 <itemtemplate>10 ...11 <a href="javascript: myModalPop('<%# DataBinder.Eval(Container.DataItem, "itemID") %>'); $object('MP1')._show();">Edit</a>12 ...13 </itemtemplate>1415 <FooterTemplate>16 </table>17 </FooterTemplate>18 </asp:repeater>19 </asp:Panel>20 </ContentTemplate>21 </atlas:UpdatePanel>
Thanks to anyone who can help me out.
Richard 

Hi Richard,

Could you also include the markup for your modal popup? It would help in trying to diagnose this.

Thanks,
Ted

<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" style="display:none"> <atlas:updatepanel id="up" runat="server" mode="Always" rendermode="Inline"> <contenttemplate> <br /> <h4>Edit Record</h4> <table width="350" width="100%" border="0"> <tr> <td>Sort Order</td> <td><asp:DropDownList runat="server" Width="100%" ID="ddlSortOrderE" CssClass="FormInput"><asp:ListItem Text="1" Value="1" /><asp:ListItem Text="2" Value="2" /><asp:ListItem Text="3" Value="3" /><asp:ListItem Text="4" Value="4" /><asp:ListItem Text="5" Value="5" /><asp:ListItem Text="6" Value="6" /><asp:ListItem Text="7" Value="7" /><asp:ListItem Text="8" Value="8" /><asp:ListItem Text="9" Value="9" /><asp:ListItem Text="10" Value="10" /></asp:DropDownList></td> </tr> <tr> <td>Item Description</td> <td><input type="text" id="txtDescE" class="FormInput" value="" /></td> </tr> <tr> <td>Amount</td> <td><input type="text" id="txtAmountE" class="FormInput" value="" /></td> </tr> <tr> <td>Lock?</td> <td><input type="checkbox" id="chkLockedE" class="formInput" /></td> </tr> </table> <center> <asp:Button runat="server" ID="OkButton" Text="OK"></asp:Button> <asp:Button runat="server" ID="CancelButton" Text="Cancel"></asp:Button> </center> <input type="hidden" id="hidRegID" value="" /> </contenttemplate> </atlas:updatepanel> </asp:Panel>

Here is the code. Thanks for any help you can provide. Thanks.

Richard


Oh, here is another strange one for everyone that I ran into today.

So I have the updatepanel that works with no issues. If I then try to click the edit button to a newly added record the modal popup appears but the OK button never closes it. That will be issue number #2 for me to figure out.

Also, if you need/want to see the page/error in action, please just let me know and I can post a link to where the page can be found.

Thanks for all of your hard work (and that is for everyone). The Atlas project and controls are some of the most exciting stuff I have seen in web development for a while.

Richard


has anyone figured out a solution for this one yet?

I was never able to get a fix/resolve to this one. The good news for me was, the project that I was using this in was canceled so I got to put it on the back burner.

Richard


I don know that the ok and cancel buttons cannot be within the updatepanel to work.

ModalPopup - Web Service Failed - DynamicServiceMethod

I was trying to update the ModalPopup dynamically passing the topics section of an article to it.

I believe this is related to my DynamicServiceMethod. I test this out with C# and it worked fine, but would like to convert it to VB.

C# Code

<script runat="server">
[System.Web.Services.WebMethod()]
public static string GetContent(string contextKey)
{
string sIndName = contextKey;
return sIndName;
}
</script>

Method

VB CODE

<script runat="server">
<System.Web.Script.Services.ScriptMethod()> _
<System.Web.Services.WebMethod()> _
Public Function GetContent(ByVal contextKey) As String
Dim topics As String = contextKey
Return topics
End Function

</script>

This is the code

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:v1ConnectionString %>"
SelectCommand="SELECT [TITLE], [TOPICS] FROM [AGEXPRESS]"></asp:SqlDataSource>
<asp:Repeater DataSourceID="SqlDataSource1" ID="Repeater1" runat="server">
<HeaderTemplate>
AG</HeaderTemplate>
<ItemTemplate>
<div class="title">
<asp:LinkButton ID="myLabel" Text='<%#Eval("TITLE") %>' runat="server"></asp:LinkButton>
<cc1:ModalPopupExtender

BackgroundCssClass="background"

DropShadow="true" EnableViewState="true"
PopupControlID="Panel2" CancelControlID="CancelButton" TargetControlID="myLabel"
ID="ModalPopupExtender" DynamicControlID="Label10" DynamicServiceMethod="GetContent"
DynamicContextKey='<%#Eval("TOPICS") %>' runat="server">
</cc1:ModalPopupExtender>
</div>
</ItemTemplate>
</asp:Repeater>
<asp:Panel ID="Panel2" runat="server" Width="300px" BackColor="BlanchedAlmond" BorderColor="Black">
<h2>
Topcis:</h2>
<asp:Label ID="Label10" runat="server" Text="Label"></asp:Label>
<div align="center">
<asp:LinkButton ID="CancelButton" runat="server">Close</asp:LinkButton>
</div>
</asp:Panel>
</form>

IF i don't find a solution then i can use the C#, but would really like this to be formatted in converted to VB (would be consistent with the site)

Please help.

You are missing the "Shared" keyword on the method. PageMethods are supposed to be Static/Shared.

Thanks! It worked.



Thanks it worked!

Hi

the property DynamicContextKey
what is useful?