Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Wednesday, March 28, 2012

UpdateProgress throws javascript error when contained in a Panel with visible = false

If you put a UpdateProgress control inside a Panel control with visible=false, you will get a javascript error that is cannot find the elements used for the update progress functionality.

Anyone, seen this before and know of a workaround?

I get the same result in a MultiView when the UpdateProgress control is contained in a view that is not the current view.

Thanks,

Ryan

When you set Visible equal to false the HTML contained therein does not get rendered at all. You shouldn't need to explicitly hide the UpdatePanel as it should hide itself unless an Atlas postback is in progress.

If you do need to hid it, set the style of the panel to "display: none" and leave it visible. That way the HTML will be rendered but not shown on screen.


Thanks for the suggestion on display: none. This will work for Panel controls, but it won't work for pages using the MultiView control. I guess I'll have to get rid of MultiView and create several separate panels wnd manually control which one is shown and which ones are diplay: none.

Monday, March 26, 2012

Updating an Update Panel on a page from Javascript

Hi All,

I am trying to update an update panel in a webform from Javascript. Form the documentation I think this might be possible using the Sys.Webforms.PageRequestManager but I have not been able to achieve this so far.

Any help would be greatful.

Hamlet

Hi Hamlet !

I been having the same wish ! After a lot of googeling the only way I found is to put an invisible button in a updatepanel and then raise it's postbackevent by registrering it's postbackevent in the scripthandler. Using the

$get('<%= YourControl.ClientID %>').click();

didn't work in FireFox and I supspect - but don't know for sure - not in ie7 ! One thing I wasted alot of time on was that the ValidateEventError but that was because I supplied an argument when registrering the clientscript in the scripthandler !

This feels like an uggly hack to accomplish what we want - but I didn't find any other way !

/MC24


I have been using

javascript:__doPostBack('__Page', 'some data' ) from the client.

This worked fine in the earlier release, but Beta 2.0 broke it because it started doing full postbacks instead of partial ones.

Evan


You can use the extender control I build.

http://daron.yondem.com

Updating an UpdatePanel with Javascript

I've done a lot of googling to find a fix for this - I've found lots of posts about people using something similar however no one gives a clear example of how to do it.

I've created a cut down version of what we're trying to do and you can clearly see the problem with it if you load the test file.

Ok first we have an update panel with a literal and an asp:button with a server onclick function to change the literal text when pushed. Then we have a standard HTML button with a javascript command to click the asp:button. What happens is when the html button is outside the update panel the whole page posts back. When it's inside the update panel it looks as if the update panel is refreshed but the literal valuedoesn't change. I say that the update panel looks like it's being refreshed because previously we had an updateprogress control on this page and it was showing that it was updating.

Anyone that knows what's going on or can suggest another solution?

<%@dotnet.itags.org. Page Language="VB" %><script runat="server" >Sub Page_Load(ByVal SenderAs Object,ByVal eAs EventArgs)If Not Page.IsPostBackThenliTesting.Text ="before postback"End IfEnd SubProtected Sub btnUpdate_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)liTesting.Text ="after postback"End Sub</script><!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head runat="server"><title>UpdatePanel Test</title></head><body><form runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /><asp:UpdatePanel runat="server" ID="UpdatePanel1"><ContentTemplate><asp:Literal runat="server" id="liTesting" /><asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" text="asp button" /></ContentTemplate></asp:UpdatePanel><input type="button" onclick="javascript: document.getElementById('<%=btnUpdate.ClientID%>').click();" value="html button" /></form></body></html>

No one's encountered this before?

*shameless bump*


Not having any problems with your sample. It fires the event and no refresh happens.

the only thing I can see doing is a little tweaking of your js

onclick="javascript: $get('btnUpdate').click();"

Kodo, please excuse my ignorance, but what is the meaning and syntax of the $get function? I must admit I never saw it before...


$get is a crossbrowser version (more or less) of document.getElementByID that is introduced with ASP.NET AJAX. I love it.


Thanks a million. I guess I'll start using it.

Kodo - thanks for reminding me about the $get call - we've only just switched from atlas to microsoft ajax yesterday and I just upgraded the old code from <atlas:... to <asp:...

