Showing posts with label aspx. Show all posts
Showing posts with label aspx. Show all posts

Wednesday, March 28, 2012

Atlas without web services.

All the examples I have seen on Atlas uses web services. I want to use regular aspx methods instead. Is it possible to write an Atlas application that for every 5 seconds call a method in a regular aspx file to check for changes and based on the result of the method updates only a part of a page? Can anyone show some example code?I figured this out. Sorry for bothering you.

hello.

just one more thing: don't forget that page methods are really expensible...if you can, use a web service method to check the update condition.


I have seen both ways and I noticed using web services are more emphasized.

Why are using web services any quicker ?

Atlas WebPartZones Visible property not working correctly

Hi All,

I have an ASPX page that contains three WebPart Zones. As per therequirements, one of the Zones, say rightZone, needs to be hidden for,say X, role. For this I check the user role in the Page_Load event, andif logged-in user's role is X then I set rightZone's Visible propertyto false. This works fine using ASP.NET 2.0 WebParts.

I wanted to have drag-and-drop in FireFox as well; therefore, I used"Atlas" (March CTP) WebPartManager and WebPartZone to achieve the same.This works fine for all roles except X. That is, when an X type userlogs in, a JavaScript error is displayed. It goes something like this:

Could not find 'rightZone' element.

On further investigation I found out that if set the rightZone isrendered even though its visible property is set to false. I guessthat's the reason for JavaScript error.

Please let me know if this is a bug in "Atlas" or I am doing something wrong.

Thanks.

~Vihar

It's generally not a good idea to set Visible=false on a WebPartZone. The Visible property only controls whether the WebPartZone is rendered, not whether the WebPartZone participates in the WebParts control set. For example, if a WebPartZone has Visible=false, it will still appear in the list of WebPartZones in the CatalogZone and LayoutEditorPart. This will be confusing to users, since they will be able to add or move a WebPart to an invisible WebPartZone.

A better idea is to remove the WebPartZone from the page completely. You would need to do this in the PreInit phase of the lifecycle.

All this aside, you have indeed found a bug in Atlas, and it applies to any server control, not just WebParts. The xml-script for a control is always being rendered, even if the control is not visible. This is a bug because the xml-script for a control usually assumes that the control was actually rendered. We'll work on fixing this for a future release. Thanks.

-Mike
For now you could use a workaround to add the css style with display:none.

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 Re-Orde List - DataBinding from SQL 2005

I've had no problems working with this control using DataSources declared in the .ASPX page. However, I am having a fun time trying to get this working with DataBinding from our DataBase.

Where I have gotten so far:

List Renders

List Will Re-Order perfectly

List Will Post Back only to the Page_Load event... no other event

I have the event: rlValues_ItemReorder declared and it should be going to that event, but it doesn't.

During postbacks to the server, I check to see how many items the Re-Order list has in it, and it tells me 0. I had the original DataBinding in an if(!IsPostBack) on the page load, and I've changed it so it binds on each page load. I'm not sure which one I need.

Here is the code I am working with:

Item.Fields.FieldList objFieldList;

int intFieldID = 1;

protectedvoid Page_Load(object sender,EventArgs e)

{

objFieldList =newItemManagement.Item.Fields.FieldList(base.GeneralSettings.ConnectionString, intFieldID);

BindData();

}

privatevoid BindData()

{

rlValues.DataSource = objFieldList.ListValues();

rlValues.DataBind();

}

protectedvoid rlValues_ItemReorder(object sender, AtlasControlToolkit.ReorderListItemReorderEventArgs e)

{

thrownewException("The method or operation is not implemented.");

}

protectedvoid btnInsert_Click(object sender,EventArgs e)

{

if (txtValue.Text !="" && txtText.Text !="")

{

objFieldList =new ItemManagement.Item.Fields.FieldList(base.GeneralSettings.ConnectionString, intFieldID);

objFieldList.InsertValue(txtText.Text,Int32.Parse(txtValue.Text));

BindData();

}

}


Here is the .aspx side I'm working with:

<atlas:scriptmanagerid="ScriptManager1"EnablePartialRendering="true"runat="server">

<ErrorTemplate>

<divstyle="padding: 12px; width: 400px; height: 140px; border: #000000 1px solid;

background-color: white; text-align: left">

An error has occurred:<br/>

<spanid="errorMessageLabel"runat="server"></span>

<br/>

<br/>

<inputid="okButton"runat="server"type="button"value="OK"/>

</div>

</ErrorTemplate>

</atlas:scriptmanager>

<divclass="reorderListDemo">

<atlastoolkit:reorderlistid="rlValues"runat="server"

allowreorder="true"draghandlealignment="Left"iteminsertlocation="Beginning"

datakeyfield="FieldListValueID"sortorderfield="Order"Width="90%"OnItemReorder="rlValues_ItemReorder">

<ItemTemplate>

<divclass="itemArea">

<asp:LabelID="lblText"runat="server"Text='<%# Eval("Text")%>'/> |

<asp:LabelID="lblValue"runat="server"Text='<%# Eval("Value")%>'/>

</div>

</ItemTemplate>

<ReorderTemplate>

<asp:PanelID="Panel2"runat="server"CssClass="reorderCue"> </asp:Panel>

</ReorderTemplate>

<DragHandleTemplate>

<divclass="dragHandle"> </div>

</DragHandleTemplate>

</atlastoolkit:reorderlist>

<hr/>

<asp:LabelID="lblOutput"runat="server"/>

<hr/>

Value:<asp:TextBoxID="txtValue"runat="server"/>

<br/>

Text:<asp:TextBoxID="txtText"runat="server"/>

<br/>

<asp:ButtonID="btnInsert"runat="server"Text="Insert"OnClick="btnInsert_Click"/>

</div>

Any help would be awesome.

Thanks.

I believe you need to rebind each time. Without rebinding the list thinks it has zero members, and (using the latest drop from CodePlex) throws exceptions in (as I recall) reorderList.cs ('Item index > count' or something like that). Further code there invokes the Reorder function, so if it bombs out your reorder function never gets called.

The main issue I see with my example is that It never hits the re-order event (if that is what you mean).

The Version I'm using is the newest one from CodePlex... but I have yet to see any errors from the control.


Shawn helped me with this. If I take the Order field out (seeing i'm binding with an IList) it works perect.

Atlas Project can i mix up ?

HI

I am completely new to Atlas, may be a stupid question.

Is it possible to mix up usual aspx forms in Atlas project , that is forms that includes postback, so that in a Team those who know Atlas can use their skill , while others can do without javascript/with post back.

Thanks

Ram

Absolutely. Atlas functionality is determined at the page level, not the application level. Therefore, you can include Atlas funcitonality in any aspx page while at the same time having aspx pages in your web application that do not use Atlas.

Hi Ram,

Yes, you can have completely standard non-Atlas pages in a project that uses Atlas. If you don't do anything Atlas specific in a page, it's as if Atlas wasn't there.

David


jamesbrianclark ,

Thankyou, It is clear . I can do with and without Atlas functionality in a project

Regards

Ram


Hi David,

Thanks for the clarification that I can mix up Atlas page and Standard non Atlas page inside a page.

This gives great flexibility start with Ajax selectively . The answer is helpful.

Regards

Ram