472,325 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,325 software developers and data experts.

ObjectDataSource Bind( ) on Template Column losing data on Sort

I have a pop-up form with a three columned Grid that has checkboxes in
a Template Column in the first/left-most column. (The form is to
allow users to select "Members" of a group, where they check or clear
the boxes next to the potential members they want to add or remove.)

The Object Data Source is as follows...
<asp:ObjectDataSource ID="odsMembers" runat="server"
SelectMethod="GetGroupMembersSelectList"
TypeName="MyDataAccessLayer.MyObject">
<SelectParameters>
<asp:ControlParameter ControlID="hdnGroupSeqNo"
DefaultValue="" Name="GroupSeqNo"
PropertyName="Value" Type="Int32" />
<asp:ControlParameter ControlID="hdnGroupListName"
Name="ListName" PropertyName="Value"
Type="Object" />
</SelectParameters>
</asp:ObjectDataSource>

The binding to the Grid is set up like this...
<asp:GridView ID="grdGroupMembers"
runat="server" AllowSorting="True" AutoGenerateColumns="False"
Width="97%" DataSourceID="odsMembers" DataKeyNames="MemberSeqNo">
<Columns>
<asp:TemplateField
SortExpression="Selected" >
<ItemStyle
HorizontalAlign="Center" Width="5%" />
<HeaderStyle
HorizontalAlign="Center" />
<ItemTemplate>
<asp:CheckBox
ID="chkSelect" runat="server" Checked=<%# Bind("SELECTED")%/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField
DataField="MemberID" HeaderText="Member" SortExpression="MemberID">
<ItemStyle Width="35%" />
</asp:BoundField>
<asp:BoundField
DataField="MemberDescription" HeaderText="Description"
SortExpression="MemberDescription">
<ItemStyle Width="60%" />
</asp:BoundField>
</Columns>
</asp:GridView>

The ObjectDataSource calls my class ok, and returns a Typed DataSet
with MemberSeqNo, MemberID, MemberDescription, and Selected that it
loads correctly to the GridView.populating the CheckBoxes. But if a
user Selects/Deselects checkmarks and then Sorts (which is likely
because the List of potential members is long) their selections are
lost, and they're hating life. ...It sorts, and returns

I either need to...
1. Have the ObjectDataSource Update just Prior to it sorting.
Or....
2. Bind the Template Column "correctly?" to the ObjectDataSource so
the values are persisted/saved correctly.

The GridView's Sorting Events aren't being triggered when bound to the
ObjectDataSource, so I can't catch it there. And the ObjectDataSource
doesn't have a Sort Event that I could find, so Option 1 is looking
unlikely.

Am I binding this wrong to work with 2-Way binding? Is there anything
anyone sees that it looks like I may be doing wrong? Does, or can the
Sort routine be set to run an Update first?

Your help is much appreciated.

Mar 23 '07 #1
0 2093

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kobe | last post by:
I am trying to bind data in a collection to a combo box in a windows application. I am able to retrieve records from the collection but when I bind...
3
by: vineetbatta | last post by:
I have Custom Data class which stores data about single customer and then i store that customer objects in arraylist as shown below. Customer...
2
by: chandana Devabhaktuni | last post by:
Hello and Hi to everyone, This is chandana, i have a doubt which i am mentioning here. We can retrive or bind data to...
5
by: Ahmed Osama | last post by:
I'm using NetBeans 5.5 First :I want to bind data from table from MS Access DB into JTable . Second: Is there any other component in java to...
3
by: sudhashekhar30 | last post by:
i have dropdownlist with data. based on selected item(dropdownlist) i am retrieving data(single value) from database(sql server) using sqldataadapter...
2
by: sudhashekhar30 | last post by:
hi all i am using form view. i want to display record in form view from different table. like 1rst time its showing record from tableemp. 2nd time...
2
by: sudhashekhar30 | last post by:
hi all i am using form view, and don't know how to use. please tell how to bind data to form view. i want to connect it through dataset(run time...
1
by: newtodotnet1 | last post by:
Hi all, I would like to know how to bind data to the gridview using XPath.. The data is in the XML format.. Please help me.... Its urgent.....
1
by: jaredciagar | last post by:
Hi guys...can you help me please.... I'm using ASP.net, MSSQL 2005 and VB Script I have don't know how to bind data in gridview control from...
1
by: renuami | last post by:
Hello Please advise .... I do not know in which section i should be posting Winforms Questions. There is not Option. So i am posting it...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.