473,769 Members | 3,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ObjectDataSourc e 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:ObjectData Source ID="odsMembers " runat="server"
SelectMethod="G etGroupMembersS electList"
TypeName="MyDat aAccessLayer.My Object">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="hdnG roupSeqNo"
DefaultValue="" Name="GroupSeqN o"
PropertyName="V alue" Type="Int32" />
<asp:ControlPar ameter ControlID="hdnG roupListName"
Name="ListName" PropertyName="V alue"
Type="Object" />
</SelectParameter s>
</asp:ObjectDataS ource>

The binding to the Grid is set up like this...
<asp:GridView ID="grdGroupMem bers"
runat="server" AllowSorting="T rue" AutoGenerateCol umns="False"
Width="97%" DataSourceID="o dsMembers" DataKeyNames="M emberSeqNo">
<Columns>
<asp:TemplateFi eld
SortExpression= "Selected" >
<ItemStyle
HorizontalAlign ="Center" Width="5%" />
<HeaderStyle
HorizontalAlign ="Center" />
<ItemTemplate >
<asp:CheckBox
ID="chkSelect" runat="server" Checked=<%# Bind("SELECTED" )%/>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:BoundFie ld
DataField="Memb erID" HeaderText="Mem ber" SortExpression= "MemberID">
<ItemStyle Width="35%" />
</asp:BoundField>
<asp:BoundFie ld
DataField="Memb erDescription" HeaderText="Des cription"
SortExpression= "MemberDescript ion">
<ItemStyle Width="60%" />
</asp:BoundField>
</Columns>
</asp:GridView>

The ObjectDataSourc e calls my class ok, and returns a Typed DataSet
with MemberSeqNo, MemberID, MemberDescripti on, and Selected that it
loads correctly to the GridView.popula ting 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 ObjectDataSourc e Update just Prior to it sorting.
Or....
2. Bind the Template Column "correctly? " to the ObjectDataSourc e so
the values are persisted/saved correctly.

The GridView's Sorting Events aren't being triggered when bound to the
ObjectDataSourc e, so I can't catch it there. And the ObjectDataSourc e
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 2184

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

Similar topics

0
1225
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 cmbo.DataSource = amap.Streets cmbo.DisplayMember = "StreetName" cmbo.ValueMember = "MSN_ID" This same code has worked before on an older machine. I just rebuilt the source on a new laptop and noticed this problem. Could this have anything to
3
9579
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 data. ArrayList ar = new ArrayList(); // To store more than one customer object. for (int x = 0; x < 30; x++) { custdata = new Customer();
2
5937
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 insert data and can make modifications. In the same way how to retrive or bind data from database(sql server) to textboxes and to other controls that are placed in a table or placed simply on a form or page and how to make modificatons like...
5
7267
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
1862
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 to know how to bind data to a textbox. Thanx sudha
2
1807
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 view. based upon some conditions. so i want to bind data in codebehind file. how to do it? i am using formview 1rst time. i am using c# code. thanks. regards sudha
2
3602
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
1702
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
2525
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 so I want to bind data using datatable or dataset... Can you write the code for me in VB script? Thank You in advance.....
1
6166
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 my first time working with treeview control in winforms. Can someone please help me how to bind data to winforms tree view from 3 tables. I need the out put as follows I need the output as.
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.