473,740 Members | 9,506 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">
<asp:TemplateFi eld
SortExpression= "Selected" >
HorizontalAlign ="Center" Width="5%" />
HorizontalAlign ="Center" />
<ItemTemplate >
ID="chkSelect" runat="server" Checked=<%# Bind("SELECTED" )%/>
</asp:TemplateFie ld>
<asp:BoundFie ld
DataField="Memb erID" HeaderText="Mem ber" SortExpression= "MemberID">
<ItemStyle Width="35%" />
<asp:BoundFie ld
DataField="Memb erDescription" HeaderText="Des cription"
SortExpression= "MemberDescript ion">
<ItemStyle Width="60%" />

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.
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

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 2182

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

Similar topics

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
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();
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...
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 )
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
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
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.
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
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.....
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.
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...
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,...
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...
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...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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...
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();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.