P
Peter Afonin
Hello:
I'm updating multiple rows in the datagrid, using the routine described in
the article "Top Questions about the DataGrid Web Server Control":
http://msdn.microsoft.com/library/d...questionsaboutaspnetdatagridservercontrol.asp
To determine which rows had been changed, I'm using the RowChanged sub:
Protected Sub RowChanged(ByVal sender As Object, _
ByVal e As System.EventArgs)
'---------------------------------------------------------------------------
---------------------
' Add ID's for changed rows
'---------------------------------------------------------------------------
---------------------
Try
Dim dgi As DataGridItem = _
CType(CType(sender, Control).NamingContainer, DataGridItem)
Dim IDlabel As Label = CType(dgi.FindControl("lblOrder"), Label)
Dim ID As Integer = CType(IDlabel.Text, Integer)
If Not (IDlist.Contains(ID)) Then
IDlist.Add(ID)
End If
Catch ex As Exception
Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
End Try
End Sub
<asp:CheckBox id="chkInHouse" ToolTip="Plates In House" runat="server"
OnCheckedChanged="RowChanged" Checked='<%# DataBinder.Eval(Container,
"DataItem.InHouse") %>'>
It works OK everywhere, except one datagrid where some of my checkboxes are
invisible - the user has to click a button to make them visible. These
invisible checkboxes always indicate that their values had been changed. As
a result all my data from the datagrid is sent to the database, even if no
changes has been made. As soon as I make these checkboxes visible -
everything works OK.
Why is this happening? Is there any workaround?
I would appreciate your help.
Thank you,
I'm updating multiple rows in the datagrid, using the routine described in
the article "Top Questions about the DataGrid Web Server Control":
http://msdn.microsoft.com/library/d...questionsaboutaspnetdatagridservercontrol.asp
To determine which rows had been changed, I'm using the RowChanged sub:
Protected Sub RowChanged(ByVal sender As Object, _
ByVal e As System.EventArgs)
'---------------------------------------------------------------------------
---------------------
' Add ID's for changed rows
'---------------------------------------------------------------------------
---------------------
Try
Dim dgi As DataGridItem = _
CType(CType(sender, Control).NamingContainer, DataGridItem)
Dim IDlabel As Label = CType(dgi.FindControl("lblOrder"), Label)
Dim ID As Integer = CType(IDlabel.Text, Integer)
If Not (IDlist.Contains(ID)) Then
IDlist.Add(ID)
End If
Catch ex As Exception
Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
End Try
End Sub
<asp:CheckBox id="chkInHouse" ToolTip="Plates In House" runat="server"
OnCheckedChanged="RowChanged" Checked='<%# DataBinder.Eval(Container,
"DataItem.InHouse") %>'>
It works OK everywhere, except one datagrid where some of my checkboxes are
invisible - the user has to click a button to make them visible. These
invisible checkboxes always indicate that their values had been changed. As
a result all my data from the datagrid is sent to the database, even if no
changes has been made. As soon as I make these checkboxes visible -
everything works OK.
Why is this happening? Is there any workaround?
I would appreciate your help.
Thank you,