Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Wednesday, March 28, 2012

Atlas with javascript

I will try to put an update panel around a content place, in order to assure only the "inside" pages will be refreshed, leaving the master page static. There might work I suppose...

Is there any problem in registering our own javascript in a page that has an Atlas control like updatepanel ? If yes, how could it be worked around?

Hi

Should be able to just register your Javascript with the script manager on the page. If the javascript is going to be put in the master page then add the script manager to the master page and register the script in the code behind for the master page.

If you need to register more stuff in the content pages use the ScriptManagerProxy in the content page as you can only have a sing le script manager on a page.

A good over view ishttp://www.nikhilk.net/AtlasScriptManager.aspx

Hope that helps


Hi,

in addition to what Richard Line wrote; if you're going to inject JavaScript code (or script references) in a page after a partial postback, then you must rely on the static RegisterXXX methods of the ScriptManager.

Monday, March 26, 2012

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 DropDownList

I have a dropdownlist which has around 2300 items and is placed inside an EditTemplate of a DetailsView.

When i change the mode to edit, the detailsview does not change the mode and no error is shown. It silently stops updating. If i have lesser number of items in the dropdown it works.

I have tested the controls outside the updatepanel to check if there is anything wrong with my code, but that works fine. I also tested the dropdown outside the edit template but inside a updatepanel it works. It happens only in a edit template. Works within an item template also.

Did anybody have a similar issue?? I very much think it is a bug in the Updatepanel and i have been using updatepanels extensively. The biggest trouble is, this issue could happen after the app goes live and data keeps accumulating.

Datasource is objectdatasource; also tried with SQLdatasource(no luck).

PartialRendering is on. (If it is switched off it works).

UpdatePanel mode is conditional (Making it always doesnot work)

Filling the items of dropdownlist in the dropdownlist_prerender (without a datasource) also gives the same error.

Id there any property that i am missing somewhere??

Best regards,

chandrakanth

Is this some kind of sync issue between the trigger event and update itself since you have 2300 items?Exactly how are you using the dropdown within the edit template? Are the values used in the update process some how?

The drop down has key-value pairs with keys as Ids and values as the designations. The Id is bound to a field of the datasource. I havel also removed the binding between dropdown and the datasource field, making it a simple dropdown with a datasource having 2300 items, and the mode does not change yet.

These values are not used anywhere in the update process.

Since the event is raised by a control inside the update panel, i am not using any triggers.

I have even tried to make everything from scratch in a test page to rebuild the issue.(Inorder to remove any effects of other controls on the updateprocess. No luck again.

chandrakanth


Some more updates on the update panel issue.

The dropdown works as long as the size is less than or equal to 894. Anything more than that which as is in my case the issue shows up. Any suggestions with a workaround for this?


Figured it out.

The issue was with the data. Data having some non ascii characters was behaving in that manner.

hope it helps others who might have a similar issue.

chandrakanth

Wednesday, March 21, 2012

Atlas scripting inside an ASCX

Hello!

I have an ASCX inside an ASPX.

I want this ASCX to work with Atlas Scripting, for example doing this:

PageMethods.HelloWorld(OnWebRequestComplete1);

The problem is that it only works if HelloWorld is in the .ASPX.CS, but I want this method to be in the ASCX.CS.

If I put the HelloWorld inside the ASCX.CS a javascript error is thrown (it doesn't recognize what PageMethods is).

Any one has an idea??Hi,

at the moment you can't call a WebMethod inside a user control. You have to expose it in the Page class.
Thanks Garbin... that's a bad newSad

I would have to use AJAXPRO for this purpuse
I'm not sure that's entirely correct. I am doing just that, without any problem. The key is that you have to have the ScriptManager in the ASCX control, and then it works just fine. I assume, therefore, that you just can't have another in the Page itself. Otherwise, it works for me...
Hi,

thanks for pointing that out, lonevvolf. I wasn't thinking of this scenario because I see the ScriptManager tied to the Page rather than to an user control (where I would use the ScriptManagerProxy). However, if it works around the issue, it's good news.

Here's the way I'm doing it.

In the .ASPX page, I'm exposing a Web Method that will actually route the call to the user control's web method. This is the way I found that works best for me.


Is it possible that I can see your code, or share mine with you. I am unsuccessfull so far and need help. The whole idea behind this for me is to keep the .ascx control's code to be abstract from the user (developer. I want the user to be able to implement these controls very easily.

Thanks,

Jack

jfobel@.msn.com


I am sorry, my post was meant to be directed tolonevvolf. He states he has done this successfully.

Were you successful at it now? I'm having this same problem as I just discover it.


I'm unable to post the code here as I don't know how to get this forum to render this sample html script instead of malformation text...

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.