Further to my post below, I've tried to replicate the error in a hope that
I'm definately doing something wrong, and it's not my code. The following
DOES work.
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
SqlConnection1.Open()
SqlCommand1.Parameters("@members").Value = "1007,4200,999"
daTest.SelectCommand = SqlCommand1
daTest.Fill(dsTest, "TestTable")
Dim dvTest As New DataView(dsTest.Tables("TestTable"), "", "",
DataViewRowState.CurrentRows)
DataGrid1.DataSource = dvTest
DataGrid1.DataBind()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim newrow As DataRow
newrow = dsTest.Tables("TestTable").NewRow
newrow(0) = "1"
newrow(1) = "Jason"
newrow(2) = "1"
dsTest.Tables("TestTable").Rows.Add(newrow)
DataGrid1.DataBind()
End Sub
If you were to move the code from page_init, into the If Not IsPostBack
command, then it fails.
Can someone PLEASE explain to me what on earth I'm doing wrong.
TIA