Get the first and last row for each child row
-
Hi All, I am a newbie to ASP.NET and in need of you help, basically, I have a gridview that binded from two functions (type datatable). One function is parent which I past one parameter ("DeptID") while loading this table I also called the child funtion which get the parameter from the parent function ("FolderID"). The grid bind fine, but my tast is to place a down arrow at the first child row under the parent and an a up arrow at the last child row and the process repeated for each parent that have one or more rows. This is where I have been banging head head trying to get this work but has no success. Parent row data1 Down arrow Child row data - first row up/down arrow Child row data up/down arrow Child row data up/down arrow Child row data up arrow Child row data - last row Parent row data2 Down arrow Child row data - first row up/down arrow Child row data up/down arrow Child row data up arrow Child row data - last row Parent row data3 Down arrow Child row data - first row up/down arrow Child row data up arrow Child row data - last row Parent row data4 Child row data - first row Any assistance is greatly apprecaited. please provide codes example. Thanks DocHoliday. Here are my codes behind VB: Protected Sub DisplayParentGV() Dim Conn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("mConn").ToString) Dim SQLCmd As New SqlCommand("Get_Links_Name", conn) Dim SQLDBDataReader As SqlClient.SqlDataReader Dim dt As New DataTable() Try If conn.State = ConnectionState.Closed Then conn.Open() End If SQLCmd.CommandType = CommandType.StoredProcedure SQLCmd.Connection = conn SQLCmd.Parameters.Add("@DeptID", SqlDbType.Int, 60).Value = Convert.ToInt32(Session("Dept_id")) dt.Columns.Add(New DataColumn("FolderID", GetType(String))) dt.Columns.Add(New DataColumn("FolderFileID", GetType(String))) dt.Columns.Add(New DataColumn("ImageType", GetType(String))) dt.Columns.Add(New DataColumn("Page", GetType(String))) dt.Columns.Add(New DataColumn("FolderOrder", GetType(String))) dt.Columns.Add(New DataColumn("Link_FileOrder", GetType(String))) SQLDBDataReader = SQLCmd.ExecuteReader() While SQLDBDataReader.Read() Dim dr As DataRow = dt.NewRow() Di
-
Hi All, I am a newbie to ASP.NET and in need of you help, basically, I have a gridview that binded from two functions (type datatable). One function is parent which I past one parameter ("DeptID") while loading this table I also called the child funtion which get the parameter from the parent function ("FolderID"). The grid bind fine, but my tast is to place a down arrow at the first child row under the parent and an a up arrow at the last child row and the process repeated for each parent that have one or more rows. This is where I have been banging head head trying to get this work but has no success. Parent row data1 Down arrow Child row data - first row up/down arrow Child row data up/down arrow Child row data up/down arrow Child row data up arrow Child row data - last row Parent row data2 Down arrow Child row data - first row up/down arrow Child row data up/down arrow Child row data up arrow Child row data - last row Parent row data3 Down arrow Child row data - first row up/down arrow Child row data up arrow Child row data - last row Parent row data4 Child row data - first row Any assistance is greatly apprecaited. please provide codes example. Thanks DocHoliday. Here are my codes behind VB: Protected Sub DisplayParentGV() Dim Conn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("mConn").ToString) Dim SQLCmd As New SqlCommand("Get_Links_Name", conn) Dim SQLDBDataReader As SqlClient.SqlDataReader Dim dt As New DataTable() Try If conn.State = ConnectionState.Closed Then conn.Open() End If SQLCmd.CommandType = CommandType.StoredProcedure SQLCmd.Connection = conn SQLCmd.Parameters.Add("@DeptID", SqlDbType.Int, 60).Value = Convert.ToInt32(Session("Dept_id")) dt.Columns.Add(New DataColumn("FolderID", GetType(String))) dt.Columns.Add(New DataColumn("FolderFileID", GetType(String))) dt.Columns.Add(New DataColumn("ImageType", GetType(String))) dt.Columns.Add(New DataColumn("Page", GetType(String))) dt.Columns.Add(New DataColumn("FolderOrder", GetType(String))) dt.Columns.Add(New DataColumn("Link_FileOrder", GetType(String))) SQLDBDataReader = SQLCmd.ExecuteReader() While SQLDBDataReader.Read() Dim dr As DataRow = dt.NewRow() Di
Why do you require to deal with first and last row when you can easily do this using You might consider asp:repeater which already has HeaderTemplate and FooterTemplate to deal with just this. :thumbsup:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Why do you require to deal with first and last row when you can easily do this using You might consider asp:repeater which already has HeaderTemplate and FooterTemplate to deal with just this. :thumbsup:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptDoes repeater have the same function as gridview does ?
-
Why do you require to deal with first and last row when you can easily do this using You might consider asp:repeater which already has HeaderTemplate and FooterTemplate to deal with just this. :thumbsup:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptI need to get the first and last row because my page allow user to move the order of the child row up/down. Therefore, if the child row is first row then user cannot move it up and same for last row, user cannot move it down.
-
I need to get the first and last row because my page allow user to move the order of the child row up/down. Therefore, if the child row is first row then user cannot move it up and same for last row, user cannot move it down.
Yes ...
Repeater
has that option. Acutally everything in repeater is created by you. Just usePageDataSource
to handle paging. Place values inViewState
and useHeaderTemplate
andFooterTemplate
to have first and last row. You might give it a try... :rose:Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Yes ...
Repeater
has that option. Acutally everything in repeater is created by you. Just usePageDataSource
to handle paging. Place values inViewState
and useHeaderTemplate
andFooterTemplate
to have first and last row. You might give it a try... :rose:Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptThanks