Showing posts with label event. Show all posts
Showing posts with label event. Show all posts

Wednesday, March 28, 2012

Atlas web service proxy undefined - bug or mistake?

Ok, here's the deal: I have javascript method that is called on the window's load event:

window.onload = function () { getDataForTable();};

Pretty striaghtforward, right? Well, when the getDataForTable method executes it calls an Atlas proxy method:

WebServices.Callbacks.CalendarFunctions.CheckDate(dateField.value, getDataForTable_Callback);
But when the script execute on load, I get an error stating that 'WebServices' is not defined. When I check the HTML output the Atlas javascript reference is there: "text/xml-script">"http://schemas.microsoft.com/xml-script/2005"> <references> <add src="http://pics.10026.com/?src=/Anthem/Callback/CalendarFunctions.asmx/js"/> "text/xml-script">"http://schemas.microsoft.com/xml-script/2005"> <references> <add src="http://pics.10026.com/?src=/Anthem/Callback/CalendarFunctions.asmx/js"/>
<script type="text/xml-script"><page xmlns:script="http://schemas.microsoft.com/xml-script/2005"> <references> <add src="/Anthem/Callback/CalendarFunctions.asmx/js" /> </references> <components /></page></script>
And when I hit the URL above the javascript there looks correct:
Type.registerNamespace('WebServices.Callbacks'); WebServices.Callbacks.CalendarFunctions=new function() {this.path = "http://localhost:64408/Project/Callback/CalendarFunctions.asmx"; this.appPath = "http://localhost:64408/Anthem/"; var cm=Sys.Net.ServiceMethod.createProxyMethod; cm(this,"CheckDate","date"); }

So... here is the question: why is this undefined? I think this is a bug because when I debug the script the ".asmx/js" script is not loaded in the script explorer window like other referenced scripts. So, any work arounds? How else do I get this call to execute during the window.onload event?

Thanks in advance for the help.

The best thing to do I think is to install something like fiddler, and verify that the request going out is in the form you expect, and that you are indeed getting the javascript that you get when you use the script include. Hopefully you'll see something obvious...

Actually I think this might be a timing issue, you are probably calling your onLoad before atlas has a chance to load its scripts, so you can verify that is the case in fiddler. Anyways you probably want to register your getDataForTable on pageLoad or using atlas's ApplicationOnLoad.

Hope that helps,
-Hao


You are right, I added the getDataForTable method after I posted this and it worked - it was just a timing issue. Thanks for the help though!

Monday, March 26, 2012

Atlas updatepanel triggered by user control event

I created a user control which has a imagebuttton in it, I then exposed the click event of the button to the page the user control was placed on using the following code:

Public Event ImageButton1_Click(ByVal senderAs Object,ByVal eAs EventArgs)Private Sub eventXYZ(ByVal senderAs Object,ByVal eAs System.Web.UI.ImageClickEventArgs)Handles ImageButton1.ClickRaiseEvent ImageButton1_Click(sender, e)End Sub

I can use this event from the ASPX page with no problems, however when I use the event as an Atlas trigger for the updatepanel the page always posts back. Is there any way to wire this event up to the upatepanel and avoid the postback (btw the user control was not added dynamically).

Any chance you've found a resolution to this? I'm having the same issue but with a dropdown in a user control....

Thanks.


hello.

well, not something supported out of the box...maybe this tip will help you:

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

Atlas UpdatePanel and Button Event

I do put the button inside UpdatePanel , i want when i click that button it will do something() , but the problem here that sometime it work and aslo sometime not work . Anyone fall into the situation the same as me ? Can u give give gor me any hint to recover this problem.

Thanks

hello.

not sure on what you mean...can you post a small example here?


----------------

UserControl.ascx

<%

@.ControlLanguage="C#"AutoEventWireup="true"CodeFile="UserControl.ascx.cs"Inherits="SurveyUserControl" %><atlas:UpdatePanelrunat="server"ID="UpdatePanel"> <ContentTemplate>

<

asp:ButtonID="Button"runat="server"OnClick="Button_Click"Text="Click"/>

<atlas:Panelrunat="server"ID="Panel1" >

<asp:LabelID="Label1"runat="server" tex></asp:Label>

</atlas:Panel>

<atlas:Panelrunat="server"ID="Panel2"visbile="false">

<asp:LabelID="Label2"runat="server"></asp:Label>

