473,791 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrids with checkboxes and postbacks...

Hi,

I am trying to get a list of all of the rows in a datagrid where a
checkbox is checked but am having a major headache with the postback.

I'm using VB and codebehind and I have an example which works fine as
long as I don't repopulate the datagrid. Unfortunately I need to
repopulate the datagrid to get the paging and sorting to work.

So I have one option where the grid's datasource is refreshed as part
of the page_load and this lets the in grid buttons and paging and
sorting all work fine. Unfortunately the selecting doesn't work unless
I don't do the rebinding in the page_load. Can I make the page_load
check what operation caused the postback or have I just got the whole
of this backwards?

Any help would be great as I'm stuck and going around in circles.

Cheers,

Gav
Nov 17 '05 #1
2 1317
Jos
"Gavin" <ga********@big foot.com> wrote in message
news:cc******** *************** **@posting.goog le.com...
Hi,

I am trying to get a list of all of the rows in a datagrid where a
checkbox is checked but am having a major headache with the postback.

I'm using VB and codebehind and I have an example which works fine as
long as I don't repopulate the datagrid. Unfortunately I need to
repopulate the datagrid to get the paging and sorting to work.

So I have one option where the grid's datasource is refreshed as part
of the page_load and this lets the in grid buttons and paging and
sorting all work fine.


Why do you want to do this refreshing in page_load?
I would suggest doing it in the event handler (when that option is
selected).

I hope this helps...

--

Jos
Nov 17 '05 #2
>
Why do you want to do this refreshing in page_load?
I would suggest doing it in the event handler (when that option is
selected).

I hope this helps...


Thanks for the suggestion, I got it sorted by moving the refresh logic
around.

Now it only calls the refreshes in the initial load and in various
events and it all works fine.

Thanks again for your help

G
Nov 17 '05 #3

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

Similar topics

0
1231
by: Kumar | last post by:
try this Dim mycheck As CheckBox = CType(dgWelcomePacks.Items (i).Cells(7).Controls(1), CheckBox) regards, Kumar. >-----Original Message-----
1
2049
by: Jo | last post by:
Hi, I've tried the suggested solution but I'm still getting the same error. It seems that once the page postback is envoked the checkbox control is removed from the datagrid so all my changes (ticks etc) are lost. Is there a way of retaining the checkbox control on a postback? Thanks,
0
974
by: Fresh Air Rider | last post by:
I am having trouble getting checkboxes to work within Repeaters and DataGrids I have tried to access the value of each checkbox within a repeater which has been ticked as follows :- string sValues ="values"; foreach (RepeaterItem ri in rptrPublications.Items){ CheckBox cbx = (CheckBox)ri.FindControl("cbxPub"); if(cbx.Checked){
0
1030
by: Sebi | last post by:
Hello All, I'm having problems, reading the new Values from CheckBox in a DataGrid. my Code Behind is C# I do exactly what other samples do, but I allways get the Initial Values instead of the current values choosen by the user!!
1
1324
by: DJ Dev | last post by:
Hi, I am stuck at a problem for 3 days now. I create runtime datagrids depending on the user selections and they may vary from 2-10 depending on user selection at runtime. The datagrids are created in a loop at runtime and I assign IDs as DG0, DG1...and so on in the loop itself. The datagrid has a template column created at runtime with checkboxes. They may vary from 3-7 varying from datagrid to datagrid. Once that is done and i have been...
2
1988
by: tshad | last post by:
I just started using the RowSelectorColumn from Andy Smith (MetaBuilders.com) and can't seem to find a way to find the other controls in the same row of my datagrid. I really like the contro and have been able to work for everything I need, except for this. I can't seem to use src.parent or set src to control to allow me to traverse controls to find the other controls. I am trying to change the database record when the control is...
4
1953
by: Jim Bancroft | last post by:
Hi everyone, I'm using a DataGrid with TemplateColumns. My DataGrid is located in a cell of an asp:Table. I did this so it's positioned correctly onscreen. One of the DataGrid's TemplateColumns is a checkbox. During the page's postback I loop over the DataGrid and read the checkbox values. My problem is, none of the checkboxes ever have their "Checked" attribute set-- it's as though anything I mark is ignored.
6
1758
by: Steve Hershoff | last post by:
Hi everyone, I've got a strange one here. There are two datagrids on my page, one nested within the other. I'll refer to them as the topmost and secondary datagrids. In the topmost datagrid's OnItemDataBound() method we check for the row in which it's appropriate to add the secondary datagrid. Exactly one row in the topmost grid will contain the secondary grid.
2
1940
by: rn5a | last post by:
In a shopping cart app, a ASPX page retrieves the order details & personal details of a user from a MS-Access database table depending upon the username of the user. The order details of a particular order (like ProductID, Name, Description, Quantity etc.) are displayed in one DataGrid where as the personal details of the buyer corresponding to this order (like Name, E-Mail, Shipping & Billing Address etc.) are displayed in another...
1
1108
by: Cdude | last post by:
I have a datagrid with checkboxes in it.I have a total column. Now whenever a checkbox is ticked i need to retrieve the total of that row.
0
9666
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
9512
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
10419
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
10201
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...
0
9987
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 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...
0
6770
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();...
0
5424
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...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.