Showing posts with label cant. Show all posts
Showing posts with label cant. Show all posts

Wednesday, March 28, 2012

modal popup error - cant set focus to control

Hi

My webpage contains a modal popup. I am using the atlas release - the june ctp i think

I'm getting an error on my webpage if I view it in Internet Explorer 6. This is the error

Can't move focus to the control because it's invisible not enabled or of a type that does not accept focus

I get this error on page load. Everything works fine but naturally i dont like the error message.

I would really appreciate it if you could take a look and shed some light on it for me

http://84.92.22.217/UChoose/frames.aspx

thanks a lot

andrea

I checked your website and did not see any error message. Everything works fine.
No issues here with IE6 or Firefox 1.5.0.8.

Modal Popup Extender and set focus

I want to set focus on a textbox inside the modal popup extender when it is made visible and I cant for the life of me find an appropriate way to do this!

The popupcontrol is not good because when I add the attribute onclick it gets run before the textbox is made visible!

Any clues?

Cheers

Ross

Sorry, I hate to bump this but could really do with knowing how this can be done.

Ross


You can try registering a clientside startup script that sets focus to the text box. Or you can use the clientside script to open the modal popup and then set the focus.

#1:

page.ClientScript.RegisterStartupScript(me.getType(), "setfocus", "<script language=""javascript"">$get('textbox1').focus();</script>")

#2:

<script language="javascript">

function openModal(){

$find('modalpopupextender1').show();

$get('textbox1').focus();

}

</script>

The ids of the mpe and the textbox will need to be the client rendered id, so if you are using a masterpage or if this is in a user control, you will need to get the clientid from the server or from the output of the page prior to implimenting the code.

Let me know if need anyhting else.

-Alan


the solution in this article worked for me (although i would like to see something much better)

http://www.aspdotnetcodes.com/ModalPopup_Postback.aspx

then you add something similar to the following in the Page_Load event:

btn.Attributes.Add("onclick","fnSetFocus('" + control.ClientID +"');");


hi

go to the following link

http://forums.asp.net/t/1103365.aspx

Wednesday, March 21, 2012

ModalPopUp

I have have a datalist with a LinkButton on it. I want the LinkButton to be myTargetControlID. I cant remember the asp code to find the control on the datalist. Thanks.did you figure this out?

is it by any chance

yourDataList.FindControl("yourLinkButton") ?

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

ModalPopup + Postback

Hi,

I've utilized the modalPopup control - and it works well - apart from the fact I can't figure out a way for it to postback?!

Any ideas?

Thank you.

anyone?

http://blogs.msdn.com/delay/archive/2006/09/19/762609.aspx

is it the one that you're looking for?


that's populating it based on a webservice.

i want server side actions to be performed once a user clicks a button in the modal box.

anyone else? this is quite urgent :(


what do you mean by performing server-side actions? why don't you call it through web service then?

i just didnt want to have to build a webservice - just in order to append some data to a database, which i wanted to handle through what seemed like a simple postback :(


Here is what i have so far.

A page with a modal extender.

If i link OkControlID to the button I want to perform any action - then it doesn't postback, and hence nothing happens.

If i don't link it using the above - then the action executes - BUT - modal extender continues to sit there, not closing.

So perhaps what I am after now is a way to close it? or link my button to postback, AND to close the modal popup.

any ideas?

thank you.


Hi RomanT,

Sounds like you should not use OkControlID, and then include MyModalExtender.Hide() at the end of your server side event handler.

Thanks,
Ted