</atlas:Panel>

</ContentTemplate></atlas:UpdatePanel>

UserControl.ascx.cs

protected

void Button_Click(object sender,EventArgs e){

Panel1.visible = false;

Panel2.visible = true;

dosomething();

}

Default.aspx

<%

@.RegisterSrc="~/UserControl.ascx"TagName="UserControl"TagPrefix="uc1" %>

<

asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"runat="Server"><atlas:ScriptManagerID="MasterScriptManager"runat="Server"EnablePartialRendering="True"EnableScriptGlobalization="false"></atlas:ScriptManager>

<

PanelID="SurveyUserControlDnaVjfFieldSetPanel"runat="server"></Panel>

Default.aspx.cs

protected

overridevoid OnInit(EventArgs e)

{

UserControl userControl = (UserControl)Page.LoadControl("~/UserControl.ascx");

Panel.Controls.Add(userControl);

base.OnInit(e);

}

----------------

that is my code , I want when i click it just postback inside it not whole the Default page , but when i click the button sometime it work sometime does not .


hello.

man, this is not a working sample...what doesn't work as you expect?


Divide and conquer, my friend.

Try taking your system and try reducing it to the simplest scenario with a little test web application and getting your problem to duplicate. If you can, post it to a public site so we can see what you're talking about; if you can't, then at least post the sample code (that works) for this simple app and we'll help.

Millions of things could be causing this to "not work".


Sorry , maybe i mistake . Right now maybe i figure out in a bit .I dont know that is bug of UpdatePanel or not ? That error (it does not show the

<

divstyle="width: 100; border: solid 1 blue"><divstyle="width:<%# Eval("someval")%>; background-color: Red;"></div></div>

at the layout or it does nothing) occur only if i fire a button event at the loading time (because i do many thing on my page so it does take time for loading) . If i fire event after it is completed loading , everything is ok . Any idea to help me . I can post all the code ,beacuse it too much that why it take time for loading .

Atlas Update Panel

I have an Update panel and I want to Update it on th server code when an Event occure.

How can I do this?

when I use Update1.update();

my update panel dont Update;

please help me!!!!!

Make sure you have a script manager on the page

<atlas:ScriptManager runat="server" EnablePartialRendering="true" ID="updateManager">

You need to wire up a button to the update panel with the Triggers tag. Ex:

<atlas:UpdatePanel ID="atlasPanel" runat="server" RenderMode="Inline" Mode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="drpCountry" runat="server"
DataTextField="DESCRIPTION" DataValueField="PK" AutoPostBack="True">
</asp:DropDownList>

<asp:DropDownList ID="drpProvince" runat="server"
DataTextField="DESCRIPTION" DataValueField="PK" AutoPostBack="True">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="btnReload" EventName="Click" />
</Triggers>
</atlas:UpdatePanel>


Check UpdateMode property, set it to "Conditional". Register your control in Page_Load method

ScriptManager1.RegisterAsyncPostBackControl(ControlName);

Let me know if this helps you


thanks for your help

but i want updating occur when a Event is occur

for example i want when sqlnotification event is occur my gridview will update Automatically

in my code i use SqlDependency and SqlDependency Rise an Event (onchangedataSource)

i want update my GridView in this time

excuse me i can't write english good


Hi,

Please note that UpdatePanel is used for events that originates from a page. If the events isn't from a specific page, then the updatePanel isn't able to update the contents on a page.

You may add a timer on the page and use it to fire events continuously on current page. And in the tick event handler of the timer, update the Gridview if necessary.

Hope this helps.


Thanks for your help.

and one more questuin:

i want emplement a web chat like Gmail web Chat what is the best Course of implemention for this kind of web chating?


I think it can be done in this way:

1. add a hiddenField on the page to keep the latest time of messages on current page

2. use window.setInterval to call a web service periodically and pass the latest time as the parameter

3. the web service returns all messages that is created later then the parameter

4. use javascript to display those results on the page



Thanks for Yor help

Wednesday, March 21, 2012

ATLAS replacing redered control ids incorrectly

I have multiple update panels on a page. When i fire a control event inside one of these panels, i get an alert window saying something like:

"An async postback was caused by a control within $ctl0$myPlaceholder$myUpdatePanel . . . but the update panel could not be found on the page."

when i view the source in my code, however, the actual id or name of the div that is the rendered updatepanel is "_ctl0_myPlaceholder_myUpdatePanel".

I am not sure why this is happening. has anyone seen this before? suggested fixes?

Hi,

you should view posts at:

http://gregdotnet.blogspot.com/ - about web.config element xhtmlconformance and
http://forums.asp.net/thread/1211330.aspx - about naming the controls

Basicly what you need to check is that if you have any dynamicly added controls assign them id's when they get added to the controls collection. This way the control id's at runtime don't get rendered with ctl04_ and such. Worked for me.

Atlas Problem

I am using atlas updatepanel.But it not works in some pages only.If i invoke the Event i get the following error called

Error: element has no properties
Source File:http://localhost:1922/V1.5/WebResource.axd?d=76cvup_o6D5oq67FJRJ3lWFGXAOxalxDLDfhjEshy7rTmGT1wgioOjBBazTacAsXaJvLmuPSxaQ96h73WKTgYJPI_6yrvF_ItQBwDvIVAxY1&t=632894223780000000
Line: 10845

What is the error .& how to solve this problem...P

first the link u have provided is not working

try to copy and paste ur markup to help u

but any way try to check with me the syntax here:

<atlas:ScriptManager runat="srever" ID="scriptManager1" EnablePartialRendering="true"/>

<atlas:UpdatePanel runat="srever" ID="updatePanel1" Mode="Always" >

<ContentTemplate>

//here u add ur controls

</ContentTemplate>

</atlas:UpdatePanel>

or if u make it conditional mode

<atlas:ScriptManager runat="srever" ID="scriptManager1" EnablePartialRendering="true"/>

<atlas:UpdatePanel runat="srever" ID="updatePanel1" Mode="Conditional" >

<ContentTemplate>

//here u add ur controls

</ContentTemplate>

<Triggers>

// here u add ur triggers may be upon event or a change in property as u wish

</Triggers>

</atlas:UpdatePanel>

ATLAS postback works, but output does not render

Im an ATLAS newbie and I've come across an issue with using several dropdownlists within an UpdatePanel. I'm using the OnSelectedIndexChanged event of the dropdownlist to fire a subroutine, which checkes the SelectedValue and determines what additional fields (if any) to display.

When I debug the application in VS2005, I can see that the CreateCriteriaField subroutine does fire when the value of dropFID1 changes. The CreateCriteriaField subroutine then sets the visibility of dropComparison1a to true. dropComparison1a, however, does not render to the screen. I'm having the same issue with any field which has its visibility set to "false". Since the partial postback does occur, I'm guessing this some sort of a javascript or rendering issue and not an Atlas config issue.

Some notes: I am using a master page in a frameset, and Cassini as my webserver. Code excerpts are below. Any ideas would be most appreciated. (I apologize for the formatting of the code, but I had trouble pasting it in here.)

Content Page

