By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,813 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,813 IT Pros & Developers. It's quick & easy.

template column checkbox problem in grid view

P: n/a
I have the following on my page... a link button that will send the command
name "use" to the command handler and a grid view with the following columns

0 - Template column - just a checkbox (asp.net control)
1 - Bound column - DisplayName from data table

the checkbox is just a template i made by placeing an asp.net control into
the item template

when I check items on the grid then click the link and execute the following
code in it

Protected Sub ToolbarCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs) Handles
lnkUseRecipients.Command, lnkCancel.Command

Select Case e.CommandName.Trim.ToCharArray

Case "USE"

For Each _gvRow As GridViewRow In Me.GridView1.Rows

' perform the selected command on all checked messages

If DirectCast(_gvRow.Cells(0).Controls(1), CheckBox).Checked Then

'do something here

End If

Next

end sub

when I run through it, all the items come back as unchecked... but the
strange thing... similar method on another page doing it the same way and it
comes back with items checked! why would one post back the checked items and
the other not? what should I look for? any suggestions on how to help?
thanks!
Jun 27 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I should probably add the grid is databound to a typed collection that
inherited from the collectionbase on the page that doesnt work, and the page
that does work is tied to a datatable
"Smokey Grindle" <no********@dontspam.net> wrote in message
news:eM**************@TK2MSFTNGP02.phx.gbl...
I have the following on my page... a link button that will send the command
name "use" to the command handler and a grid view with the following
columns

0 - Template column - just a checkbox (asp.net control)
1 - Bound column - DisplayName from data table

the checkbox is just a template i made by placeing an asp.net control into
the item template

when I check items on the grid then click the link and execute the
following code in it

Protected Sub ToolbarCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs) Handles
lnkUseRecipients.Command, lnkCancel.Command

Select Case e.CommandName.Trim.ToCharArray

Case "USE"

For Each _gvRow As GridViewRow In Me.GridView1.Rows

' perform the selected command on all checked messages

If DirectCast(_gvRow.Cells(0).Controls(1), CheckBox).Checked Then

'do something here

End If

Next

end sub

when I run through it, all the items come back as unchecked... but the
strange thing... similar method on another page doing it the same way and
it comes back with items checked! why would one post back the checked
items and the other not? what should I look for? any suggestions on how to
help? thanks!

Jun 27 '06 #2

P: n/a
nevermind im stupid today.. i was rebinding on postback in page load.. which
was clearing the data..
"Smokey Grindle" <no********@dontspam.net> wrote in message
news:uT*************@TK2MSFTNGP05.phx.gbl...
I should probably add the grid is databound to a typed collection that
inherited from the collectionbase on the page that doesnt work, and the
page that does work is tied to a datatable
"Smokey Grindle" <no********@dontspam.net> wrote in message
news:eM**************@TK2MSFTNGP02.phx.gbl...
I have the following on my page... a link button that will send the
command name "use" to the command handler and a grid view with the
following columns

0 - Template column - just a checkbox (asp.net control)
1 - Bound column - DisplayName from data table

the checkbox is just a template i made by placeing an asp.net control
into the item template

when I check items on the grid then click the link and execute the
following code in it

Protected Sub ToolbarCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs) Handles
lnkUseRecipients.Command, lnkCancel.Command

Select Case e.CommandName.Trim.ToCharArray

Case "USE"

For Each _gvRow As GridViewRow In Me.GridView1.Rows

' perform the selected command on all checked messages

If DirectCast(_gvRow.Cells(0).Controls(1), CheckBox).Checked Then

'do something here

End If

Next

end sub

when I run through it, all the items come back as unchecked... but the
strange thing... similar method on another page doing it the same way and
it comes back with items checked! why would one post back the checked
items and the other not? what should I look for? any suggestions on how
to help? thanks!


Jun 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.