P
postings
Hi
I have problems with autopostback and the gridview control. Please
continue reading.
The code below turns a row red when a tickbox is ticked in
edititemtemplate. Note autopostback on the tickbox is enabled and the
code works perfectly.
-------------------------------------------------------------------------------------------------------------------
Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e
As System.EventArgs)
Dim checkbox As CheckBox = CType(sender, CheckBox)
Dim row As GridViewRow = CType(checkbox.NamingContainer, GridViewRow)
If checkbox.Checked = True Then
row.BackColor = Drawing.Color.Red
'mygridview.Columns(0).Visible = False
end if
end sub
-------------------------------------------------------------------------------------------------------------------
However if I uncomment:
mygridview.Columns(0).Visible = False
....then the behaviour changes.
The first time I click the tickbox the column hides and the tickbox
doesn't get ticked like it should. The second time I click the
textbox the row turns red (column remains hidden).
I need the column hidden and the row colour to change on one
autopostback, not two. How can I achieve this?
Many thanks
Alex
I have problems with autopostback and the gridview control. Please
continue reading.
The code below turns a row red when a tickbox is ticked in
edititemtemplate. Note autopostback on the tickbox is enabled and the
code works perfectly.
-------------------------------------------------------------------------------------------------------------------
Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e
As System.EventArgs)
Dim checkbox As CheckBox = CType(sender, CheckBox)
Dim row As GridViewRow = CType(checkbox.NamingContainer, GridViewRow)
If checkbox.Checked = True Then
row.BackColor = Drawing.Color.Red
'mygridview.Columns(0).Visible = False
end if
end sub
-------------------------------------------------------------------------------------------------------------------
However if I uncomment:
mygridview.Columns(0).Visible = False
....then the behaviour changes.
The first time I click the tickbox the column hides and the tickbox
doesn't get ticked like it should. The second time I click the
textbox the row turns red (column remains hidden).
I need the column hidden and the row colour to change on one
autopostback, not two. How can I achieve this?
Many thanks
Alex