473,395 Members | 1,675 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 2157

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 it to the combo box, nothing is displayed ...
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 custdata = null; // Custom Data class for 1 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 datagrid from database(sql server) and also we can...
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 do the previous action(e.g. DataGrid )
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 and wanted to show this value in textbox. I want...
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 i want to show record of tableSalary in same form...
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 connection).please reply fast.
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.. I am using asp.net and c#.net
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 database. I want also to allow paging in gridview...
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 here... apologize for any inconvinence..... This is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.