M
Michelle
This is my third VB.NET forum to try and help me with my problems and several people have failed so I am hoping someone here is a TRUE GURU on datagrids!
I have a datagrid that I bind to a datasource in the page_load event. No problem.
However, when I try to do ANYTHING to its data, nothing works.
Problem 1)
When clicking a dropdown I try to create a dataview based on the value the user selected in the DD and have the filter based on that value....Here is the code.....
Private Sub ddPQMSGrp_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddPQMSGrp.SelectedIndexChanged
Dim strSvcValue As String
strSvcValue = ddPQMSGrp.SelectedItem.Text
Dim dv As New DataView(DataSet151.Tables("Products"))
dv.Table = DataSet151.Products
dv.RowFilter = "[ItemCode (SAP)] = 'strSvcValue'"
DataGridProd.DataSource = dv
DataGridProd.DataBind()
My dataview finds no records matching my filter criteria (which I know exists in the table and the debugger shows that my variable 'strSvcValue' contains the correct value)
Problem 2)
The datagrids property is set to Allow Sorting. My code is as follows...
Private Sub DataGridProd_SortCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs)
DataGridProd.DataSource = DataSet151.Products.DefaultView
DataSet151.Products.DefaultView.Sort = e.SortExpression
DataGridProd.DataBind()
End Sub
Nothing happens to the datagrid...the data does not change.
Problem 3)
I cannot click on the numbers at the bottom of the datagrid to page through the records. I have the AllowPaging set to true and have selected 30 records to display on each page. My code is as follows.....
Private Sub DataGridProd_PageIndexChanged(ByVal source As System.Object,
ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs)
DataGridProd.CurrentPageIndex = e.NewPageIndex
DataGridProd.DataBind()
End Sub
The data on the datagrid does not change.
Someone, please help me. All of my code basically comes from MS tutorials, my ASP.net class, the Visual Studio help files with sample code, etc. I have even tried using different tables and different databases but every datagrid acts the same (eg, no changes allowed!!) I"M CONSIDERING A SMALL REWARD FOR THE PERSON WHO CAN HELP ME
From http://www.developmentnow.com/g/12_2005_2_0_0_0/dotnet-framework-aspnet-datagridcontrol.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com
I have a datagrid that I bind to a datasource in the page_load event. No problem.
However, when I try to do ANYTHING to its data, nothing works.
Problem 1)
When clicking a dropdown I try to create a dataview based on the value the user selected in the DD and have the filter based on that value....Here is the code.....
Private Sub ddPQMSGrp_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddPQMSGrp.SelectedIndexChanged
Dim strSvcValue As String
strSvcValue = ddPQMSGrp.SelectedItem.Text
Dim dv As New DataView(DataSet151.Tables("Products"))
dv.Table = DataSet151.Products
dv.RowFilter = "[ItemCode (SAP)] = 'strSvcValue'"
DataGridProd.DataSource = dv
DataGridProd.DataBind()
My dataview finds no records matching my filter criteria (which I know exists in the table and the debugger shows that my variable 'strSvcValue' contains the correct value)
Problem 2)
The datagrids property is set to Allow Sorting. My code is as follows...
Private Sub DataGridProd_SortCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs)
DataGridProd.DataSource = DataSet151.Products.DefaultView
DataSet151.Products.DefaultView.Sort = e.SortExpression
DataGridProd.DataBind()
End Sub
Nothing happens to the datagrid...the data does not change.
Problem 3)
I cannot click on the numbers at the bottom of the datagrid to page through the records. I have the AllowPaging set to true and have selected 30 records to display on each page. My code is as follows.....
Private Sub DataGridProd_PageIndexChanged(ByVal source As System.Object,
ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs)
DataGridProd.CurrentPageIndex = e.NewPageIndex
DataGridProd.DataBind()
End Sub
The data on the datagrid does not change.
Someone, please help me. All of my code basically comes from MS tutorials, my ASP.net class, the Visual Studio help files with sample code, etc. I have even tried using different tables and different databases but every datagrid acts the same (eg, no changes allowed!!) I"M CONSIDERING A SMALL REWARD FOR THE PERSON WHO CAN HELP ME
From http://www.developmentnow.com/g/12_2005_2_0_0_0/dotnet-framework-aspnet-datagridcontrol.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com