Uncheck Checkboxes

P

Porgányi Géza

Hi!

I have a Datagrid with a Checkbox in a template column. The checkboxes are
checked programatically from database on load. As I uncheck some options and
push a button (postback) then I want to read if a checkbox is checked and
they have the old value, as nothing would happen.

I found articles about this, but they make it with autopostback or
Datagrid.OnSelectedIndexChange method. Which I think is unnecessary.

Is there a solution?

Thanks in advance
Géza
 
R

Riki

Porgányi Géza said:
Hi!

I have a Datagrid with a Checkbox in a template column. The
checkboxes are checked programatically from database on load. As I
uncheck some options and push a button (postback) then I want to read
if a checkbox is checked and they have the old value, as nothing
would happen.
I found articles about this, but they make it with autopostback or
Datagrid.OnSelectedIndexChange method. Which I think is unnecessary.

Is there a solution?

Probably, you are databinding again on postback.
Don't.

Use (VB.NET):
If(Not Page.IsPostback) Then
' Databinding goes here
End If
 
P

Porgányi Géza

Riki said:
Probably, you are databinding again on postback.
Don't.

Use (VB.NET):
If(Not Page.IsPostback) Then
' Databinding goes here
End If
Thanks Riki,

But no, I don't databind again.

As a field was false(unchecked) and I check it on the page... It will be
checked on serverside, too. So unchecked->check direction works,
checked->uncheck doesn't.
I guess the problem is, that if I write chkBox.Checked = true, then it
renders "Checked ='checked'" into the HTML.

After postback it is written there again.
 
C

chan mt

Hi,

i am facing the same problem as you do..

when user selects a Checkbox on the 1st Datagrid page, then if the user
moves to another Datagrid page & comes back to hat 1st page, & deselects
the checkbox item in that 1st page, It just wouldn't go to the Loop
where i have "Checked = False" but instead always go to "Checked = True"

I really don't understand why this happens

please can u let me know if u have found a way of handling the selection
of the Checkboxes?

Regards,
chan
 
X

xianxian

same here.. im trying to look up on other forums too..

that's ok, keep me informed again

thanks! =)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,779
Messages
2,569,606
Members
45,239
Latest member
Alex Young

Latest Threads

Top