I just tried the example again and it turns out the refresh ONLY happens in Firefox (I'm using 1.5.0.8 currently). It must be something to do with how Firefox determines if a user clicks the button or if a script does.


I've been trying to do something similar using a LinkButton (not standard form button).

$get works great, but the click event is not accesible using firefox 2. Im guessing this is a security thing, the fox is throwing an error

Error: $get("lnkDoPostBack").click is not a function
Source File:http://localhost:1667/AjaxDigiguru/Display/ImageEdit.aspx
Line: 82

I made a mini workaround that posts the page back if you have firefox, rather than causing an error.

Dim strScriptAsString ="function UpdateThumbnail(x,y,w,h) { " & vbNewLine & _

" if($get('lnkDoPostBack').click){ " & vbNewLine & _" $get('lnkDoPostBack').click();} else {" & vbNewLine & _" document.forms[0].submit()}" & vbNewLine & _" }"

Is there a more elegant fix? I'd love to call an UpdatePanel from a javascript function cross browser. I'm sure theres a real solution, rather than a bodge.


Hi,

I was seeing the same complete page submit on the HTML button in FireFox 1.5. As a test I modified things to manually do a __PostBack() on the asp:button within the panel and that seems to work as expected (a partial page update):

<%@.PageLanguage="VB" %>
<scriptrunat="server"
Sub Page_Load(ByVal SenderAsObject,ByVal eAs EventArgs)

IfNot Page.IsPostBackThen
liTesting.Text ="before postback"
EndIf

EndSub

ProtectedSub btnUpdate_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)

liTesting.Text ="after postback " & system.datetime.now().tostring()

EndSub

</script>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en">
<headid="Head1"runat="server">
<title>UpdatePanel Test</title>
</head
<body
<formid="Form1"runat="server"
<asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"/
<scriptlanguage="javascript">
function htmlPostBack()
{
__doPostBack('<%=btnUpdate.ClientId%>','');
}
</script>

<

asp:UpdatePanelrunat="server"ID="UpdatePanel1">
<ContentTemplate>
<asp:Literalrunat="server"id="liTesting"/>
<asp:ButtonID="btnUpdate"runat="server"OnClick="btnUpdate_Click"text="asp button"/>
</ContentTemplate>
</asp:UpdatePanel>

<

inputtype="button"onclick="htmlPostBack();"value="html button"/
</form>
</body>
</html
Shawn


Cheers Shawn. Works a treat, but bear in mind that the documentation says it's unsupported, you might need to change it when they release the final version!

Saturday, March 24, 2012

updating updatepanel in content page from javascript __doPostBack method.

Hi all,

Please help me on this issue..i have tried/looked every where but no solutions yet...I have two updatepanels, one in master page and another in content page.Then from master page i opening a modal window and after some calculation , i want to refresh/update my updatepanel in the content page.Now i have placed a hidden button inside the content page and made it as a trigger for the updatepanel in content page.I am able to call the click event of the hidden button and execute the code that i have written in the server side.But my problem is that my updatepanel in the content page is not getting updated with the changes..

thanks in advance

Have you tried UpdatePanel.Update() in code behind??


Try it like this:http://encosia.com/index.php/2007/07/13/easily-refresh-an-updatepanel-using-javascript/

Hi,

Actually to refresh my update panel on the parent page from popup widow , i'm using hidden button method.Let me explain it with example:

Here is my master page code

<%@.MasterLanguage="C#"AutoEventWireup="true"CodeFile="Menu.master.cs"Inherits="Menu" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>New Page</title>

<scripttype="text/javascript"language="javascript">

function CallFunction()

{

var obj =new Object();

obj.First = window;

window.showModalDialog('Forms.aspx', obj,'status:no; dialogHeight:155px;dialogWidth:510px; help:no; scroll:no; menubar:no; resizable:no')

}

</script>

</head>

<body>

<formid="form1"runat="server">

<asp:ScriptManagerID="Scriptmanager1"runat="server"></asp:ScriptManager>

<asp:UpdatePanelID="updMaster"UpdateMode="Conditional"runat="server">

<ContentTemplate>

<div>

<tableborder="2"cellpadding="0"style="background-color: #ff3300; width: 345px;" cellspacing="0">

<tr>

<tdalign="center"style="width: 164px; height: 26px;">

<inputtype="button"id="btn"name="btn"onserverclick="btn_Click"value="Click"runat="server"/>

</td>

<tdalign="center"style="height: 26px">

<asp:ButtonID="btnNew"Text='New'BackColor="#FFC080"OnClick="btnNew_Click"BorderColor="#FFC0C0"runat="server"Width="62px"/>

</td>

</tr>

</table>

</div>

<asp:contentplaceholderid="ContentPlaceHolder1"runat="server">

