Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > CheckBoxes in DataGrids-- the "checked" attribute not correct after posting page?

Reply
Thread Tools

CheckBoxes in DataGrids-- the "checked" attribute not correct after posting page?

 
 
Jim Bancroft
Guest
Posts: n/a
 
      07-22-2005

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.

If I put a checkbox outside of the DataGrid, into a separate cell of my
table, I can read its Checked attribute correctly during postback. Is there
something I'm missing here when it comes to placing checkboxes into DataGrid
columns? I enabled the viewstate on my checkbox, but that didn't help. If
you have any suggestions or tips, I'm all ears. Thanks!


 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGluZyBIdWFuZw==?=
Guest
Posts: n/a
 
      07-23-2005
Check if you have datagrid's viewstate enabled.
Check if you re-bind your data in postback. If you do, the selection info
will be lost.
--
Ting Huang


"Jim Bancroft" wrote:

>
> 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.
>
> If I put a checkbox outside of the DataGrid, into a separate cell of my
> table, I can read its Checked attribute correctly during postback. Is there
> something I'm missing here when it comes to placing checkboxes into DataGrid
> columns? I enabled the viewstate on my checkbox, but that didn't help. If
> you have any suggestions or tips, I'm all ears. Thanks!
>
>
>

 
Reply With Quote
 
 
 
 
Jim Bancroft
Guest
Posts: n/a
 
      07-24-2005
Yes, that was it. I had inadvertently bound my DataGrid during postback, so
the checkboxes lost their state. Many thanks Ting!


"Ting Huang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Check if you have datagrid's viewstate enabled.
> Check if you re-bind your data in postback. If you do, the selection info
> will be lost.
> --
> Ting Huang
>
>
> "Jim Bancroft" wrote:
>



 
Reply With Quote
 
Patrick.O.Ige
Guest
Posts: n/a
 
      07-25-2005
Yeah with CheckBoxes thats the trick
Patrick


"Jim Bancroft" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes, that was it. I had inadvertently bound my DataGrid during postback,

so
> the checkboxes lost their state. Many thanks Ting!
>
>
> "Ting Huang" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Check if you have datagrid's viewstate enabled.
> > Check if you re-bind your data in postback. If you do, the selection

info
> > will be lost.
> > --
> > Ting Huang
> >
> >
> > "Jim Bancroft" wrote:
> >

>
>



 
Reply With Quote
 
GJH
Guest
Posts: n/a
 
      08-04-2005
Can you post your code where you check your grid for what checkbox has been
clicked? I have a similar app where I need to check each row to see what
radio group has been selected.

thanks in advance


"Jim Bancroft" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> 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.
>
> If I put a checkbox outside of the DataGrid, into a separate cell of my
> table, I can read its Checked attribute correctly during postback. Is

there
> something I'm missing here when it comes to placing checkboxes into

DataGrid
> columns? I enabled the viewstate on my checkbox, but that didn't help.

If
> you have any suggestions or tips, I'm all ears. Thanks!
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkboxes in a ListView losing checked attribute on postback tom ASP .Net Web Controls 0 09-02-2009 12:09 AM
simulation result is correct but synthesis result is not correct J.Ram VHDL 7 12-03-2008 01:26 PM
Problem adding an attribute to a web form control after posting ba =?Utf-8?B?SmFpbWUgU3R1YXJkbw==?= ASP .Net 0 12-14-2005 06:07 PM
CheckBoxes in DataGrids-- the "checked" attribute not correct after posting page? Jim Bancroft ASP .Net Datagrid Control 4 08-04-2005 04:19 PM
correct or not correct? Dan HTML 7 10-02-2003 10:16 PM



Advertisments