I using following script in my project. Once click the button and there will open a pop up window. But "Page.ClientScr ipt.RegisterSta rtupScript" script seem NOT working in update panel. After remove Update panel and it is working properly. Any solution? - Page.ClientScript.RegisterStartupScript(Me.GetType(), "openpopup", "window.open('" & "child.aspx" & "','ChildWindow','height = 520, width = 730,status=no,location=no,directories=no, resizable = 1, scrollbars=yes, left=75, top=75')", True)
9 42791
Instead of using RegisterStartup Script use this Page.ClientScri pt.RegisterClie ntScriptBlock(a rguments) because RegisterStartup Script call the javascript before initallizing the DOM object while
RegisterClientS criptBlock call after the page DOM objects initialized. May this was the issue ... if not then tell ...
Sorry, is not working. Any other solution? Ur help will be appreciate.
I found out the issue about my problem, seem the Page.ClientScri pt.RegisterStar tupScript() not working when included Master page. Any solution?
Can u post the code here or related code here ?
finally i found out the problem, cause i'm using master page in my project, so the page will load twice. If i remove the master page, then it will load1 times. For the below mentioned script is working fine, but once i included master page for the below mentioned script, then it failed to run the script.Any method or solution to prevent master page load twice?
'working fine & properly without master page
Protected Sub OpenWindowWithU pdatePanel_Clic k(ByVal sender As Object, ByVal e As System.EventArg s)
Dim url2 As String
url2 = "ChildWindow.as px"
ScriptManager.R egisterClientSc riptBlock(Me, Me.GetType(), "openpopup" , "window.ope n('" & url2 & "','OpenChildWi ndowUsingUpdate Panel','height = 520, width = 730,status=no,l ocation=no,dire ctories=no, resizable = 1, scrollbars=yes, left=75, top=75');", True)
End Sub
Regards
Seng
finally i get the solution and solved my issue. The script ScriptManager.R egisterClientSc riptBlock() only working in .aspx and not working on .ascx. Anywhere thx for your help.
in the updatepanel use ScriptManager.R egisterStartupS cript Method..
it works in the ascx but the problem is for example you are passing this as an argument for the function example
ScriptManager.R egisterStartupS cript(this, typeof(Page), "OpenWindow","a lert('1'), "true);
try instead passing a control that is inside the updatepanel example
ScriptManager.R egisterStartupS cript(GridView1, typeof(Page), "OpenWindow","a lert('1'), "true);
use the following code it will dafinatley work
ScriptManager.R egisterStartupS cript(this.Page , this.Page.GetTy pe(), Guid.NewGuid(). ToString(), "alert('" "')", true);
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: sck10 |
last post by:
Hello,
I have the following sub in a class in my "App_Code" directory. The script
is for setting focus on a particular control, but I get the error,
"Name ClientScript Not declared". Also, I am using MasterPages. How do I
use "ClientScript.RegisterStartupScript" in a class?
Public Shared Sub SetFocusControl(ByVal FocusControl As Control)
Dim Script As New System.Text.StringBuilder
Dim ClientID As String = FocusControl.ClientID
|
by: Jon Paal |
last post by:
"Page.Clientscript" does not compile in assembly, with the error message "Reference to a non-shared member requires an object
reference". ...
what reference is it looking for ??????
class class1
public sub showimg()
Dim Response As HttpResponse = HttpContext.Current.Response
Dim theImage As New object
|
by: rodchar |
last post by:
hey all,
how can i get javascript procedure to execute as the very last thing before
the page is rendered?
Background: I have a DIV element inside an update panel. I am setting the
scrollLeft attribute of the DIV via javascript to move its contents left and
right, fine so far. The problem i'm having is when i postback to the server
via LinkButton that's inside the update panel the DIV scrollLeft attribute is
set back to 0.
|
by: HockeyFan |
last post by:
My function to get an alert box on the page isn't working.
Instead it puts in the bottom section of the page:
<script type="text/javascript">
<!--
This is a test// -->
</script>
The function is:
public static void MessageAlert_Create(ref System.Web.UI.Page
|
by: BiffMaGriff |
last post by:
Hello,
I am using VS2005 to code webapps using C#.
I am trying to call the javascript function alert() from my codebehind. I am using master pages and AJAX.
My page structure is as follows:
MasterPage.aspx
ScriptManager1
UpdatePanel1
| |
by: =?Utf-8?B?QW50b25pbw==?= |
last post by:
Hello, everyone. I am trying to open a popup page to display some
information but it is not working. Going through the code, no errors are
generated. It goes to the end of the code but it does not open the page. Am
I missing something? It's VS 2005.
Thanks,
protected void lnk_Comments_Click(object sender, EventArgs e)
{
|
by: =?Utf-8?B?TUNN?= |
last post by:
I have an asp.net page that contains an update panel. Within the update
panel, controls get added dynamically. During partial page post backs the
controls within the panel will change.
I have a javascript function that uses the ClientID of the dynamic controls
to perform certain operations on the client-side. With each partial page post
back, I dynamically recreate the javascript function using the ClientIDs of
the newly added controls....
|
by: BiffMaGriff |
last post by:
Hello,
I have a GridView that I put inside an update panel.
I have a control that attaches to the datasource of the gridview that filters the data, databinds the gridview and then updates the update panel that the gridview is in.
In my page render I put this so I could select a row by just clicking it.
protected override void Render(HtmlTextWriter writer)
{
|
by: anudu |
last post by:
Hi,
I have several update panels in my page. i want to call different javascript methods after the update panels are refreshed . i have attached the Sys.WebForms.PageRequestManager.getInstance().add_endRequest(MyMethod); at the end of the page and after an update panel is refreshed it is triggered.
that method is like MyMethod(sender,args) .
my problem is how can i identify which update panel is refreshed in side the MyMethod function?
...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |