Showing posts with label databinding. Show all posts
Showing posts with label databinding. Show all posts

Wednesday, March 28, 2012

Atlas With ObjectDataSource

Can any bone send me examples on Formview(datasource=objectdatasource) which has Atlas Updatepanel in it. For me dataBinding not working properly .

any one plese send.

Hi,

You can try this link.

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/formview.aspx

Wednesday, March 21, 2012

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.