*****************************************************************

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"
<atlas:ScriptManager ID="scriptmanager1" EnablePartialRendering="true" runat="server" /
<atlas:UpdatePanel ID="updatepanel1" runat="server"
<ContentTemplate
<table>
<tr id="row1" visible="true" runat="server" style="vertical-align: top;">
<td><asp:DropDownList ID="dropFID1" runat="server" OnSelectedIndexChanged="CreateCriteriaField" AutoPostBack="true" CssClass="advancedsearchcriteria" /></td>
<td width="100">

         <asp:DropDownList ID="dropComparison1a" runat="server" CssClass="advancedsearchcriteria" Width="100" Visible="false" AutoPostBack="true" OnSelectedIndexChanged="CheckTextFields"><asp:ListItem text="=" Value="=" /><asp:ListItem text="<>" Value="<>" /><asp:ListItem text="Begins With" Value="begins" /><asp:ListItem text="Includes" Value="includes" /><asp:ListItem text="<> Begins With" Value="not begins" /><asp:ListItem text="<> Include" Value="not includes" /><asp:ListItem text="Is Null" Value="IS NULL" /><asp:ListItem text="Is Not Null" Value="IS NOT NULL" /></asp:DropDownList>         <asp:DropDownList ID="dropComparison1b" runat="server" CssClass="advancedsearchcriteria" Width="100" Visible="false" AutoPostBack="true" OnSelectedIndexChanged="CheckCalendarFields"><asp:ListItem text="=" Value="=" /><asp:ListItem text="<>" Value="<>" /><asp:ListItem text=">" Value=">" /><asp:ListItem text="<" Value="<" /><asp:ListItem text="Between" Value="between" /><asp:ListItem text="Is Null" Value="IS NULL" /><asp:ListItem text="Is Not Null" Value="IS NOT NULL" /></asp:DropDownList>     </td>
     <td width="300">         <asp:TextBox ID="txtCriteria1" Visible="false" runat="server" CssClass="advancedsearchcriteria"/><asp:HyperLink id="linkCalendar1" visible="false" runat="server" ImageUrl="/images/calendar.gif" alt="Select Date" href="javascript:show_calendar('all.ctl00$ContentPlaceHolder1$txtCriteria1');" /> <asp:Label ID="lblBetween1" runat="server" text="AND" cssclass="betweenlabel" Visible="false"/> <asp:TextBox ID="txtCriteria1b" Visible="false" runat="server" CssClass="advancedsearchcriteria"/><asp:HyperLink id="linkCalendar1b" visible="false" runat="server" ImageUrl="/images/calendar.gif" alt="Select Date" href="http://links.10026.com/?link=javascript:show_calendar('all.ctl00$ContentPlaceHolder1$txtCriteria1b');" />         <asp:DropDownList ID="dropCriteria1" runat="server" Visible="false" CssClass="advancedsearchcriteria" OnSelectedIndexChanged="CreateTSField" AutoPostBack = "true" width="250"/><br /><asp:DropDownList ID="dropTransactionStatus1" runat="server" cssclass="advancedsearchcriteria" Visible="false" Width="250"/>      </td>      <td ><asp:DropDownList ID="dropOperator1" runat="server" OnSelectedIndexChanged="checkOperator" AutoPostBack="True" CssClass="advancedsearchcriteria"><asp:ListItem text="" Value="" /><asp:ListItem text="And" Value="and" /><asp:ListItem text="Or" Value="or" /></asp:DropDownList></td>   </tr></table></ContentTemplate></atlas:UpdatePanel>

</asp:Content>

Master Page

**************************************************************

<%

@dotnet.itags.org.MasterLanguage="VB"CodeFile="main.master.vb"Inherits="main" %>

<%

@dotnet.itags.org.RegisterSrc="~/includes/controls/topmenu.ascx"TagName="topmenu"TagPrefix="ucTopMenu" %>

<?

xmlversion="1.0"encoding="UTF-8"?>

<!

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">

<

headid="Head1"runat="server"><title>Untitled Page</title><linkhref="/style.css"rel="stylesheet"type="text/css"/><scripttype="text/javascript"src="/includes/javascript/date-picker.js"/>

</

head>

<

bodystyle="background-color: #5A6E9F"><formid="form1"runat="server"><divid="maindiv"><divid="topmenudiv"><ucTopMenu:topmenuID="Topmenu1"runat="server"enableviewstate="false"/><ahref="javascript:PrintFrame()"><imgsrc="/images/print1.gif"alt="Print"style="position: absolute; right: 10px; top: 2px; border: none;"/></a></div><divid="pageheadingdiv"><asp:labelID="lblPageHeading"runat="server"Text="Page Heading"enableviewstate="false"/></div><divid="maincontentdiv"><asp:contentplaceholderid="ContentPlaceHolder1"runat="server"/></div></div></form>

</

body>

</

html>

Content Page Code Behind Excerpt

************************************************************

Sub CreateCriteriaField(ByVal s As Object, ByVal e As EventArgs)

Dim dropFID As DropDownList
dropFID = s

'Retrieve number from FID dropdown
Dim strDropDownList As String = Right(dropFID.ID, 1)

Dim Content2 As ContentPlaceHolder = Page.Form.FindControl("ContentPlaceHolder1")

Dim dropComparisonA As DropDownList

dropComparisonA = Content2.FindControl("dropComparison" & strDropDownList & "a")

dropComparisonA.Visible = True
End Sub

IMHO, you should put your second dropdownlist at another updatePanel and put trigger in second updatePanel from first dropdownlist.

Hope this helps.


That is an idea I considered, but since this one page makes use of about 30 dropdownlists and textboxes, I don't know how practical that would be. Additionally, I have other pages with multiple dropdowns within a single update panel and those work as expected. I'm still trying to figure out what isn't working with this, but I'm just about out of ideas...