Page load to display the gridview
-
*This is my code *********** Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ds As New Data.DataSet Dim obj As Businesslayer.TimeSheet = New Businesslayer.TimeSheet Dim str As String = "select ProjectMember, Total_Hours from Timesheet" Dim repeater1 As Repeater Dim NumberOfBoxes As Integer Dim WhichBox As Integer NumberOfBoxes = Integer.Parse(WhichBox) Dim rows(NumberOfBoxes) As Integer For WhichBox = 0 To NumberOfBoxes rows(WhichBox) = WhichBox Next repeater1.DataSource = rows repeater1.DataBind() Dim bLayer As New Businesslayer.GlobalFunctions Dim reader As Data.SqlClient.SqlDataReader = bLayer.returnRecords(str) For WhichBox = 0 To NumberOfBoxes Dim cmbProjectName As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectName"), DropDownList) Dim cmbClientSite As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbClientSite"), DropDownList) Dim cmbProjectManager As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectManager"), DropDownList) Dim cmbCategory As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbCategory"), DropDownList) Dim cmbProjectMember As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectMember"), DropDownList) Dim cmbOccupation As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbOccupation"), DropDownList) Next Session("Repeater1") = reader("Repeater") Session("ProjectMember") = reader("ProjectMember") Session("TotalHours") = reader("TotalHours") GridView1.DataSource = ds GridView1.DataBind() End Sub *********** *This is an error ********** Object reference not set to an instance of an object ***************** *I want the gridview to display selected values from the table **************** please help me what might be the problem oga m
-
*This is my code *********** Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ds As New Data.DataSet Dim obj As Businesslayer.TimeSheet = New Businesslayer.TimeSheet Dim str As String = "select ProjectMember, Total_Hours from Timesheet" Dim repeater1 As Repeater Dim NumberOfBoxes As Integer Dim WhichBox As Integer NumberOfBoxes = Integer.Parse(WhichBox) Dim rows(NumberOfBoxes) As Integer For WhichBox = 0 To NumberOfBoxes rows(WhichBox) = WhichBox Next repeater1.DataSource = rows repeater1.DataBind() Dim bLayer As New Businesslayer.GlobalFunctions Dim reader As Data.SqlClient.SqlDataReader = bLayer.returnRecords(str) For WhichBox = 0 To NumberOfBoxes Dim cmbProjectName As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectName"), DropDownList) Dim cmbClientSite As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbClientSite"), DropDownList) Dim cmbProjectManager As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectManager"), DropDownList) Dim cmbCategory As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbCategory"), DropDownList) Dim cmbProjectMember As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectMember"), DropDownList) Dim cmbOccupation As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbOccupation"), DropDownList) Next Session("Repeater1") = reader("Repeater") Session("ProjectMember") = reader("ProjectMember") Session("TotalHours") = reader("TotalHours") GridView1.DataSource = ds GridView1.DataBind() End Sub *********** *This is an error ********** Object reference not set to an instance of an object ***************** *I want the gridview to display selected values from the table **************** please help me what might be the problem oga m
Why don't wait for replies to the first post. :mad::mad: Yes, this one is different code but the problem is the same. :mad::mad:
only two letters away from being an asset
-
*This is my code *********** Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ds As New Data.DataSet Dim obj As Businesslayer.TimeSheet = New Businesslayer.TimeSheet Dim str As String = "select ProjectMember, Total_Hours from Timesheet" Dim repeater1 As Repeater Dim NumberOfBoxes As Integer Dim WhichBox As Integer NumberOfBoxes = Integer.Parse(WhichBox) Dim rows(NumberOfBoxes) As Integer For WhichBox = 0 To NumberOfBoxes rows(WhichBox) = WhichBox Next repeater1.DataSource = rows repeater1.DataBind() Dim bLayer As New Businesslayer.GlobalFunctions Dim reader As Data.SqlClient.SqlDataReader = bLayer.returnRecords(str) For WhichBox = 0 To NumberOfBoxes Dim cmbProjectName As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectName"), DropDownList) Dim cmbClientSite As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbClientSite"), DropDownList) Dim cmbProjectManager As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectManager"), DropDownList) Dim cmbCategory As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbCategory"), DropDownList) Dim cmbProjectMember As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbProjectMember"), DropDownList) Dim cmbOccupation As DropDownList = CType(repeater1.Items(WhichBox).FindControl("cmbOccupation"), DropDownList) Next Session("Repeater1") = reader("Repeater") Session("ProjectMember") = reader("ProjectMember") Session("TotalHours") = reader("TotalHours") GridView1.DataSource = ds GridView1.DataBind() End Sub *********** *This is an error ********** Object reference not set to an instance of an object ***************** *I want the gridview to display selected values from the table **************** please help me what might be the problem oga m