</asp:contentplaceholder>

</ContentTemplate>

</asp:UpdatePanel>

</form>

</body>

</html>

I have two buttons on it.Then onserverclick event of first butto i.e, btn i'm opening a modalwindow. Here is the code for that


protected void btn_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();

sb.Append("<script language='");
sb.Append("JavaScript'>");
sb.Append("\n");
sb.Append("var obj = new Object();");
sb.Append("\n");
sb.Append("obj.First = window;");
sb.Append("\n");
sb.Append("obj.Second = 'Content3.aspx';");
sb.Append("\n");
sb.Append("window.showModalDialog('Forms.aspx', obj, 'status:no; dialogHeight:155px;dialogWidth:510px; help:no; scroll:no; menubar:no; resizable:no');");
sb.Append("\n");
sb.Append("</");
sb.Append("script>");
ScriptManager.RegisterStartupScript(this, this.GetType(), "PopUp", sb.ToString(), false);

}

Then here is my content page code:I've one textbox and one hidden button

<%@.PageLanguage="C#"MasterPageFile="~/Menu.master"AutoEventWireup="true"CodeFile="Content3.aspx.cs"Inherits="Content3"Title="Untitled Page" %>

<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">

<scripttype="text/javascript">

function test()

{

var invisibleButton = document.getElementById('<%= btnNo.ClientID %>');

__doPostBack(invisibleButton.name,'');

}

</script>

<asp:ButtonID="btnNo"OnClick="btnNo_Click"runat="server"style="display:none;"/>

<asp:UpdatePanelID="updContent"UpdateMode="Conditional"ChildrenAsTriggers="false"runat="server">

<ContentTemplate>

<tablewidth="340px"border="2"cellpadding="0"cellspacing="0">

<tr>

<td>

<asp:TextBoxid="txt1"runat="server"></asp:TextBox>

<td>

<asp:TextBoxid="txt2"runat="server"></asp:TextBox>

</td>

</tr>

<tr>

<td></td>

</tr>

</table>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="btnNo"EventName="Click"/>

</Triggers>

</asp:UpdatePanel>

</asp:Content>

Then afterthis from the modal window i'm calling the parent pages javascript function i.e, test();

which i've defined in the content page.And also on the click event of the hidden button i'm basically upadting the text box.Here are the codes for both content page and modal window.

protectedvoid btnNo_Click(object sender,EventArgs e)

{

this.txt2.Text ="From Modal Window";

}

for modal window to call parents page function

var oMyObject;

var firstArg;

var secondArg;

oMyObject = window.dialogArguments;

firstArg = oMyObject.First;

//secondArg = oMyObject.Second;

function PassData()

{

firstArg.test(); //function defined in the content page.

window.close();

}

Now this calling the hidden button click event but the text box thta is in the content page updatepanel it is not getting updated.More ever i've found one more thing i.re if i open the modal window directly from master page i.e using javascript this whole functionality works perfectly and the text box in the content page is getting updated.But i want open the modal window through server side only using ScriptManager.RegisterStartScript method...So is there anything tht i'm doing wrong...

please help me on this issue.....

thanks in advance

sarthaks


Hi,

I'm a little bit confused with your sample, and I wasn't able to show the modal dialog.

Can you post a sample that can fully reproduce your logic?


Hi ,

For my sample application i have created three pages.

1.Menu.Master (master page)

2.Contet.aspx(Content Page in which i have added my master page i.e Menu.Master)

3.Form.aspx(To display it as a modal dialog box.)

Page Design For My master page:

<%@.MasterLanguage="C#"AutoEventWireup="true"CodeFile="Menu.master.cs"Inherits="Menu" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Menu</title>

</head>

<body>

<formid="form1"runat="server">

<asp:ScriptManagerID="Scriptmanager1"runat="server"></asp:ScriptManager>

<asp:UpdatePanelID="updMaster"UpdateMode="Conditional"runat="server">

<ContentTemplate>

<div>

<tableborder="2"cellpadding="0"style="background-color: #ff3300; width: 345px;"cellspacing="0">

<tr>

<tdalign="center"style="width: 164px; height: 26px;">

<inputtype="button"id="btn"name="btn"onserverclick="btn_Click"value="Click"runat="server"/>

</td>

</tr>

</table>

</div>

</ContentTemplate>

</asp:UpdatePanel>

<asp:contentplaceholderid="ContentPlaceHolder1"runat="server"></asp:contentplaceholder>

</form>

</body>

