R
Roy
I am very, very new to ASP.NEt and have never done ASP.
I have been trying to get a datagrid to work for about 5 days with very
limited results.
When I use property builder, bind the control, set the paging and populate
it from the page_load event it works.
However, if I set it as unbound, then set the properties through code the
grid does not show. I check the dataset count and there are 43 rows.
My first question is "Can a datagrid properties be set by code and work"
Below is the essential code. If someone see what is wrong, please! PLEASE!
let me know.
TIA,
Roy
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
daDeptList.Fill(ds.DeptList)
dgDeptList.DataBind()
scSelectLAst.Parameters("@lastname").Value = "s"
daPhoneLast.Fill(ds.LastName)
ConfigureGrid(dgName, 5)
dgName.DataSource = ds.LastName
dgName.DataBind()
End Sub
Private Sub ConfigureGrid(ByVal dg As DataGrid, ByVal iPageSize As Integer)
dg.AllowPaging = True
dg.PageSize = iPageSize
dg.PagerStyle.Mode = PagerMode.NextPrev
dg.PagerStyle.NextPageText = "Next"
dg.PagerStyle.PrevPageText = "Previous"
dg.AllowCustomPaging = False
dg.AutoGenerateColumns = False
End Sub
I have been trying to get a datagrid to work for about 5 days with very
limited results.
When I use property builder, bind the control, set the paging and populate
it from the page_load event it works.
However, if I set it as unbound, then set the properties through code the
grid does not show. I check the dataset count and there are 43 rows.
My first question is "Can a datagrid properties be set by code and work"
Below is the essential code. If someone see what is wrong, please! PLEASE!
let me know.
TIA,
Roy
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
daDeptList.Fill(ds.DeptList)
dgDeptList.DataBind()
scSelectLAst.Parameters("@lastname").Value = "s"
daPhoneLast.Fill(ds.LastName)
ConfigureGrid(dgName, 5)
dgName.DataSource = ds.LastName
dgName.DataBind()
End Sub
Private Sub ConfigureGrid(ByVal dg As DataGrid, ByVal iPageSize As Integer)
dg.AllowPaging = True
dg.PageSize = iPageSize
dg.PagerStyle.Mode = PagerMode.NextPrev
dg.PagerStyle.NextPageText = "Next"
dg.PagerStyle.PrevPageText = "Previous"
dg.AllowCustomPaging = False
dg.AutoGenerateColumns = False
End Sub