Showing posts with label outside. Show all posts
Showing posts with label outside. Show all posts

Wednesday, March 21, 2012

ModalPopup - Logic to databind control outside of modal

Hello All,

I am have a modal popup that appears and takes some input from a user. The user can then hit "submit" and logic behind the onclick for the submit button validates the input, and, if valid, submits that input to a database to be inserted.

this works great. I have update panels inside of the modal doing the work, and the user can submit as many entries as the want without the modal closing.

However, in the same method, after I update the database, I call another method to get new data from the database, and to re-databind the control they were looking at before the modal opened.

But the control (a listbox) does not change. It is not being databound. I even tried clearing the items from the listbox, and the items still remain.

I am not sure why the listbox is not updating from the logic. I would assume its not becuase the control is not in the same update panel, or the control is not in the modal popup. The listbox control is in its own update panel.

So I am trying to figure out how to make a control that is in another update panel, not in the modal popup update with logic triggered in the modal popup. I've thought about using the "onOKScript" in the modal popup properties to use some sort of JS to re-databind the control, but I am not sure how to do this.

Any ideas would be extreamly helpful

Thanks

-Shane

Hi Shane,

What you're describing should work. Code in an event handler invoked via oneUpdatePanel should be able to update controls in anotherUpdatePanel. Perhaps you can post a simple demo showing what's not working for you and we can take a look.

Thanks,
Ted

Modalpopup - Web Service Call Failed

My web service works great when I call it outside of the modalpopupextender. However, I can't seem to access the asmx page at all when using the modalpopup dynamic properties. I keep receiving errors stating both "web service call failed: 12030" & "web service call failed: 500" randomly. What am I missing here? Any help you can lend to my problem would be greatly appreciated!

<ajaxToolkit:ToolkitScriptManagerID="ScriptManager1"runat="server">
<Services>
<asp:ServiceReferencepath="~/GetCity.asmx"/>
</Services>
</ajaxToolkit:ToolkitScriptManager>

<asp:GridViewID="GridView1"runat="server"DataKeyNames="FILENAME"AutoGenerateSelectButton="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:linkButtonID="hlnkOrders"runat="server">Selectlnk</asp:linkButton>
<ajaxToolkit:ModalPopupExtenderID="ModalPopupExtender3"runat="server"
OKControlID="btnOK"
PopupControlID="Panel3"
TargetControlID="hlnkOrders"
DynamicServicePath="GetCity.asmx"
DynamicServiceMethod="LookupCityCode"
DynamicControlID="lblhidden"
DynamicContextKey='<%=eval("FILENAME") %>'
BackgroundCssClass="modal"
DropShadow="true">
</ajaxToolkit:ModalPopupExtender>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<AlternatingRowStyleBackColor="#FFFFC0"BorderColor="#004000"BorderWidth="1px"/>
</asp:GridView>

<asp:Panelrunat="server"ID="Panel3"BackColor="AliceBlue">
<asp:LabelID="lblHidden"runat="server"></asp:Label><br/><br/>
<asp:Buttonrunat="server"ID="btnOK"Text="OK"/>
</asp:Panel>

Imports System.Web.Script.Services.ScriptServiceAttribute
Imports System.Web.Script.Services.ScriptMethodAttribute

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
PublicClass GetCity

Inherits System.Web.Services.WebService

Private strUserNameAsString =""
Private strServerNameAsString =""
Private strPasswordAsString =""
Private wAttachmentPathAsString =""

<WebMethod()> _
PublicFunction LookupCityCode(ByVal contextKeyAsString)AsString

'do some stuff
ReadExcelOrder(wattachmentPath & contextKey)
LoadParameters()

End Function

PrivateFunction ReadExcelOrder(ByVal FileNameAsString)AsString

'do some stuff

End Function

PrivateSub LoadParameters()

'do some stuff

End Sub

I'll answer my own question here. Once I added the property System.Web.Script.Services.ScriptService to the webservice, it works!

<WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Script.Services.ScriptService()> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
PublicClass GetCity


Even after adding


[System.Web.Script.Services.ScriptService]


 to my service it is not working. Please help