</html>

In my master page i have placed one input button.And on itsonserverclick event i am opening up the modal dialog box i.e, Form.aspx

Here is the server side code for the button

protectedvoid btn_Click(object sender,EventArgs e)

{

StringBuilder sb =newStringBuilder();

sb.Append("<script type='text/javascript' language='");

sb.Append("JavaScript'>");sb.Append("\n");

/************************************************/

sb.Append("var obj = new Object();");

sb.Append("\n");sb.Append("obj.FirstArg = window ;");

/* The above three lines is used to pass the reference of the parent window to the modal window. Using which i can call any javascript function of parent window from my modal dialog window*/

sb.Append("\n");

sb.Append("window.showModalDialog('Forms.aspx',obj, 'status:no; dialogHeight:155px;dialogWidth:510px; help:no; scroll:no; menubar:no; resizable:no');");

sb.Append("\n");

sb.Append("</");sb.Append("script>");

ScriptManager.RegisterStartupScript(btn,Type.GetType("System.String"),"PopUp", sb.ToString(),false);

}

Page Design For for modal dialog window.

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Forms.aspx.cs"Inherits="Pages_Forms" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Forms</title>

<scripttype="text/javascript"language="javascript">

var oMyObject;var firstArg;

oMyObject = window.dialogArguments;

firstArg = oMyObject.FirstArg; /* To retrieve any data from the parent window.*/

function PassData()

{

firstArg.test();

window.close();

}

</script>

</head>

<body>

<formid="form1"runat="server">

<div>

<tablecellpadding="0"cellspacing="0"border='1'>

<tr>

<tdstyle="width:600px;"align='center'>

<tablewidth="500px"cellspacing="2"cellpadding='0'border='0'>

<trstyle="height:10px;">

<tdstyle="width: 126px"> </td>

</tr>

<trstyle="height: 10px">

<tdstyle="text-align: center; width: 721px;">

<spanstyle="font-size: 11pt; color: #ffffff; font-family: Arial">

Do you want to save the changes you have made? </span></td>

</tr>

<trstyle="height: 10px">

<tdstyle="width: 126px; text-align: center"></td>

<tdstyle="width: 721px; text-align: center">

<inputid="btnNo"type="button"value="Yes"name="Yes"style="width:58px;"onclick="PassData();"runat="server"/>

<inputid="btnCancel"type="button"value="Cancel"onclick="window.close();"name="Cancel"runat="server"/>

</td>

</tr>

</table>

</td>

</tr>

</table>

</div>

</form>

</body>

</html>

I have two buttons on my form page Yes and Cancel .Onclick of Yes i am calling a javascript function which is there in my parent page( in this case i have wriitten the function in my content page.Function name is test();).

page design for my content page.

<%@.PageLanguage="C#"MasterPageFile="~/Menu.master"AutoEventWireup="true"CodeFile="Content3.aspx.cs"Inherits="Content3"Title="Untitled Page" %>

<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">

<scripttype="text/javascript">

function test()

{

var invisibleButton = document.getElementById('<%= btnNo.ClientID %>');

__doPostBack(invisibleButton.name,'');

}

</script>

<asp:ButtonID="btnNo"OnClick="btnNo_Click"runat="server"style="display:none;"/>

<asp:UpdatePanelID="updContent"UpdateMode="Conditional"ChildrenAsTriggers="false"runat="server">

<ContentTemplate>

<tablewidth="340px"border="2"cellpadding="0"cellspacing="0">

<tr>

<td>

<asp:TextBoxid="txt1"runat="server"></asp:TextBox>

<td>

<asp:TextBoxid="txt2"runat="server"></asp:TextBox>

</td>

</tr>

<tr>

<td></td>

</tr>

</table>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="btnNo"EventName="Click"/>

</Triggers>

</asp:UpdatePanel>

</asp:Content>

In my content page i have update panel and inside that i have placed a text box.I have also hidden button that is declared as a trigger for the update panel..From modal window i am calling the __doPostBack method using this hidden button.Then onclick event of the hidden button i have written this code

protected void btnNo_Click(object sender,EventArgs e)

{

this.txt2.Text ="From Modal Window";

}

My problem is that this text box is not getiing updated.

Hope the above sample helps you

thanks.

sarthak


Please try this:

master:

<%@. Master Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void btn_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); sb.Append("<script type='text/javascript' language='"); sb.Append("JavaScript'>"); sb.Append("\n"); /************************************************/ sb.Append("var obj = new Object();"); sb.Append("\n"); sb.Append("obj.FirstArg = window;"); /* The above three lines is used to pass the reference of the parent window to the modal window. Using which i can call any javascript function of parent window from my modal dialog window*/ sb.Append("\n"); sb.Append("window.showModalDialog('Forms.aspx', obj, 'status:no; dialogHeight:155px;dialogWidth:510px; help:no; scroll:no; menubar:no; resizable:no');"); sb.Append("\n"); sb.Append("</"); sb.Append("script>"); ScriptManager.RegisterStartupScript(btn, Type.GetType("System.String"), "PopUp", sb.ToString(), false); }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"><title>Menu</title></head><body><form id="form1" runat="server"><asp:ScriptManager ID="Scriptmanager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="updMaster" UpdateMode="Conditional" runat="server"><ContentTemplate><div><table border="2" cellpadding="0" style="background-color: #ff3300; width: 345px;" cellspacing="0" ><tr><td align="center" style="width: 164px; height: 26px;"><input type="button" id="btn" name="btn" onserverclick="btn_Click" value="Click" runat="server" /> </td></tr></table></div></ContentTemplate></asp:UpdatePanel><asp:contentplaceholder id="ContentPlaceHolder1" runat="server"></asp:contentplaceholder></form></body></html>
 
Content: 
 
<%@. Page Language="C#" MasterPageFile="~/Menu.master" Title="Untitled Page" %><script runat="server"> protected void btnNo_Click(object sender, EventArgs e) { this.txt2.Text = "From Modal Window"; }</script><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><asp:Button ID="btnNo" OnClick="btnNo_Click" runat="server" style="display:none;"/><asp:UpdatePanel ID="updContent" UpdateMode="Conditional" ChildrenAsTriggers="false" runat="server"><ContentTemplate><table width="340px" border="2" cellpadding="0" cellspacing="0"><tr><td><asp:TextBox id="txt1" runat="server" ></asp:TextBox><td><asp:TextBox id="txt2" runat="server" ></asp:TextBox></td></tr><tr><td></td></tr></table></ContentTemplate></asp:UpdatePanel><script type="text/javascript" >function test(){ window.setTimeout("__doPostBack(invisibleButton.name,'')", 0);}var invisibleButton = document.getElementById('<%= btnNo.ClientID%>');</script></asp:Content>
  Popup:
  
<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"><title>Forms</title><script type="text/javascript" language="javascript">function PassData(){//window.setTimeout(window.dialogArguments.FirstArg.test(), 500;window.close();}</script></head><body><form id="form1" runat="server"><div><table cellpadding="0" cellspacing="0" border='1' ><tr><td style="width:600px;" align='center' ><table width="500px" cellspacing="2" cellpadding='0' border='0'><tr style="height:10px;"><td style="width: 126px"> </td></tr><tr style="height: 10px"><td style="text-align: center; width: 721px;"><span style="font-size: 11pt; color: #ffffff; font-family: Arial">Do you want to save the changes you have made? </span></td></tr> <tr style="height: 10px"><td style="width: 126px; text-align: center"></td><td style="width: 721px; text-align: center"> <input id="btnNo" type="button" value="Yes" name="Yes" style="width:58px;" onclick="PassData();" runat="server" /> <input id="btnCancel" type="button" value="Cancel" onclick="window.close();" name="Cancel" runat="server" /></td></tr></table></td></tr></table></div></form></body></html>

Hi

Now it is working perfectly.My update panel in the content page is getting updated with the changes.But one thing i would like to know what was wrong with my earlier sample application.In your case i found that all the code i.e for master and content are on the htm design part (inline coding )and while calling the javascript function from popup you have used window.setInterval, and more ever in the content page you have written the javascript function at the end of the update panel , is this making all the differences ??

please clear my doubt on this..

thanks

sarthak


Sarthak,

I get an exception if I call the method directly, so I use a window.setTimeout to defer the invoking.

And it doesn't make any difference if the code is inlined in html or not.


Hello Wen,

what is the exception that u r getting if u call the function directlly.If i don't use window.setinterval i'm not getting any exception, but no data is getting populated.How ever if i use taht it is working perfectly

again thanks a lot for clearing my doubts.

thanks

sarthak

Wednesday, March 21, 2012

Usage of CDATA or comments around Javascript -> future problems?

Hi, it appears (from other posts) I need to use CDATA sections aroundJavascript emitted from my controls to prevent them breakingAtlas. However, I also note the point made herehttp://www.netmechanic.com/news/vol6/javascript_no12.htm
about the fact that newer browsers may legitimately ignore Javascript functions inside comments.

Any thoughts? Shouldn't Atlas be modified to work without scripts being commented?

Thanks
Jim

Yes Jim I fully agree with you.I have same problem.

If I keep the javascript triggers not work and if I remove then it works.I dont know how to solve this issue.

Use a menu control in updatepanel

that occurs a javascript error when click another tab: "0.cells" is null or not an object.

who can help me? thanks.

The menu control is not compatible with partial-page updates and can't be used inside a UpdatePanel.


what can i do if i want to implement this function?thx.
Could you run this in JS debugger and post a snippet of affected JS.. I vaguely remember dealing with this issue and it might allow us to see what is exactly happening

did quick google

and found e.g. this

http://forums.asp.net/thread/1485169.aspx


thanks for your information, i read a blog and using this method it works well.

http://mcosier.blogspot.com/2006/12/0cells-is-null-or-not-object-aspnet-20.html

but i have a problem that:

it seems that using AsyncPostBackTrigger can't change the StaticSelectedStyle after i clicked another menuitem?

thanks.


I've been using this piece of javascript to go around the menu problem:

var oldMenu_HideItems = Menu_HideItems;if(oldMenu_HideItems){Menu_HideItems = function(items){if (!items || ((typeof(items.tagName) =="undefined") && (items instanceof Event))) { items = __rootMenuItem; }if(items && items.rows && items.rows.length == 0){ items.insertRow(0); }return oldMenu_HideItems(items);} }
I got it from the asp:menu javascript code and I hook it to "patch" the problem.
Adding it to a page where a menu resides makes the javascript error go away. 

This one works great for me.

Thank you very very much.Big Smile

Great


it is working.. Smile Thank you for your great solutions.

thanks t0yBig Smile

i tryed it.and i dident give that error.

thanks again.


Dear sir

can you please tell me where to put this code in what event, name of the function it is very imp.

thank you,

please advise what to do.


This piece of Javascript has saved me hours of googling! Awesome work buddy and thanks heaps!

See for more info , which controls are not compatable with UpdatePanel

http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx


I cannot figure out how to use this fix. I put this script in my page and I'm still getting the 0.cells is nothing error.

How do I hook this up?

Thanks!


Have you tried the solution thatt0y provided..

It's working..Smile

Use dynamic parameters when calling web service from javascript

Hello,

I would like to call a web services from javascript with dynamic parameters. I don't know the count and the value of the params that I'll set.

Here is a part of my code :

var serviceMethod =new Sys.Net.ServiceMethod(_servicePath, _serviceMethod, _appUrl);var paramArray =new Array(_serviceMethodParameters.length);for(var i = 0 ; i < _serviceMethodParameters.length ; i++ )

{

var toto = _serviceMethodParameters[i].get_Key();var tata = _serviceMethodParameters[i].get_Value();var elem = { toto : tata };

paramArray.push(elem);

}

_request = serviceMethod.invoke(paramArray, onMethodComplete, onMethodTimeout, onMethodError, onMethodAborted,

this , _timeoutInterval, _priority);

the problem that I have is actually I don't figure out the data format of the parameters

I would like the variable toto to be not interpreted as "toto", but as the content of the variable toto.

I could do this in another way, but I have to use this method to call a web service because I need to abort it if needed.

Any ideas about that?

Thanks in advance

Would something like this do the trick?

var elem = {};
elem[toto] = tata;
paramArray.push(elem);

Hope that helps,
-Hao


yes, it's working now, but now i've another problem : the parameter format is not correct.

When the webservice is called, it returns an error which is :

"error: Invalid object passed in, '{' expected. (1): [{\"last\":\"5000\"}]"


I actullay got it !! :)

I didn't need to use an Array to set the parameter but only a variable, kind of hashtable

I write the code if it could help someone who has the same problem.

here is the code :

var serviceMethod =new Sys.Net.ServiceMethod(_servicePath, _serviceMethod, _appUrl);var elem = {};for(var i = 0 ; i < _serviceMethodParameters.length ; i++ )

{

var toto = _serviceMethodParameters[i].get_Key();var tata = _serviceMethodParameters[i].get_Value();

elem[toto] = tata;

}

_request = serviceMethod.invoke(elem, onMethodComplete, onMethodTimeout, onMethodError, onMethodAborted,

this ,_timeoutInterval, _priority);